のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

paintのlanguageが使われる場所

   1805 void SkPaint::descriptorProc(const SkDeviceProperties* deviceProperties,
   1806                              const SkMatrix* deviceMatrix,
   1807                              void (*proc)(const SkDescriptor*, void*),
   1808                              void* context, bool ignoreGamma) const {
   1809     SkScalerContext::Rec    rec;
   1810 
   1811     SkScalerContext::MakeRec(*this, deviceProperties, deviceMatrix, &rec); <===この中
   1812     if (ignoreGamma) {
   1813         rec.setLuminanceColor(0);
   1814     }
   1541 void SkScalerContext::MakeRec(const SkPaint& paint,
   1542                               const SkDeviceProperties* deviceProperties,
   1543                               const SkMatrix* deviceMatrix,
   1544                               Rec* rec) {

  (略)

   1691 #ifdef SK_BUILD_FOR_ANDROID
   1692     rec->fLanguage = paint.getLanguage(); <========================ここ
   1693     rec->fFontVariant = paint.getFontVariant();
   1694 #endif //SK_BUILD_FOR_ANDROID
   1695 
   1696     /*  Allow the fonthost to modify our rec before we use it as a key into the
   1697         cache. This way if we're asking for something that they will ignore,
   1698         they can modify our rec up front, so we don't create duplicate cache
   1699         entries.
   1700      */
   1701     SkFontHost::FilterRec(rec, typeface);
   1702 
   1703     // be sure to call PostMakeRec(rec) before you actually use it!
   1704 }
     32 struct SkScalerContextRec {
     33     uint32_t    fOrigFontID;
     34     uint32_t    fFontID;
     35     SkScalar    fTextSize, fPreScaleX, fPreSkewX;
     36     SkScalar    fPost2x2[2][2];
     37     SkScalar    fFrameWidth, fMiterLimit;
     38 #ifdef SK_SUPPORT_HINTING_SCALE_FACTOR
     39     SkScalar    fHintingScaleFactor;
     40 #endif
     41 #ifdef SK_BUILD_FOR_ANDROID
     42     SkLanguage fLanguage;  <=================================
     43     SkPaint::FontVariant fFontVariant;
     44 #endif
     45 
     46     //These describe the parameters to create (uniquely identify) the pre-blend.
     47     uint32_t    fLumBits;
     48     uint8_t     fDeviceGamma; //2.6, (0.0, 4.0) gamma, 0.0 for sRGB
     49     uint8_t     fPaintGamma;  //2.6, (0.0, 4.0) gamma, 0.0 for sRGB
     50     uint8_t     fContrast;    //0.8+1, [0.0, 1.0] artificial contrast
     51     uint8_t     fReservedAlign;
    989 SkFontID SkFontHost::NextLogicalFont(const SkScalerContextRec& rec) {
    990     SkAutoMutexAcquire  ac(gFamilyHeadAndNameListMutex);
    991     return nextLogicalFontLocked(rec);
    992 }
    994 static SkFontID nextLogicalFontLocked(const SkScalerContextRec& rec) {
    995     loadSystemFontsLocked();
    996 
    997     const SkTypeface* origTypeface = findFromUniqueIDLocked(rec.fOrigFontID);
    998     const SkTypeface* currTypeface = findFromUniqueIDLocked(rec.fFontID);
    999 
   1000     FallbackFontList* currentFallbackList =
   1001             getFallbackFontListLocked(rec.fLanguage); <=====
   1002     SkASSERT(currentFallbackList);
   1003 
   1004     SkASSERT(origTypeface != 0);
   1005     SkASSERT(currTypeface != 0);
   1006 
   1007     // Our fallback list always stores the id of the plain in each fallback
   1008     // family, so we transform currFontID to its plain equivalent.
   1009     SkFontID plainFontID = findTypefaceLocked(currTypeface, SkTypeface::kNormal)->uniqueID();
   1010 
   1011     /*  First see if fontID is already one of our fallbacks. If so, return
   1012         its successor. If fontID is not in our list, then return the first one
   1013         in our list. Note: list is zero-terminated, and returning zero means
   1014         we have no more fonts to use for fallbacks.
   1015      */
   1016     int plainFallbackFontIndex = findFallbackFontIndex(plainFontID, currentFallbackList);
   1017     int nextFallbackFontIndex = plainFallbackFontIndex + 1;
   1018 
   1019     // If a rec object is set to prefer "kDefault_Variant" it means they have no preference
   1020     // In this case, we set the value to "kCompact_Variant"
   1021     SkPaint::FontVariant recPreference = rec.fFontVariant;
   1022     if (recPreference == SkPaint::kDefault_Variant) {
   1023         recPreference = SkPaint::kCompact_Variant;
   1024     }
   1025     SkFontID nextFontID = 0;
   1026     while (nextFallbackFontIndex < currentFallbackList->fList.count()) {
   1027         bool normalFont =
   1028                 (currentFallbackList->fList[nextFallbackFontIndex].fVariant == SkPaint::kDefault_Variant);
   1029         bool fontChosen = (currentFallbackList->fList[nextFallbackFontIndex].fVariant == recPreference);
   1030         if (normalFont || fontChosen) {
   1031             const SkTypeface* nextTypeface =
   1032                     findFromUniqueIDLocked(currentFallbackList->fList[nextFallbackFontIndex].fFontID);
   1033             nextFontID = findTypefaceLocked(nextTypeface, origTypeface->style())->uniqueID();
   1034             break;
   1035         }
   1036         nextFallbackFontIndex++;
   1037     }
   1038 
   1039     SkDEBUGF(("---- nextLogicalFont: currFontID=%d, origFontID=%d, plainFontID=%d, "
   1040             "plainFallbackFontIndex=%d, nextFallbackFontIndex=%d "
   1041             "=> nextFontID=%d", rec.fFontID, rec.fOrigFontID, plainFontID,
   1042             plainFallbackFontIndex, nextFallbackFontIndex, nextFontID));
   1043     return nextFontID;
   1044 }