From c9232dcda016feb2d30abb51483b3b1862775f84 Mon Sep 17 00:00:00 2001 From: bungeman Date: Mon, 10 Nov 2014 13:29:33 -0800 Subject: 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 --- gm/fontmgr.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gm/fontmgr.cpp') 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; } -- cgit v1.2.3