aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkTypeface.cpp
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2015-05-13 12:16:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-13 12:16:41 -0700
commit5ae1312c9faa25531c07e591b4dff6804020f121 (patch)
tree5ad34f4f5ddbe8f628d078be9480444d0d883f1d /src/core/SkTypeface.cpp
parent1573206f202c6d2ffcffab78b17160da95a80466 (diff)
Revert of Font variations. (patchset #21 id:400001 of https://codereview.chromium.org/1027373002/)
Reason for revert: Mac failing to build due to CFNumberType in Chromium Canary. Original issue's description: > Font variations. > > Multiple Master and TrueType fonts support variation axes. > This implements back-end support for axes on platforms which > support it. > > Committed: https://skia.googlesource.com/skia/+/05773ed30920c0214d1433c07cf6360a05476c97 TBR=reed@google.com,mtklein@google.com,djsollen@google.com,halcanary@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1128913008
Diffstat (limited to 'src/core/SkTypeface.cpp')
-rw-r--r--src/core/SkTypeface.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 6d9759f42c..0f5d70b1a8 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -143,11 +143,6 @@ SkTypeface* SkTypeface::CreateFromStream(SkStreamAsset* stream, int index) {
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 @@ void SkTypeface::serialize(SkWStream* wstream) const {
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 @@ void SkTypeface::serializeForcingEmbedding(SkWStream* wstream) const {
// 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;
}
@@ -219,17 +218,6 @@ SkStreamAsset* SkTypeface::openStream(int* ttcIndex) const {
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 {
if (glyphCount <= 0) {