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

Unified Diff: gm/dftext.cpp

Issue 1248703004: make color emoji gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « gm/coloremoji.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dftext.cpp
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 0ee01e3309daaf890c3b8974ccc9c9a3aee30bd6..451529c04a5332368a2a12228d37ae9f8d82b1fa 100755
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -24,11 +24,19 @@ public:
protected:
void onOnceBeforeDraw() override {
- fTypeface = GetResourceAsTypeface("/fonts/Funkster.ttf");
+ if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
+ fTypeface = GetResourceAsTypeface("/fonts/Funkster.ttf");
+ } else if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
+ fTypeface = SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal);
+ } else {
+ fTypeface = NULL;
+ }
}
SkString onShortName() override {
- return SkString("dftext");
+ SkString name("dftext");
+ name.append(sk_tool_utils::platform_os_emoji());
+ return name;
}
SkISize onISize() override {
@@ -73,7 +81,7 @@ protected:
paint.setAntiAlias(true);
paint.setSubpixelText(true);
- sk_tool_utils::set_portable_typeface(&paint, "Times New Roman", SkTypeface::kNormal);
+ sk_tool_utils::set_portable_typeface_always(&paint, "serif", SkTypeface::kNormal);
const char* text = "Hamburgefons";
bungeman-skia 2015/07/21 18:17:16 Apple Color Emoji should use different chars here
const size_t textLen = strlen(text);
@@ -169,7 +177,7 @@ protected:
y += paint.getFontMetrics(NULL);
}
- paint.setColor(0xFF1F1F1F);
+ paint.setColor(sk_tool_utils::color_to_565(0xFF1F1F1F));
r = SkRect::MakeLTRB(820, 250, 970, 460);
canvas->drawRect(r, paint);
@@ -204,14 +212,11 @@ protected:
}
// check color emoji
- paint.setTypeface(fTypeface);
-#ifdef SK_BUILD_FOR_ANDROID
- paint.setTextSize(SkIntToScalar(19));
-#else
- paint.setTextSize(SkIntToScalar(22));
-#endif
- canvas->drawText(text, textLen, 670, 100, paint);
-
+ if (fTypeface) {
+ paint.setTypeface(fTypeface);
+ paint.setTextSize(SkIntToScalar(19));
+ canvas->drawText(text, textLen, 670, 100, paint);
+ }
#if SK_SUPPORT_GPU
// render offscreen buffer
if (surface) {
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698