2015-03-02 19:25:25 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
~~~~
|
2019-03-20 16:12:10 +00:00
|
|
|
ToolUtils::set_portable_typeface(SkPaint* , const char* name = nullptr,
|
2017-07-27 14:45:29 +00:00
|
|
|
SkFontStyle style = SkFontStyle());
|
2015-03-02 19:25:25 +00:00
|
|
|
~~~~
|
|
|
|
|
|
|
|
To create a portable typeface, use:
|
|
|
|
|
|
|
|
~~~~
|
2019-03-20 16:12:10 +00:00
|
|
|
SkTypeface* typeface = ToolUtils::create_portable_typeface(const char* name,
|
2017-07-27 14:45:29 +00:00
|
|
|
SkFontStyle style);
|
2015-03-02 19:25:25 +00:00
|
|
|
~~~~
|
|
|
|
|
2018-01-10 14:55:05 +00:00
|
|
|
Eventually, both `set_portable_typeface()` and `create_portable_typeface()` will be
|
|
|
|
removed. Instead, a test-wide `SkFontMgr` will be selected to choose portable
|
2015-03-02 19:25:25 +00:00
|
|
|
fonts or resource fonts.
|