aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/fontmgr.cpp
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-11-10 13:29:33 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-10 13:29:33 -0800
commitc9232dcda016feb2d30abb51483b3b1862775f84 (patch)
tree90d05cb259ca41c106dd51f21e93789f2225a587 /gm/fontmgr.cpp
parentb61e206138607423e83ba34d823c6036f394f655 (diff)
Remove SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER.
This removes the old guarded code and enables the new api introduced with "Update fontMgr to take list of bcp47 language tags." c20386e3937d3d398ac9b35f9c7d997e972ade98 . Blink on Android is already using the new code. Review URL: https://codereview.chromium.org/705843004
Diffstat (limited to 'gm/fontmgr.cpp')
-rw-r--r--gm/fontmgr.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index be2b11a272..99cff6e4d3 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -33,16 +33,13 @@ static SkScalar drawString(SkCanvas* canvas, const SkString& text, SkScalar x,
static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
SkScalar y, SkPaint& paint, SkFontMgr* fm,
- const char* fontName, const char* bpc47,
+ const char* fontName, const char* bcp47[], int bcp47Count,
const SkFontStyle& fontStyle) {
// find typeface containing the requested character and draw it
SkString ch;
ch.appendUnichar(character);
-#ifdef SK_FM_NEW_MATCH_FAMILY_STYLE_CHARACTER
- SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, &bpc47, 1, character);
-#else
- SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle, bpc47, character);
-#endif
+ SkTypeface* typeface = fm->matchFamilyStyleCharacter(fontName, fontStyle,
+ bcp47, bcp47Count, character);
SkSafeUnref(paint.setTypeface(typeface));
x = drawString(canvas, ch, x, y, paint) + 20;
@@ -60,6 +57,9 @@ static SkScalar drawCharacter(SkCanvas* canvas, uint32_t character, SkScalar x,
return drawString(canvas, ch, x, y, paint) + 20;
}
+static const char* zh = "zh";
+static const char* ja = "ja";
+
class FontMgrGM : public skiagm::GM {
public:
FontMgrGM(SkFontMgr* fontMgr = NULL) {
@@ -113,10 +113,10 @@ protected:
x = drawString(canvas, sname, x, y, paint) + 20;
// check to see that we get different glyphs in japanese and chinese
- x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str(), "zh", fs);
- x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str(), "ja", fs);
+ x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str(), &zh, 1, fs);
+ x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str(), &ja, 1, fs);
// check that emoji characters are found
- x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, fName.c_str(), NULL, fs);
+ x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, fName.c_str(), NULL, 0, fs);
}
y += 24;
}