类型 FontFamilyAware

API 文档由 Go 源码生成,内容为英文。

type FontFamilyAware interface {
	TextEngine
	// SetFontFamily names the family the interface's proportional text is shaped
	// in, or "" for the platform's own interface font (Segoe UI on Windows, the
	// desktop's choice through Pango's sans alias on Linux, the system font on
	// macOS). A name the system has no family for is left to the platform to
	// stand in for, as it does for any text. What was shaped with another family
	// is forgotten, so the next measure shapes again.
	SetFontFamily(family string)
	// FontGeneration counts the changes after which the same line shapes
	// differently: it moves on every SetFontFamily that changed the family, and
	// when the system's own fonts changed under the engine. What the canvas or a
	// renderer remembers of shaped text (a cut line, a rasterized label) is stale
	// once it differs from the generation it was made at. Wrapping around is
	// harmless: only equality is ever asked.
	FontGeneration() uint32
}

FontFamilyAware is a TextEngine whose proportional family the application can name while it runs: the platform engines implement it. The reference engine's widths know no family, and a backend whose text the system draws without a say in the family (the browser) does not.