Documentation
¶
Index ¶
- type Alignment
- type Flags
- type FontFace
- type Glyph
- type GlyphID
- type Parameters
- type Range
- type Shaper
- func (l *Shaper) Bitmaps(gs []Glyph) op.CallOp
- func (l *Shaper) Layout(params Parameters, txt io.Reader)
- func (l *Shaper) LayoutString(params Parameters, str string)
- func (l *Shaper) NextGlyph() (_ Glyph, ok bool)
- func (l *Shaper) ReleaseLayoutBuffers()
- func (l *Shaper) ResetLayoutCache()
- func (l *Shaper) Shape(gs []Glyph) clip.PathSpec
- type ShaperOption
- type WrapPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parameters ¶
type Shaper ¶
type Shaper struct {
// contains filtered or unexported fields
}
func NewShaper ¶
func NewShaper(options ...ShaperOption) *Shaper
func (*Shaper) LayoutString ¶
func (l *Shaper) LayoutString(params Parameters, str string)
func (*Shaper) ReleaseLayoutBuffers ¶ added in v1.1.0
func (l *Shaper) ReleaseLayoutBuffers()
ReleaseLayoutBuffers drops the per-shape document held inside the shaper after the last NextGlyph call. The next Layout/LayoutString call repopulates from scratch, so this is safe to invoke from the caller (e.g. the editor) once it has copied the glyphs it needs into its own index. For multi-MB texts this frees hundreds of MB that otherwise sit in Shaper.txt until the next shape.
func (*Shaper) ResetLayoutCache ¶ added in v1.1.0
func (l *Shaper) ResetLayoutCache()
ResetLayoutCache drops cached paragraph layouts. Useful when an editor is about to switch wrap modes or when a large text replaces the current one, so the document/glyph data captured for previous (text, width) keys can be reclaimed by the GC instead of waiting for LRU eviction.
type ShaperOption ¶
type ShaperOption func(*Shaper)
func NoSystemFonts ¶
func NoSystemFonts() ShaperOption
func WithCollection ¶
func WithCollection(collection []FontFace) ShaperOption
type WrapPolicy ¶
type WrapPolicy uint8
const ( WrapHeuristically WrapPolicy = iota WrapWords WrapGraphemes )