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

Unified Diff: tools/sk_tool_utils_font.cpp

Issue 1163283002: update portable fonts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rewrite aaxfermodes.cpp to reduce test area Created 5 years, 6 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.cpp ('k') | tools/test_font_index.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sk_tool_utils_font.cpp
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp
index 7cee944b5250d70d8d5e09bc8fd9097e396fff8b..5cb65b205c2d6dce1171cde8267721c234de1c0b 100644
--- a/tools/sk_tool_utils_font.cpp
+++ b/tools/sk_tool_utils_font.cpp
@@ -6,6 +6,7 @@
*/
#include "Resources.h"
+#include "SkFontMgr.h"
#include "SkOSFile.h"
#include "SkTestScalerContext.h"
#include "SkThread.h"
@@ -14,7 +15,10 @@
namespace sk_tool_utils {
-#include "test_font_data.cpp"
+#include "test_font_monospace.cpp"
+#include "test_font_sans_serif.cpp"
+#include "test_font_serif.cpp"
+#include "test_font_index.cpp"
static void release_portable_typefaces() {
// We'll clean this up in our own tests, but disable for clients.
@@ -43,8 +47,13 @@ SkTypeface* create_font(const char* name, SkTypeface::Style style) {
}
}
if (!fontData) {
+ // Once all legacy callers to portable fonts are converted, replace this with
+ // SK_CRASH();
SkDebugf("missing %s %d\n", name, style);
- return SkTypeface::CreateFromName(name, style);
+ // If we called SkTypeface::CreateFromName() here we'd recurse infinitely,
+ // so we reimplement its core logic here inline without the recursive aspect.
+ SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
+ return fm->legacyCreateTypeface(name, style);
}
} else {
sub = &gSubFonts[gDefaultFontIndex];
« no previous file with comments | « tools/sk_tool_utils.cpp ('k') | tools/test_font_index.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698