Documentation
¶
Overview ¶
Package fontimg provides a preview image of a font file (ttf, otf, woff, ...).
Index ¶
- func NewTemplate(text string) (*template.Template, error)
- type Font
- func (font *Font) BestName() string
- func (font *Font) Load(style canvas.FontStyle) (*canvas.FontFamily, error)
- func (font *Font) Rasterize(tpl *template.Template, fontSize int, style canvas.FontStyle, ...) (*image.RGBA, error)
- func (font *Font) String() string
- func (font *Font) WriteYAML(w io.Writer)
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Font ¶
type Font struct {
Buf []byte
Path string
Family string
Name string
Style string
SampleText string
Version string
// contains filtered or unexported fields
}
Font is a font image.
func NewFont ¶ added in v0.1.1
func NewFont(md fontpkg.FontMetadata) *Font
NewFont creates a new font image.
func Open ¶
Open opens fonts as either a path on disk or from the system fonts. When sysfonts is nil, the default system fonts will be loaded.
func (*Font) Rasterize ¶
func (font *Font) Rasterize( tpl *template.Template, fontSize int, style canvas.FontStyle, variant canvas.FontVariant, fg, bg color.Color, dpi, margin float64, ) (*image.RGBA, error)
Rasterize rasterizes the font image.
func (*Font) String ¶
String satisfies the fmt.Stringer interface.
Click to show internal directories.
Click to hide internal directories.