| Index: gm/fontscaler.cpp
|
| diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp
|
| index c3b2c87af255965bd0d1b645de0a625981a04d8e..bba16e5b2fd996422801e9510473c7d940df15d0 100644
|
| --- a/gm/fontscaler.cpp
|
| +++ b/gm/fontscaler.cpp
|
| @@ -6,6 +6,7 @@
|
| */
|
| #include "gm.h"
|
| #include "SkTypeface.h"
|
| +#include <SkFontMgr.h>
|
|
|
| namespace skiagm {
|
|
|
| @@ -44,9 +45,12 @@ protected:
|
| //With freetype the default (normal hinting) can be really ugly.
|
| //Most distros now set slight (vertical hinting only) in any event.
|
| paint.setHinting(SkPaint::kSlight_Hinting);
|
| - sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::kNormal);
|
| + //sk_tool_utils::set_portable_typeface(&paint, "Times Roman", SkTypeface::kNormal);
|
| + SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromFile("/usr/local/google/home/bungeman/skia/font/Distortable.ttf"));
|
| + paint.setTypeface(typeface);
|
| + SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
|
|
|
| - const char* text = "Hamburgefons ooo mmm";
|
| + const char* text = "abc";
|
| const size_t textLen = strlen(text);
|
|
|
| for (int j = 0; j < 2; ++j) {
|
| @@ -55,6 +59,24 @@ protected:
|
| SkScalar x = SkIntToScalar(10);
|
| SkScalar y = SkIntToScalar(20);
|
|
|
| +/* Added the following to /system/etc/fonts.xml
|
| +
|
| + <family name="mm">
|
| + <font weight="100" style="normal" axis="32768">Distortable.ttf</font>
|
| + <font weight="200" style="normal" axis="40000">Distortable.ttf</font>
|
| + <font weight="300" style="normal" axis="50000">Distortable.ttf</font>
|
| + <font weight="400" style="normal" axis="65536">Distortable.ttf</font>
|
| + <font weight="500" style="normal" axis="80000">Distortable.ttf</font>
|
| + <font weight="600" style="normal" axis="90000">Distortable.ttf</font>
|
| + <font weight="700" style="normal" axis="100000">Distortable.ttf</font>
|
| + <font weight="800" style="normal" axis="110000">Distortable.ttf</font>
|
| + <font weight="900" style="normal" axis="131072">Distortable.ttf</font>
|
| + </family>
|
| +
|
| +and pushed resources/Distortable.ttf to /system/fonts */
|
| + //SkAutoTUnref<SkTypeface> typeface(fm->matchFamilyStyle("mm", SkFontStyle((100 * i) + (500 * j), SkFontStyle::kNormal_Width, SkFontStyle::kUpright_Slant)));
|
| + //paint.setTypeface(typeface);
|
| +
|
| SkAutoCanvasRestore acr(canvas, true);
|
| canvas->translate(SkIntToScalar(50 + i * 230),
|
| SkIntToScalar(20));
|
|
|