Chromium Code Reviews| Index: tools/sk_tool_utils.cpp |
| diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp |
| index 7343ce4744e661bd5a08600fb58df0d202c6d253..864db778ddf8d68cda3c92e519931b487ba49bdb 100644 |
| --- a/tools/sk_tool_utils.cpp |
| +++ b/tools/sk_tool_utils.cpp |
| @@ -12,6 +12,8 @@ |
| #include "SkBitmap.h" |
| #include "SkCanvas.h" |
| #include "SkCommonFlags.h" |
| +#include "SkFontMgr.h" |
| +#include "SkFontStyle.h" |
| #include "SkPoint3.h" |
| #include "SkShader.h" |
| #include "SkTestScalerContext.h" |
| @@ -72,6 +74,9 @@ const char* platform_os_emoji() { |
| if (!strncmp(osName, "Mac", 3)) { |
| return "SBIX"; |
| } |
| + if (!strncmp(osName, "Win", 3)) { |
| + return "COLR"; |
| + } |
| return ""; |
| } |
| @@ -82,6 +87,23 @@ sk_sp<SkTypeface> emoji_typeface() { |
| if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { |
| return SkTypeface::MakeFromName("Apple Color Emoji", SkTypeface::kNormal); |
| } |
| + if (!strcmp(sk_tool_utils::platform_os_emoji(), "COLR")) { |
| + sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| + const char *colorEmojiFontName = "Segoe UI Emoji"; |
| + sk_sp<SkTypeface> typeface(fm->matchFamilyStyle(colorEmojiFontName, SkFontStyle())); |
| + if (typeface) { |
| + return typeface; |
| + } |
| + sk_sp<SkTypeface> fallback(fm->matchFamilyStyleCharacter( |
| + colorEmojiFontName, SkFontStyle(), nullptr /* bcp47 */, 0 /* bcp47Count */, |
| + 0x1f4b0 /* character: 💰 */)); |
| + if (fallback) { |
| + return fallback; |
| + } |
| + // If we don't have Segoe UI Emoji and can't find a fallback, try Segoe UI Symbol. |
| + // Windows 7 does not have Segoe UI Emoji; Segoe UI Symbol has the (non - color) emoji. |
| + return SkTypeface::MakeFromName("Segoe UI Symbol", SkTypeface::kNormal); |
|
bungeman-skia
2016/05/31 19:19:58
This line conflicts with another change that just
Ilya Kulshin
2016/06/01 05:47:43
Done. Thanks for the headsup.
|
| + } |
| return nullptr; |
| } |
| @@ -89,7 +111,9 @@ const char* emoji_sample_text() { |
| if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { |
| return "Hamburgefons"; |
| } |
| - if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { |
| + if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX") || |
| + !strcmp(sk_tool_utils::platform_os_emoji(), "COLR")) |
| + { |
| return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅 |
| "\xF0\x9F\x8D\xAA" "\xF0\x9F\x8D\x95" "\xF0\x9F\x9A\x80" // 🍪🍕🚀 |
| "\xF0\x9F\x9A\xBB" "\xF0\x9F\x92\xA9" "\xF0\x9F\x93\xB7" // 🚻💩📷 |