aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPictureData.cpp5
-rw-r--r--src/core/SkTypeface.cpp14
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 938274aceb..7fc165d219 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -180,7 +180,12 @@ void SkPictureData::WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec) {
rec.copyToArray((SkRefCnt**)array);
for (int i = 0; i < count; i++) {
+#ifdef SK_BUILD_FOR_UNIX
+ array[i]->serializeForcingEmbedding(stream);
+#else
+ // FIXME: Macs and Windows don't draw pixel-perfect if we embed fonts in the SKP.
array[i]->serialize(stream);
+#endif
}
}
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);
}