aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkTypeface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkTypeface.cpp')
-rw-r--r--src/core/SkTypeface.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index c537d4aa2d..02d2bc89c0 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -155,12 +155,26 @@ void SkTypeface::serialize(SkWStream* wstream) const {
SkFontDescriptor desc(this->style());
this->onGetFontDescriptor(&desc, &isLocal);
+ // Embed font data if it's a local font.
if (isLocal && NULL == desc.getFontData()) {
int ttcIndex;
desc.setFontData(this->onOpenStream(&ttcIndex));
desc.setFontIndex(ttcIndex);
}
+ desc.serialize(wstream);
+}
+
+void SkTypeface::serializeForcingEmbedding(SkWStream* wstream) const {
+ bool ignoredIsLocal;
+ SkFontDescriptor desc(this->style());
+ this->onGetFontDescriptor(&desc, &ignoredIsLocal);
+ // Always embed font data.
+ if (NULL == desc.getFontData()) {
+ int ttcIndex;
+ desc.setFontData(this->onOpenStream(&ttcIndex));
+ desc.setFontIndex(ttcIndex);
+ }
desc.serialize(wstream);
}