diff options
author | caryclark <caryclark@google.com> | 2014-06-23 11:25:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-23 11:25:00 -0700 |
commit | 5fb6bd4b7e8d00b7f2543ca10ec9022b32632f29 (patch) | |
tree | 9212da1f0a1c6bee32c3debd4b8fd1ff61beca60 /gm | |
parent | c83780c9ec9fb7dc46abed71a64d83ec0ce7a274 (diff) |
use platform-independent font for gm
Create a custom typeface and scaler to render simple paths the
same on all platforms.
GM tests are modified to explicitly select the custom typeface.
R=reed@google.com, mtklein@google.com, bungeman@google.com
TBR=reed
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/348323003
Diffstat (limited to 'gm')
-rw-r--r-- | gm/arithmode.cpp | 1 | ||||
-rw-r--r-- | gm/bitmapcopy.cpp | 2 | ||||
-rw-r--r-- | gm/bitmapfilters.cpp | 1 | ||||
-rw-r--r-- | gm/bitmapscroll.cpp | 1 | ||||
-rw-r--r-- | gm/bitmapsource.cpp | 1 | ||||
-rw-r--r-- | gm/blurs.cpp | 1 | ||||
-rw-r--r-- | gm/complexclip.cpp | 1 | ||||
-rw-r--r-- | gm/convexpolyclip.cpp | 1 | ||||
-rw-r--r-- | gm/cubicpaths.cpp | 2 | ||||
-rw-r--r-- | gm/degeneratesegments.cpp | 2 | ||||
-rw-r--r-- | gm/displacement.cpp | 1 | ||||
-rw-r--r-- | gm/gm.h | 1 |
12 files changed, 15 insertions, 0 deletions
diff --git a/gm/arithmode.cpp b/gm/arithmode.cpp index d85e43d8e6..14f6aa0f57 100644 --- a/gm/arithmode.cpp +++ b/gm/arithmode.cpp @@ -57,6 +57,7 @@ static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar SkPaint paint; paint.setTextSize(SkIntToScalar(24)); paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); for (int i = 0; i < 4; ++i) { SkString str; str.appendScalar(k[i]); diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index eaad8d0114..74505d911d 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -77,6 +77,8 @@ protected: canvas->clear(0xFFDDDDDD); paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); + SkScalar width = SkIntToScalar(40); SkScalar height = SkIntToScalar(40); if (paint.getFontSpacing() > height) { diff --git a/gm/bitmapfilters.cpp b/gm/bitmapfilters.cpp index eaaa11a2c6..f1348b1437 100644 --- a/gm/bitmapfilters.cpp +++ b/gm/bitmapfilters.cpp @@ -55,6 +55,7 @@ static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { const int scale = 32; paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); const char* name = sk_tool_utils::colortype_name(bm.colorType()); canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8, paint); diff --git a/gm/bitmapscroll.cpp b/gm/bitmapscroll.cpp index 7e23d8bf05..0015cd8147 100644 --- a/gm/bitmapscroll.cpp +++ b/gm/bitmapscroll.cpp @@ -109,6 +109,7 @@ protected: void drawLabel(SkCanvas* canvas, const char *text, int startX, int startY, int endX, int endY) { SkPaint paint; + sk_tool_utils::set_portable_typeface(&paint); paint.setColor(0xFF000000); SkPath path; path.moveTo(SkIntToScalar(startX), SkIntToScalar(startY)); diff --git a/gm/bitmapsource.cpp b/gm/bitmapsource.cpp index 9cf5a75cae..f6badde89e 100644 --- a/gm/bitmapsource.cpp +++ b/gm/bitmapsource.cpp @@ -27,6 +27,7 @@ protected: canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); paint.setColor(0xFFFFFFFF); paint.setTextSize(SkIntToScalar(96)); const char* str = "e"; diff --git a/gm/blurs.cpp b/gm/blurs.cpp index 8a8949a14c..ad363e425d 100644 --- a/gm/blurs.cpp +++ b/gm/blurs.cpp @@ -45,6 +45,7 @@ protected: SkPaint paint; paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); paint.setTextSize(SkIntToScalar(25)); canvas->translate(SkIntToScalar(-40), SkIntToScalar(0)); diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp index 14e77b9077..61a19fd486 100644 --- a/gm/complexclip.cpp +++ b/gm/complexclip.cpp @@ -83,6 +83,7 @@ protected: SkPaint paint; paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); paint.setTextSize(SkIntToScalar(20)); static const struct { diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp index 6de72dc3b6..cb698c162b 100644 --- a/gm/convexpolyclip.cpp +++ b/gm/convexpolyclip.cpp @@ -54,6 +54,7 @@ static SkBitmap make_bmp(int w, int h) { } paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); paint.setTextSize(wScalar / 2.2f); paint.setShader(0); paint.setColor(SK_ColorLTGRAY); diff --git a/gm/cubicpaths.cpp b/gm/cubicpaths.cpp index 39417010c1..68d143df60 100644 --- a/gm/cubicpaths.cpp +++ b/gm/cubicpaths.cpp @@ -130,6 +130,7 @@ protected: SkPaint titlePaint; titlePaint.setColor(SK_ColorBLACK); titlePaint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&titlePaint); titlePaint.setLCDRenderText(true); titlePaint.setTextSize(15 * SK_Scalar1); const char title[] = "Cubic Drawn Into Rectangle Clips With " @@ -174,6 +175,7 @@ protected: SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&labelPaint); labelPaint.setLCDRenderText(true); labelPaint.setTextSize(10 * SK_Scalar1); canvas->drawText(gStyles[style].fName, diff --git a/gm/degeneratesegments.cpp b/gm/degeneratesegments.cpp index e8de51561d..17bf83bddc 100644 --- a/gm/degeneratesegments.cpp +++ b/gm/degeneratesegments.cpp @@ -291,6 +291,7 @@ protected: SkPaint titlePaint; titlePaint.setColor(SK_ColorBLACK); titlePaint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&titlePaint); titlePaint.setLCDRenderText(true); titlePaint.setTextSize(15 * SK_Scalar1); const char title[] = "Random Paths Drawn Into Rectangle Clips With " @@ -351,6 +352,7 @@ protected: SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&labelPaint); labelPaint.setLCDRenderText(true); labelPaint.setTextSize(10 * SK_Scalar1); canvas->drawText(style.fName, diff --git a/gm/displacement.cpp b/gm/displacement.cpp index eb4a0083c6..dddf8a53c4 100644 --- a/gm/displacement.cpp +++ b/gm/displacement.cpp @@ -37,6 +37,7 @@ protected: canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); + sk_tool_utils::set_portable_typeface(&paint); paint.setColor(0xFF884422); paint.setTextSize(SkIntToScalar(96)); const char* str = "g"; @@ -14,6 +14,7 @@ #include "SkSize.h" #include "SkString.h" #include "SkTRegistry.h" +#include "sk_tool_utils.h" #if SK_SUPPORT_GPU #include "GrContext.h" |