1 2--- 3title: "Fonts and GM Tests" 4linkTitle: "Fonts and GM Tests" 5 6--- 7 8 9Overview 10-------- 11 12Each test in the gm directory draws a reference image. Their primary purpose is 13to detect when images change unexpectedly, indicating that a rendering bug has 14been introduced. 15 16The gm tests have a secondary purpose: they detect when rendering is different 17across platforms and configurations. 18 19GM font selection 20----------------- 21 22Each gm specifies the typeface to use when drawing text. For now, to set the 23portable typeface on the paint, call: 24 25~~~~ 26ToolUtils::set_portable_typeface(SkPaint* , const char* name = nullptr, 27SkFontStyle style = SkFontStyle()); 28~~~~ 29 30To create a portable typeface, use: 31 32~~~~ 33SkTypeface* typeface = ToolUtils::create_portable_typeface(const char* name, 34SkFontStyle style); 35~~~~ 36 37Eventually, both `set_portable_typeface()` and `create_portable_typeface()` will be 38removed. Instead, a test-wide `SkFontMgr` will be selected to choose portable 39fonts or resource fonts. 40 41