abstract class Tessell::Text::Measurer

Overview

文本测量抽象。真实实现(M2 FreeType/HarfBuzz)不得引用本文件

Direct Known Subclasses

Defined in:

tessell/text/measurer.cr

Instance Method Summary

Instance Method Detail

def font_metrics(font_id : Int32, size : Float32) : FontMetrics #

字体度量(issue #6):默认按比例桩值;真实实现应读 FT size metrics。


[View source]
abstract def measure(text : String, font_id : Int32, size : Float32, max_width : Float32) : Size #

主接口:按文本内容、字体、字号、可用宽测量


[View source]
def measure(key : MeasureKey) : Size #

可选接口:按缓存键测量,内部使用;默认未实现


[View source]
def shape_run(text : String, font_id : Int32, size : Float32) : ShapeRun | Nil #

可选接口(issue #56 L2):宽度无关 shaping——advance 序列与行高。 返回 nil 表示不支持(CachingMeasurer 退回全量 measure 路径)。


[View source]