text/options.go
Functions
func WithCacheLimit
func WithCacheLimit(n int) SourceOption {
return func(c *sourceConfig) {
c.cacheLimit = n
}
}
func WithCollectionIndex
WithCollectionIndex selects a font within a TrueType/OpenType collection
(.ttc/.otc). Index 0 is the first font (default). Ignored for single fonts.
Example: msyh.ttc contains Microsoft YaHei (0) and Microsoft YaHei UI (1).
func WithCollectionIndex(index int) SourceOption {
return func(c *sourceConfig) {
c.collectionIndex = index
}
}
func WithDirection
WithDirection sets the text direction for the face.
func WithDirection(d Direction) FaceOption {
return func(c *faceConfig) {
c.direction = d
}
}
func WithHinting
WithHinting sets the hinting mode for the face.
func WithHinting(h Hinting) FaceOption {
return func(c *faceConfig) {
c.hinting = h
}
}
func WithLanguage
WithLanguage sets the language tag for the face (e.g., "en", "ja", "ar").
func WithLanguage(lang string) FaceOption {
return func(c *faceConfig) {
c.language = lang
}
}
func WithParser
WithParser specifies the font parser backend.
The default is "ximage" which uses golang.org/x/image/font/opentype.
Custom parsers can be registered with RegisterParser.
This allows using alternative font parsing libraries or
a pure Go implementation in the future.
func WithParser(name string) SourceOption {
return func(c *sourceConfig) {
c.parserName = name
}
}
WithCacheLimit sets the maximum number of cached glyphs.
A value of 0 disables the cache limit.