diff options
-rw-r--r-- | include/ports/SkFontConfigInterface.h | 11 | ||||
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontHost_fontconfig.cpp | 5 |
3 files changed, 13 insertions, 5 deletions
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h index 1e20438a08..0769362c8b 100644 --- a/include/ports/SkFontConfigInterface.h +++ b/include/ports/SkFontConfigInterface.h @@ -39,7 +39,16 @@ public: * to be a union of possible storage types to aid the impl. */ struct FontIdentity { - intptr_t fIntPtr; + FontIdentity() : fID(0), fTTCIndex(0) {} + + bool operator==(const FontIdentity& other) const { + return fID == other.fID && + fTTCIndex == other.fTTCIndex && + fString == other.fString; + } + + uint32_t fID; + int32_t fTTCIndex; SkString fString; }; diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index 7e7ab9eebe..2ac352375a 100644 --- a/src/ports/SkFontConfigInterface_direct.cpp +++ b/src/ports/SkFontConfigInterface_direct.cpp @@ -409,7 +409,7 @@ bool SkFontConfigInterfaceDirect::matchFamilyName(const char familyName[], FcFontSetDestroy(font_set); if (outIdentity) { - outIdentity->fIntPtr = face_index; + outIdentity->fTTCIndex = face_index; outIdentity->fString.set((const char*)c_filename); } if (outFamilyName) { diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 786b2a29dc..438b47d46a 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -260,8 +260,7 @@ static SkStream* open_stream(const FontConfigTypeface* face, int* ttcIndex) { return NULL; } stream = fci->openStream(face->getIdentity()); - // ttcIndex should be returned explicitly by openStream() - *ttcIndex = (int)face->getIdentity().fIntPtr; + *ttcIndex = face->getIdentity().fTTCIndex; } return stream; } @@ -288,7 +287,7 @@ size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, const SkString& filename = face->getIdentity().fString; if (index) { - *index = (int32_t)face->getIdentity().fIntPtr; + *index = face->getIdentity().fTTCIndex; } if (path) { size_t len = SkMin32(length, filename.size()); |