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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 672723002: Extend SkFontMgr_Custom to cover ttc, otf, pfb. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Keep FT_Stream alive, protect library with mutex. Created 6 years, 2 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/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index c527551575f7b3ddd3cfe626751101102cab3792..4677a1f86d0a2a7e32f2450e3d0dc9b943c2f09d 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -138,7 +138,9 @@ void get_path_for_sys_fonts(const char* basePath, const SkString& name, SkString
class SkFontStyleSet_Android : public SkFontStyleSet {
public:
- explicit SkFontStyleSet_Android(const FontFamily& family, const char* basePath) {
+ explicit SkFontStyleSet_Android(const FontFamily& family, const char* basePath,
+ const SkTypeface_FreeType::Scanner& scanner)
+ {
const SkString* cannonicalFamilyName = NULL;
if (family.fNames.count() > 0) {
cannonicalFamilyName = &family.fNames[0];
@@ -160,8 +162,7 @@ public:
SkString familyName;
SkFontStyle style;
bool isFixedWidth;
- if (!SkTypeface_FreeType::ScanFont(stream.get(), ttcIndex,
- &familyName, &style, &isFixedWidth)) {
+ if (!scanner.scanFont(stream.get(), ttcIndex, &familyName, &style, &isFixedWidth)) {
DEBUG_FONT(("---- SystemFonts[%d] file=%s (INVALID)", i, pathName.c_str()));
continue;
}
@@ -435,7 +436,7 @@ static SkTypeface_AndroidSystem* find_family_style_character(
bool isFixedPitch;
SkFontStyle style;
SkString name;
- if (!SkTypeface_FreeType::ScanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
+ if (!fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch)) {
return NULL;
}
return SkNEW_ARGS(SkTypeface_AndroidStream, (stream, ttcIndex,
@@ -460,6 +461,8 @@ static SkTypeface_AndroidSystem* find_family_style_character(
private:
+ SkTypeface_FreeType::Scanner fScanner;
+
SkTArray<SkAutoTUnref<SkFontStyleSet_Android>, true> fFontStyleSets;
SkFontStyleSet* fDefaultFamily;
SkTypeface* fDefaultTypeface;
@@ -481,7 +484,8 @@ private:
}
}
- SkFontStyleSet_Android* newSet = SkNEW_ARGS(SkFontStyleSet_Android, (family, basePath));
+ SkFontStyleSet_Android* newSet =
+ SkNEW_ARGS(SkFontStyleSet_Android, (family, basePath, fScanner));
if (0 == newSet->count()) {
SkDELETE(newSet);
continue;
« no previous file with comments | « src/ports/SkFontHost_linux.cpp ('k') | src/ports/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698