Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Private Member Functions | List of all members
FontMgrGM Class Reference
Inheritance diagram for FontMgrGM:
skiagm::GM

Private Member Functions

void onOnceBeforeDraw () override
 
SkString getName () const override
 
SkISize getISize () override
 
DrawResult onDraw (SkCanvas *canvas, SkString *errorMsg) override
 

Additional Inherited Members

- Public Types inherited from skiagm::GM
enum  Mode { kGM_Mode , kSample_Mode , kBench_Mode }
 
using DrawResult = skiagm::DrawResult
 
using GraphiteTestContext = skiatest::graphite::GraphiteTestContext
 
- Public Member Functions inherited from skiagm::GM
 GM (SkColor backgroundColor=SK_ColorWHITE)
 
virtual ~GM ()
 
void setMode (Mode mode)
 
Mode getMode () const
 
DrawResult gpuSetup (SkCanvas *, SkString *errorMsg, GraphiteTestContext *=nullptr)
 
void gpuTeardown ()
 
void onceBeforeDraw ()
 
DrawResult draw (SkCanvas *canvas)
 
DrawResult draw (SkCanvas *, SkString *errorMsg)
 
void drawBackground (SkCanvas *)
 
DrawResult drawContent (SkCanvas *canvas)
 
DrawResult drawContent (SkCanvas *, SkString *errorMsg)
 
virtual bool runAsBench () const
 
SkScalar width ()
 
SkScalar height ()
 
SkColor getBGColor () const
 
void setBGColor (SkColor)
 
void drawSizeBounds (SkCanvas *, SkColor)
 
bool animate (double)
 
virtual bool onChar (SkUnichar)
 
bool getControls (SkMetaData *controls)
 
void setControls (const SkMetaData &controls)
 
virtual void modifyGrContextOptions (GrContextOptions *)
 
virtual void modifyGraphiteContextOptions (skgpu::graphite::ContextOptions *) const
 
virtual bool isBazelOnly () const
 
virtual std::map< std::string, std::string > getGoldKeys () const
 
- Static Public Attributes inherited from skiagm::GM
static constexpr char kErrorMsg_DrawSkippedGpuOnly []
 
- Protected Member Functions inherited from skiagm::GM
virtual DrawResult onGpuSetup (SkCanvas *, SkString *, GraphiteTestContext *)
 
virtual void onGpuTeardown ()
 
virtual void onDraw (SkCanvas *)
 
virtual bool onAnimate (double)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
GraphiteTestContextgraphiteTestContext () const
 

Detailed Description

Definition at line 74 of file fontmgr.cpp.

Member Function Documentation

◆ getISize()

SkISize FontMgrGM::getISize ( )
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 84 of file fontmgr.cpp.

84{ return {1536, 768}; }

◆ getName()

SkString FontMgrGM::getName ( ) const
inlineoverrideprivatevirtual

Implements skiagm::GM.

Definition at line 82 of file fontmgr.cpp.

82{ return SkString("fontmgr_iter"); }

◆ onDraw()

DrawResult FontMgrGM::onDraw ( SkCanvas canvas,
SkString errorMsg 
)
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 86 of file fontmgr.cpp.

86 {
87 SkScalar y = 20;
90 font.setSubpixel(true);
91 font.setSize(17);
92
93 SkFontMgr* fm = fFM.get();
94 int count = std::min(fm->countFamilies(), MAX_FAMILIES);
95 if (count == 0) {
96 *errorMsg = "No families in SkFontMgr";
97 return DrawResult::kSkip;
98 }
99
100 for (int i = 0; i < count; ++i) {
101 SkString familyName;
102 fm->getFamilyName(i, &familyName);
103 font.setTypeface(ToolUtils::DefaultTypeface());
104 (void)drawString(canvas, familyName, 20, y, font);
105
106 SkScalar x = 220;
107
109 for (int j = 0; j < set->count(); ++j) {
110 SkString sname;
111 SkFontStyle fs;
112 set->getStyle(j, &fs, &sname);
113 sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.slant());
114
115 font.setTypeface(sk_sp<SkTypeface>(set->createTypeface(j)));
116 x = drawString(canvas, sname, x, y, font) + 20;
117
118 // check to see that we get different glyphs in japanese and chinese
119 x = drawCharacter(canvas, 0x5203, x, y, font, fm, familyName.c_str(), &zh, 1, fs);
120 x = drawCharacter(canvas, 0x5203, x, y, font, fm, familyName.c_str(), &ja, 1, fs);
121 // check that emoji characters are found
122 x = drawCharacter(canvas, 0x1f601, x, y, font, fm, familyName.c_str(), nullptr,0, fs);
123 }
124 y += 24;
125 }
126 return DrawResult::kOk;
127 }
int count
sk_sp< SkFontStyleSet > createStyleSet(int index) const
void getFamilyName(int index, SkString *familyName) const
Definition SkFontMgr.cpp:97
int countFamilies() const
Definition SkFontMgr.cpp:93
Slant slant() const
Definition SkFontStyle.h:64
int width() const
Definition SkFontStyle.h:63
int weight() const
Definition SkFontStyle.h:62
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
const char * c_str() const
Definition SkString.h:133
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
Definition SkString.cpp:550
T * get() const
Definition SkRefCnt.h:303
float SkScalar
Definition extension.cpp:12
static SkScalar drawString(SkCanvas *canvas, const SkString &text, SkScalar x, SkScalar y, const SkFont &font)
Definition fontmgr.cpp:39
static SkScalar drawCharacter(SkCanvas *canvas, uint32_t character, SkScalar x, SkScalar y, const SkFont &origFont, SkFontMgr *fm, const char *fontName, const char *bcp47[], int bcp47Count, const SkFontStyle &fontStyle)
Definition fontmgr.cpp:45
#define MAX_FAMILIES
Definition fontmgr.cpp:37
static const char * ja
Definition fontmgr.cpp:72
static const char * zh
Definition fontmgr.cpp:71
double y
double x
SkFont DefaultFont()
sk_sp< SkTypeface > DefaultTypeface()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition switches.h:76
font
Font Metadata and Metrics.

◆ onOnceBeforeDraw()

void FontMgrGM::onOnceBeforeDraw ( )
inlineoverrideprivatevirtual

Reimplemented from skiagm::GM.

Definition at line 77 of file fontmgr.cpp.

77 {
78 SkGraphics::SetFontCacheLimit(16 * 1024 * 1024);
80 }
static size_t SetFontCacheLimit(size_t bytes)
sk_sp< SkFontMgr > TestFontMgr()

The documentation for this class was generated from the following file: