class
Tessell::Text::FontStack
- Tessell::Text::FontStack
- Reference
- Object
Defined in:
tessell/text/font_stack.crConstructors
- .new(faces : Array(Tessell::Text::FontStack::Face))
-
.open(entries : Array(NamedTuple(path: String, ttc_index: Int32, weight: Weight, label: String))) : FontStack
打开多张 face;font_id 按数组顺序分配(= atlas 的 font 维度)。
-
.open(entries : Array(NamedTuple(path: String, ttc_index: Int32, weight: Weight, label: String, family: String | Nil))) : FontStack
family 通道(issue #55):entry 带 family 时在该文件的 face 集合内 按 sfnt family 解析 ttc_index(nameID 16 优先);解析失败保留显式 ttc_index 并一次性 warning。显式 ttc_index 通道不变。
Instance Method Summary
- #close : Nil
- #face_count : Int32
- #faces : Array(Face)
-
#measure(text : String, size : Float32) : Size
选脸并测量:优先级第一的覆盖脸的度量(逻辑入口)。
-
#pick(text : String, weight : Weight) : Face | Nil
按字重选脸(issue #29):先找覆盖文本且字重匹配的 face;没有匹配 字重的覆盖脸时退回第一个覆盖脸(缺 bold 时不至于拿到错宽度的脸)。
-
#pick(text : String) : Face | Nil
覆盖整段文本的第一张脸(按优先级);无覆盖返回 nil。
Constructor Detail
def self.open(entries : Array(NamedTuple(path: String, ttc_index: Int32, weight: Weight, label: String))) : FontStack
#
打开多张 face;font_id 按数组顺序分配(= atlas 的 font 维度)。
def self.open(entries : Array(NamedTuple(path: String, ttc_index: Int32, weight: Weight, label: String, family: String | Nil))) : FontStack
#
family 通道(issue #55):entry 带 family 时在该文件的 face 集合内 按 sfnt family 解析 ttc_index(nameID 16 优先);解析失败保留显式 ttc_index 并一次性 warning。显式 ttc_index 通道不变。
Instance Method Detail
按字重选脸(issue #29):先找覆盖文本且字重匹配的 face;没有匹配 字重的覆盖脸时退回第一个覆盖脸(缺 bold 时不至于拿到错宽度的脸)。