GlyphCache class

Caches pre-laid-out single-glyph paragraphs keyed by (codepoint, fg) so the painter never re-runs text layout on the hot path. LRU-capped.

Constructors

GlyphCache({required String fontFamily, required double fontSize, required double cellWidth, List<String> fontFamilyFallback = const [], String? boldFamily, String? italicFamily, String? boldItalicFamily, double lineHeight = 1.0, int maxEntries = 4096, int maxBuildsPerFrame = 128})

Properties

boldFamily String?
final
boldItalicFamily String?
final
cellWidth double
final
fontFamily String
final
fontFamilyFallback List<String>
final
fontSize double
final
hashCode int
The hash code for this object.
no setterinherited
italicFamily String?
final
length int
no setter
lineHeight double
Line-height multiplier matching the cell metrics. A forced strut of this height makes every glyph (ASCII, CJK, fallback fonts) share one baseline and fill the cell box, so text aligns with full-cell box-drawing glyphs instead of riding high in an over-tall cell.
final
maxBuildsPerFrame int
Caps synchronous paragraph layout per frame so first paint cannot freeze the UI.
final
maxEntries int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

beginFrame() → void
dispose() → void
Clears the cached paragraphs. Call before rebuilding the cache with new font metrics (e.g. on font-zoom).
familyForStyle({required bool bold, required bool italic}) String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
tryGet(int codepoint, int fg, {bool bold = false, bool italic = false, bool wide = false}) Paragraph?
Returns a cached paragraph, or builds one if under the per-frame budget. Returns null when the budget is exhausted (the painter schedules a warmup frame and the glyph fills in next frame).

Operators

operator ==(Object other) bool
The equality operator.
inherited