MCPcopy Index your code
hub / github.com/tdewolff/canvas / LoadFontFile

Function LoadFontFile

font.go:254–260  ·  view source on GitHub ↗

LoadFontFile loads a font from a file.

(filename string, style FontStyle)

Source from the content-addressed store, hash-verified

252
253// LoadFontFile loads a font from a file.
254func LoadFontFile(filename string, style FontStyle) (*Font, error) {
255 b, err := os.ReadFile(filename)
256 if err != nil {
257 return nil, fmt.Errorf("failed to load font file '%s': %w", filename, err)
258 }
259 return LoadFont(b, 0, style)
260}
261
262// LoadFontCollection loads a font from a collection file and uses the font at the specified index.
263func LoadFontCollection(filename string, index int, style FontStyle) (*Font, error) {

Callers 3

TestTextBoxFunction · 0.85
LoadSystemFontFunction · 0.85
LoadFontFileMethod · 0.85

Calls 1

LoadFontFunction · 0.85

Tested by 1

TestTextBoxFunction · 0.68