Documentation ¶
Index ¶
- func SetDefaultFontData(regular, bold, italic, boldItalic []byte)
- type Face
- func (face *Face) DrawUnicodeBlockGlyph(char rune, imgSize common.Vector2[int]) *image.RGBA
- func (face *Face) DrawUnicodeBoxGlyph(char rune, imgSize common.Vector2[int]) *image.RGBA
- func (face *Face) ImageSize() common.Vector2[int]
- func (face *Face) RenderChar(char rune, underline, strikethrough bool, imgSize common.Vector2[int]) *image.RGBA
- func (face *Face) RenderGlyph(char rune, imgSize common.Vector2[int]) *image.RGBA
- func (face *Face) RenderUndercurl(imgSize common.Vector2[int]) *image.RGBA
- type FaceParams
- type Font
- type FontKit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultFontData ¶
func SetDefaultFontData(regular, bold, italic, boldItalic []byte)
This function must be called before any use of fontkit
Types ¶
type Face ¶
type Face struct {
// contains filtered or unexported fields
}
func (*Face) DrawUnicodeBlockGlyph ¶
func (*Face) DrawUnicodeBoxGlyph ¶
func (*Face) RenderChar ¶
func (face *Face) RenderChar(char rune, underline, strikethrough bool, imgSize common.Vector2[int]) *image.RGBA
Renders given char to an RGBA image and returns. Also renders underline and strikethrough if specified.
func (*Face) RenderGlyph ¶
Renders given rune and returns rendered RGBA image. Width of the image is always equal to cellWidth or cellWidth*2
type FaceParams ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
func CreateFontFromFile ¶
func CreateFontFromMem ¶
func (*Font) ContainsGlyph ¶
ContainsGlyph returns the whether font contains the given glyph.
func (*Font) CreateFace ¶
func (f *Font) CreateFace(params FaceParams) (*Face, error)
This funtion may return a face previously created and used because it caches every face in the font and it also caches every image size. Caching and reusing makes this library incredibly fast and memory friendly. But creating so many faces and drawing multiple size of images every time increases memory usage. And this memory never be freed until the font has freed. (This is not leak)
func (*Font) FamilyName ¶
type FontKit ¶
type FontKit struct {
// contains filtered or unexported fields
}
FontKit is a struct that holds different styles of same font family TODO: Maybe we should make this safe for concurrent usage, currently not
func (*FontKit) BoldItalic ¶
func (*FontKit) DefaultFont ¶
Returns first non nil font starting from regular