class Tessell::Text::GlyphAtlas

Defined in:

tessell/text/glyph_atlas.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(page_size : Int32 = 1024, capacity : Int32 = 4096) #

[View source]

Instance Method Detail

def begin_frame : Nil #

[View source]
def capacity : Int32 #

[View source]
def clear : Nil #

[View source]
def end_frame : Nil #

[View source]
def evict_lru(count : Int32 = 1) : Int32 #

[View source]
def evicted_total : Int32 #

[View source]
def in_frame? : Bool #

[View source]
def insert(key : GlyphKey, w : Int32, h : Int32, bearing_x : Int32 = 0, bearing_y : Int32 = 0, advance : Float32 = 0.0_f32) : GlyphSlot #

[View source]
def insert_rgba(key : GlyphKey, w : Int32, h : Int32, bearing_x : Int32 = 0, bearing_y : Int32 = 0, advance : Float32 = 0.0_f32) : GlyphSlot #

Color-glyph insert into an RGBA page. Same duplicate-key/idempotent and zero-size rules as insert; page indices address @rgba_pages only.


[View source]
def invalidate_font(font_id : Int32) : Int32 #

[View source]
def lookup(key : GlyphKey, color : Bool = false) : GlyphSlot | Nil #

[View source]
def page_count : Int32 #

[View source]
def page_data(page : Int32) : Bytes #

[View source]
def page_revision(page : Int32) : UInt64 #

[View source]
def page_size : Int32 #

[View source]
def revision : UInt64 #

Monotonic atlas-wide content version. Bumped whenever any page's pixels change (glyph inserted into an existing page included). This is the only reliable "did the atlas content change" signal for GPU sync.


[View source]
def rgba_page_count : Int32 #

[View source]
def rgba_page_data(page : Int32) : Bytes #

[View source]
def rgba_page_revision(page : Int32) : UInt64 #

[View source]
def slot_rect(slot : GlyphSlot) : NamedTuple(x: Int32, y: Int32, w: Int32, h: Int32) #

[View source]
def used_pixels : Int32 #

[View source]
def waste_ratio : Float64 #

[View source]