Documentation
¶
Index ¶
- type Font
- type Glyph
- type GlyphCache
- func (c *GlyphCache) Atlas(index int32) (*graphics.Texture, bool)
- func (c *GlyphCache) AtlasCount() int
- func (c *GlyphCache) Dispose() error
- func (c *GlyphCache) FlushUploads()
- func (c *GlyphCache) Glyph(r rune) Glyph
- func (c *GlyphCache) GlyphAt(r rune, phaseX, phaseY uint8) Glyph
- func (c *GlyphCache) GlyphGrayAt(r rune, phaseX, phaseY uint8, color font.LCDColor) Glyph
- func (c *GlyphCache) GlyphLCDAt(r rune, phaseX uint8) Glyph
- func (c *GlyphCache) GlyphLCDColorAt(r rune, phaseX uint8, color font.LCDColor) Glyph
- func (c *GlyphCache) GlyphMetrics(r rune) Glyph
- func (c *GlyphCache) GlyphWithReference(r rune) (Glyph, GlyphRef)
- func (c *GlyphCache) Kern(prev, curr rune) float32
- func (c *GlyphCache) Metrics() font.Metrics
- func (c *GlyphCache) OutlineGlyph(r rune, width float32) Glyph
- func (c *GlyphCache) OutlineWithReference(r rune, width float32) GlyphRef
- type GlyphRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Font ¶
func DefaultFont ¶
func DefaultFont() *Font
DefaultFont discovers and loads the system UI font once. The shared font lives for the process lifetime; callers must not close it. Nil means the system has no usable font, so the caller must supply one.
func (*Font) FontFace ¶
func (f *Font) FontFace(size, dpi float64) *font.ScaledFace
FontFace creates a new font face.
func (*Font) GlyphCache ¶
func (f *Font) GlyphCache(size, dpi float64) *GlyphCache
func (*Font) Italic ¶
Italic shares a cached font with synthetic oblique glyphs. Existing italic faces are returned unchanged. Repeated calls do not allocate.
func (*Font) MeasureString ¶
MeasureString measures the size of the string.
type Glyph ¶
type Glyph struct {
Atlas int32
X, Y int32
Width int32
Height int32
Rune rune
OffsetX float32
OffsetY float32
Advance float32
// contains filtered or unexported fields
}
func (Glyph) KeepAlive ¶
KeepAlive retains the atlas until pending canvas draws have been submitted. Copied glyphs already retain their pages for the lifetime of their layout.
type GlyphCache ¶
type GlyphCache struct {
// contains filtered or unexported fields
}
func NewGlyphCache ¶
func NewGlyphCache(f *Font, size, dpi float64) *GlyphCache
func (*GlyphCache) AtlasCount ¶
func (c *GlyphCache) AtlasCount() int
func (*GlyphCache) Dispose ¶
func (c *GlyphCache) Dispose() error
func (*GlyphCache) FlushUploads ¶
func (c *GlyphCache) FlushUploads()
func (*GlyphCache) Glyph ¶
func (c *GlyphCache) Glyph(r rune) Glyph
func (*GlyphCache) GlyphAt ¶
func (c *GlyphCache) GlyphAt(r rune, phaseX, phaseY uint8) Glyph
GlyphAt reuses a bounded set of device-pixel phases, avoiding a second bilinear blur when an axis-aligned glyph's origin is fractional.
func (*GlyphCache) GlyphGrayAt ¶
func (*GlyphCache) GlyphLCDAt ¶
func (c *GlyphCache) GlyphLCDAt(r rune, phaseX uint8) Glyph
func (*GlyphCache) GlyphLCDColorAt ¶
func (*GlyphCache) GlyphMetrics ¶
func (c *GlyphCache) GlyphMetrics(r rune) Glyph
GlyphMetrics preserves ink bounds and bitmap padding without populating atlases. Measurement results are not inserted into the rasterized glyph cache.
func (*GlyphCache) GlyphWithReference ¶
func (c *GlyphCache) GlyphWithReference(r rune) (Glyph, GlyphRef)
func (*GlyphCache) Kern ¶
func (c *GlyphCache) Kern(prev, curr rune) float32
func (*GlyphCache) Metrics ¶
func (c *GlyphCache) Metrics() font.Metrics
func (*GlyphCache) OutlineGlyph ¶
func (c *GlyphCache) OutlineGlyph(r rune, width float32) Glyph
func (*GlyphCache) OutlineWithReference ¶
func (c *GlyphCache) OutlineWithReference(r rune, width float32) GlyphRef