diff options
author | bungeman <bungeman@google.com> | 2014-10-28 10:46:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-28 10:46:06 -0700 |
commit | ee0c2e4fd429424beaa35f29e7f656997ba3f115 (patch) | |
tree | 7d85a69c1d3968ebfea80cbf2e1d5ca69acd2914 /src/ports/SkFontMgr_android.cpp | |
parent | 9571567802ab7db17ab6d5d7087981c7600f0dcb (diff) |
Extend SkFontMgr_Custom to cover ttc, otf, pfb.
Adds ability to test ScanFont with Type1 (pfb) fonts
and fonts with multiple faces (ttc).
Review URL: https://codereview.chromium.org/672723002
Diffstat (limited to 'src/ports/SkFontMgr_android.cpp')
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index c527551575..4677a1f86d 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; |