MCPcopy Create free account
hub / github.com/cogentcore/core / FontStyleCSS

Function FontStyleCSS

paint/font.go:88–103  ·  view source on GitHub ↗

FontStyleCSS looks for "tag" name properties in cssAgg properties, and applies those to style if found, and returns true -- false if no such tag found

(fs *styles.FontRender, tag string, cssAgg map[string]any, unit *units.Context, ctxt colors.Context)

Source from the content-addressed store, hash-verified

86// FontStyleCSS looks for "tag" name properties in cssAgg properties, and applies those to
87// style if found, and returns true -- false if no such tag found
88func FontStyleCSS(fs *styles.FontRender, tag string, cssAgg map[string]any, unit *units.Context, ctxt colors.Context) bool {
89 if cssAgg == nil {
90 return false
91 }
92 tp, ok := cssAgg[tag]
93 if !ok {
94 return false
95 }
96 pmap, ok := tp.(map[string]any) // must be a properties map
97 if ok {
98 fs.SetStyleProperties(nil, pmap, ctxt)
99 OpenFont(fs, unit)
100 return true
101 }
102 return false
103}

Callers 2

SetHTMLNoPreMethod · 0.85
SetHTMLPreMethod · 0.85

Calls 2

OpenFontFunction · 0.85
SetStylePropertiesMethod · 0.45

Tested by

no test coverage detected