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

Unified Diff: tools/sk_tool_utils.cpp

Issue 1248703004: make color emoji gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more 565 color fixes 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 | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sk_tool_utils.cpp
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index b06fcda3a6d8d360ee60d657cae32bc8021c6df0..b8b43f6fe7a7779d910dca09bbd517ff01f84c0a 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -1,4 +1,4 @@
-/*
+ο»Ώ/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
@@ -8,6 +8,7 @@
#include "sk_tool_utils.h"
#include "sk_tool_utils_flags.h"
+#include "Resources.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkCommonFlags.h"
@@ -20,6 +21,41 @@ DEFINE_bool(resourceFonts, false, "Use resource fonts");
namespace sk_tool_utils {
+const char* platform_os_emoji() {
+ const char* osName = platform_os_name();
+ if (!strcmp(osName, "Android") || !strcmp(osName, "Unbuntu")) {
+ return "CBDT";
+ }
+ if (!strncmp(osName, "Mac", 3)) {
+ return "SBIX";
+ }
+ return "";
+}
+
+SkTypeface* emoji_typeface() {
+ if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
+ return GetResourceAsTypeface("/fonts/Funkster.ttf");
+ }
+ if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
+ return SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal);
+ }
+ return NULL;
+}
+
+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")) {
+ 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" // πŸš»πŸ’©πŸ“·
+ "\xF0\x9F\x93\xA6" // πŸ“¦
+ "\xF0\x9F\x87\xBA" "\xF0\x9F\x87\xB8" "\xF0\x9F\x87\xA6"; // πŸ‡ΊπŸ‡ΈπŸ‡¦
+ }
+ return "";
+}
+
const char* platform_os_name() {
for (int index = 0; index < FLAGS_key.count(); index += 2) {
if (!strcmp("os", FLAGS_key[index])) {
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698