Index: src/core/SkTypeface.cpp |
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp |
index 342c41553d15da8e98a2764eb46e40fe808ec4e7..0f5d70b1a8ccbe28ce2c51252223e2e70f11ed31 100644 |
--- a/src/core/SkTypeface.cpp |
+++ b/src/core/SkTypeface.cpp |
@@ -143,11 +143,6 @@ |
return fm->createFromStream(stream, index); |
} |
-SkTypeface* SkTypeface::CreateFromFontData(SkFontData* data) { |
- SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
- return fm->createFromFontData(data); |
-} |
- |
SkTypeface* SkTypeface::CreateFromFile(const char path[], int index) { |
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
return fm->createFromFile(path, index); |
@@ -162,7 +157,9 @@ |
// Embed font data if it's a local font. |
if (isLocal && !desc.hasFontData()) { |
- desc.setFontData(this->onCreateFontData()); |
+ int ttcIndex; |
+ desc.setFontData(this->onOpenStream(&ttcIndex)); |
+ desc.setFontIndex(ttcIndex); |
} |
desc.serialize(wstream); |
} |
@@ -174,16 +171,18 @@ |
// Always embed font data. |
if (!desc.hasFontData()) { |
- desc.setFontData(this->onCreateFontData()); |
+ int ttcIndex; |
+ desc.setFontData(this->onOpenStream(&ttcIndex)); |
+ desc.setFontIndex(ttcIndex); |
} |
desc.serialize(wstream); |
} |
SkTypeface* SkTypeface::Deserialize(SkStream* stream) { |
SkFontDescriptor desc(stream); |
- SkFontData* data = desc.detachFontData(); |
+ SkStreamAsset* data = desc.transferFontData(); |
if (data) { |
- SkTypeface* typeface = SkTypeface::CreateFromFontData(data); |
+ SkTypeface* typeface = SkTypeface::CreateFromStream(data, desc.getFontIndex()); |
if (typeface) { |
return typeface; |
} |
@@ -218,17 +217,6 @@ |
} |
return this->onOpenStream(ttcIndex); |
} |
- |
-SkFontData* SkTypeface::createFontData() const { |
- return this->onCreateFontData(); |
-} |
- |
-// This implementation is temporary until this method can be made pure virtual. |
-SkFontData* SkTypeface::onCreateFontData() const { |
- int index; |
- SkAutoTDelete<SkStreamAsset> stream(this->onOpenStream(&index)); |
- return new SkFontData(stream.detach(), index, NULL, 0); |
-}; |
int SkTypeface::charsToGlyphs(const void* chars, Encoding encoding, |
uint16_t glyphs[], int glyphCount) const { |