Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(922)

Unified Diff: src/core/SkTypeface.cpp

Issue 1128913008: Revert of Font variations. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/fonts/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTypeface.cpp
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 6d9759f42c4c536aec4492d9da24ea938a6bef66..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);
@@ -161,8 +156,10 @@
this->onGetFontDescriptor(&desc, &isLocal);
// Embed font data if it's a local font.
- if (!desc.hasFontData()) {
- desc.setFontData(this->onCreateFontData());
+ if (isLocal && !desc.hasFontData()) {
+ 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 {
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/fonts/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698