Chromium Code Reviews| Index: tools/sk_tool_utils.cpp |
| diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp |
| index 1b35005d963a19146d429a912b643f1073ade5e1..1eaa5d9bcead1a7b9e8fa5eb3663a0145dcade90 100644 |
| --- a/tools/sk_tool_utils.cpp |
| +++ b/tools/sk_tool_utils.cpp |
| @@ -6,14 +6,16 @@ |
| */ |
| #include "sk_tool_utils.h" |
| -#include "../src/fonts/SkTestScalerContext.h" |
| +#include "sk_tool_utils_flags.h" |
| #include "SkBitmap.h" |
| #include "SkCanvas.h" |
| +#include "SkTestScalerContext.h" |
| -namespace sk_tool_utils { |
| +DEFINE_bool(portableFonts, false, "Use portable fonts"); |
|
mtklein
2014/07/30 15:03:57
What's the end game? Ordinarily bots use --portab
caryclark
2014/07/30 15:45:32
Today, this makes it easier to bring up a new refe
|
| +DEFINE_bool(resourceFonts, false, "Use resource fonts"); |
| -bool gEnablePortableTypeface = false; |
| +namespace sk_tool_utils { |
| const char* colortype_name(SkColorType ct) { |
| switch (ct) { |
| @@ -30,12 +32,21 @@ const char* colortype_name(SkColorType ct) { |
| } |
| } |
| -SkPaint::FontMetrics create_font(SkTDArray<SkPath*>& , SkTDArray<SkFixed>& ); |
| - |
| -void set_portable_typeface(SkPaint* paint, SkTypeface::Style style) { |
| - if (gEnablePortableTypeface) { |
| - SkSafeUnref(paint->setTypeface(CreateTestTypeface(create_font, style))); |
| +SkTypeface* portable_typeface(const char* name, SkTypeface::Style style) { |
| + SkTypeface* face; |
| + if (FLAGS_portableFonts) { |
| + face = create_font(name, style); |
| + } else if (FLAGS_resourceFonts) { |
| + face = resource_font(name, style); |
| + } else { |
| + face = SkTypeface::CreateFromName(name, style); |
| } |
| + return face; |
| +} |
| + |
| +void set_portable_typeface(SkPaint* paint, const char* name, SkTypeface::Style style) { |
| + SkTypeface* face = portable_typeface(name, style); |
| + SkSafeUnref(paint->setTypeface(face)); |
| } |
| void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, |