skia2/site/dev/testing/fonts.md
Mike Klein ea3f014e2b sk_tool_utils -> ToolUtils, and git clang-format
sk_tool_utils doesn't really fit the naming convention
the rest of code under tools/ tends to use.

Change-Id: I45326a174101c6eb4b6149e9c742f658f2fd23b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202313
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 18:05:42 +00:00

35 lines
956 B
Markdown

Fonts and GM Tests
==================
Overview
--------
Each test in the gm directory draws a reference image. Their primary purpose is
to detect when images change unexpectedly, indicating that a rendering bug has
been introduced.
The gm tests have a secondary purpose: they detect when rendering is different
across platforms and configurations.
GM font selection
-----------------
Each gm specifies the typeface to use when drawing text. For now, to set the
portable typeface on the paint, call:
~~~~
ToolUtils::set_portable_typeface(SkPaint* , const char* name = nullptr,
SkFontStyle style = SkFontStyle());
~~~~
To create a portable typeface, use:
~~~~
SkTypeface* typeface = ToolUtils::create_portable_typeface(const char* name,
SkFontStyle style);
~~~~
Eventually, both `set_portable_typeface()` and `create_portable_typeface()` will be
removed. Instead, a test-wide `SkFontMgr` will be selected to choose portable
fonts or resource fonts.