class Tessell::Text::Rasterizer

Defined in:

tessell/text/rasterizer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(measurer : FtMeasurer, atlas : GlyphAtlas, font_id : Int32 = 0, run_cache_capacity : Int32 = 256, color_enabled : Bool = false) #

[View source]

Instance Method Detail

def atlas : GlyphAtlas #

[View source]
def begin_frame : Nil #

[View source]
def coverage(p : GlyphPlacement) : Int32 #

Alpha coverage of a placement: number of pixels with value > 0 in the atlas slot. Color placements read the RGBA page alpha byte (4B/px); gray placements read the R8 coverage byte (1B/px) as before.


[View source]
def end_frame : Nil #

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

[View source]
def hits : Int32 #

[View source]
def in_run_frame? : Bool #

[View source]
def misses : Int32 #

[View source]
def rasterize(text : String, size_px : Int32) : Array(GlyphPlacement) #

[View source]
def rasterize_into(text : String, size_px : Int32, sink : Array(GlyphPlacement)) : Nil #

Non-allocating w.r.t. Array object: reuses sink (clear + push). Caller should pre-size/capacity-reuse sink across calls for zero-allocation steady path. Preserves per-glyph atlas hit/miss/raster stats semantics (HB/FT path each call).


[View source]
def rasters : Int32 #

[View source]
def run_cache_size : Int32 #

[View source]
def shape_run_into(text : String, size_px : Int32, sink : Array(GlyphPlacement)) : Int32 #

Zero-allocation entry for shaped run reuse. On hit: copies cached placements into sink (no HB/FT shaping). Returns number of placements written.


[View source]
def stats : NamedTuple(hits: Int32, misses: Int32, rasters: Int32) #

[View source]