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

Unified Diff: src/core/SkTypeface.cpp

Issue 567013002: Serialize the font index. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update the Custom FontMgr also. Created 6 years, 3 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
Index: src/core/SkTypeface.cpp
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index fcb2b8e2b13ae7d7430cb9863ff47a9f4a0bf650..012f8220da020a55e6084557ca3d992b19ffb909 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -144,14 +144,14 @@ SkTypeface* SkTypeface::CreateFromTypeface(const SkTypeface* family, Style s) {
return fm->matchFaceStyle(family, newStyle);
}
-SkTypeface* SkTypeface::CreateFromStream(SkStream* stream) {
+SkTypeface* SkTypeface::CreateFromStream(SkStream* stream, int index) {
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
- return fm->createFromStream(stream);
+ return fm->createFromStream(stream, index);
}
-SkTypeface* SkTypeface::CreateFromFile(const char path[]) {
+SkTypeface* SkTypeface::CreateFromFile(const char path[], int index) {
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
- return fm->createFromFile(path);
+ return fm->createFromFile(path, index);
}
///////////////////////////////////////////////////////////////////////////////
@@ -187,7 +187,7 @@ SkTypeface* SkTypeface::Deserialize(SkStream* stream) {
localStream->setMemoryOwned(addr, length);
if (stream->read(addr, length) == length) {
- return SkTypeface::CreateFromStream(localStream.get());
+ return SkTypeface::CreateFromStream(localStream.get(), desc.getFontFileIndex());
} else {
// Failed to read the full font data, so fall through and try to create from name.
// If this is because of EOF, all subsequent reads from the stream will be EOF.

Powered by Google App Engine
This is Rietveld 408576698