change FontIdentity to explicitly hold ttcIndex and ID, so we can use both in the
IPC version in chrome.
git-svn-id: http://skia.googlecode.com/svn/trunk@8005 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/ports/SkFontConfigInterface.h b/include/ports/SkFontConfigInterface.h
index 1e20438..0769362c 100644
--- a/include/ports/SkFontConfigInterface.h
+++ b/include/ports/SkFontConfigInterface.h
@@ -39,7 +39,16 @@
* 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 7e7ab9e..2ac3523 100644
--- a/src/ports/SkFontConfigInterface_direct.cpp
+++ b/src/ports/SkFontConfigInterface_direct.cpp
@@ -409,7 +409,7 @@
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 786b2a2..438b47d 100644
--- a/src/ports/SkFontHost_fontconfig.cpp
+++ b/src/ports/SkFontHost_fontconfig.cpp
@@ -260,8 +260,7 @@
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 @@
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());