README

moonbit-community/harfbuzz/sfnt does not have a README file

#
SfntError

pub suberror SfntError {
UnexpectedEof
InvalidFormat
TableNotFound
} derive(Eq, Show, ToJson)

#
Axis

pub struct Axis {
base_tags : BaseTagList?
base_scripts : BaseScriptList?
} derive(Show, ToJson)

Axis table.

#
AxisValue

pub enum AxisValue {
Format1(Int, Int, Int, Int)
Format2(Int, Int, Int, Int, Int, Int)
Format3(Int, Int, Int, Int, Int)
Format4(Int, Int, Array[AxisValueRecord])
} derive(Show, ToJson)

Axis value table formats.

#
AxisValueRecord

pub struct AxisValueRecord {
axis_index : Int
value : Int
} derive(Eq, Show, ToJson)

Axis value record used by format 4.

#
BaseCoord

pub enum BaseCoord {
Format1(Int)
Format2(Int, Int, Int)
Format3(Int, Int)
} derive(Show, ToJson)

Base coordinate formats.

#
BaseLangSysRecord

pub struct BaseLangSysRecord {
tag :
Tag

min_max : MinMax?
} derive(Show, ToJson)

Base language system record.

#
BaseScript

pub struct BaseScript {
base_values : BaseValues?
default_min_max : MinMax?
lang_sys_records : Array[BaseLangSysRecord]
} derive(Show, ToJson)

Base script table.

#
BaseScriptList

pub struct BaseScriptList {
records : Array[BaseScriptRecord]
} derive(Show, ToJson)

Base script list.

#
BaseScriptRecord

pub struct BaseScriptRecord {
tag :
Tag

base_script : BaseScript?
} derive(Show, ToJson)

Base script record.

#
BaseTable

pub struct BaseTable {
major_version : Int
minor_version : Int
h_axis : Axis?
v_axis : Axis?
var_store_offset : Int?
} derive(Show, ToJson)

Parsed BASE table.

#
BaseTable::parse

fn BaseTable::parse(data : BytesView) -> Result[BaseTable, SfntError]

Parse BASE table bytes.

#
BaseTagList

pub struct BaseTagList {
tags : Array[
Tag
]
} derive(Show, ToJson)

Base tag list.

#
BaseValues

pub struct BaseValues {
default_index : Int
base_coords : Array[BaseCoord?]
} derive(Show, ToJson)

Base values table.

#
CmapTable

pub struct CmapTable {
data : BytesView
subtable_offset : Int
format : Int
variation_offset : Int?
} derive(Show, ToJson)

Parsed cmap table.

#
CmapTable::collect_nominal_mapping

Collect nominal glyph mappings from the cmap table.

#
CmapTable::glyph_for

fn CmapTable::glyph_for(self : CmapTable, codepoint : UInt) -> Result[UInt?, SfntError]

Map a codepoint to a glyph id.

#
CmapTable::parse

Parse a cmap table from its blob.

#
CmapTable::variation_mapping

fn CmapTable::variation_mapping(self : CmapTable, codepoint : UInt, selector : UInt) -> Result[(Bool, UInt?), SfntError]

Map a codepoint + variation selector to a glyph id, if supported.

#
CompositeComponent

pub struct CompositeComponent {
glyph : Int
flags : Int
arg1 : Int
arg2 : Int
a : Double
b : Double
c : Double
d : Double
tx : Double
ty : Double
is_anchored : Bool
use_my_metrics : Bool
scaled_offset : Bool
} derive(Show, ToJson)

#
CvtTable

pub struct CvtTable {
values : Array[Int]
} derive(Show, ToJson)

Control value table (cvt ) raw entries.

#
CvtTable::parse

fn CvtTable::parse(data : BytesView) -> Result[CvtTable, SfntError]

Parse cvt table bytes as signed 16-bit values.

#
CvtTable::values

fn CvtTable::values(self : CvtTable) -> ArrayView[Int]

#
FeatMinMaxRecord

pub struct FeatMinMaxRecord {
tag :
Tag

min_coord : BaseCoord?
max_coord : BaseCoord?
} derive(Show, ToJson)

Feature min/max record.

#
GaspRange

pub struct GaspRange {
max_ppem : Int
behavior : Int
} derive(Eq, Show, ToJson)

Gasp range entry.

#
GaspTable

pub struct GaspTable {
version : Int
ranges : Array[GaspRange]
} derive(Show, ToJson)

Parsed gasp table.

#
GaspTable::behavior_for_ppem

fn GaspTable::behavior_for_ppem(self : GaspTable, ppem : Int) -> Int?

Return gasp behavior flags for a given ppem (first range with max_ppem >= ppem).

#
GaspTable::parse

fn GaspTable::parse(data : BytesView) -> Result[GaspTable, SfntError]

Parse gasp table bytes (version 0/1).

#
GlyfTable

pub struct GlyfTable {
data : BytesView
} derive(Show, ToJson)

Parsed glyf table (raw view).

#
GlyfTable::glyph_bounds

fn GlyfTable::glyph_bounds(self : GlyfTable, offset : Int, length : Int) -> Result[GlyphBounds?, SfntError]

Read glyph bounds at a given offset/length.

#
GlyfTable::glyph_composite_components

fn GlyfTable::glyph_composite_components(self : GlyfTable, offset : Int, length : Int) -> Result[Array[CompositeComponent]?, SfntError]

Read composite glyph component records. Returns None for non-composite glyphs.

#
GlyfTable::glyph_simple_points

fn GlyfTable::glyph_simple_points(self : GlyfTable, offset : Int, length : Int) -> Result[Array[GlyphPoint]?, SfntError]

Read simple glyph outline points. Returns None for composite glyphs.

#
GlyfTable::parse

Parse glyf table from its blob.

#
GlyphBounds

pub struct GlyphBounds {
contours : Int
x_min : Int
y_min : Int
x_max : Int
y_max : Int
} derive(Eq, Show, ToJson)

Glyph bounding box from glyf header.

#
GlyphBounds::new

fn GlyphBounds::new(contours : Int, x_min : Int, y_min : Int, x_max : Int, y_max : Int) -> GlyphBounds

#
GlyphPoint

pub struct GlyphPoint {
x : Double
y : Double
flag : Int
is_end_point : Bool
} derive(Show, ToJson)

Outline point from glyf data.

#
GlyphPoint::new

fn GlyphPoint::new(x : Double, y : Double, flag : Int, is_end_point : Bool) -> GlyphPoint

#
GlyphPoint::set

fn GlyphPoint::set(self : GlyphPoint, x : Double, y : Double) -> Unit

#
GlyphPoint::transform

fn GlyphPoint::transform(self : GlyphPoint, a : Double, b : Double, c : Double, d : Double) -> Unit

#
GlyphPoint::translate

fn GlyphPoint::translate(self : GlyphPoint, dx : Double, dy : Double) -> Unit

#
HdmxRecord

pub struct HdmxRecord {
pixel_size : Int
max_width : Int
widths : Array[Int]
} derive(Show, ToJson)

HDMX device record.

#
HdmxTable

pub struct HdmxTable {
version : Int
records : Array[HdmxRecord]
} derive(Show, ToJson)

Parsed hdmx table.

#
HdmxTable::parse

fn HdmxTable::parse(data : BytesView) -> Result[HdmxTable, SfntError]

Parse hdmx table bytes.

#
HeadTable

pub struct HeadTable {
units_per_em : Int
index_to_loc_format : Int
} derive(Eq, Show, ToJson)

Parsed head table (subset).

#
HeadTable::parse

fn HeadTable::parse(data : BytesView) -> Result[HeadTable, SfntError]

Parse head table bytes.

#
HheaTable

pub struct HheaTable {
number_of_hmetrics : Int
} derive(Eq, Show, ToJson)

Parsed hhea table (subset).

#
HheaTable::parse

fn HheaTable::parse(data : BytesView) -> Result[HheaTable, SfntError]

Parse hhea table bytes.

#
HmtxTable

pub struct HmtxTable {
advances : Array[Int]
lsbs : Array[Int]
} derive(Show, ToJson)

Parsed hmtx table (subset).

#
HmtxTable::parse

fn HmtxTable::parse(data : BytesView, num_glyphs : Int, number_of_hmetrics : Int) -> Result[HmtxTable, SfntError]

Parse hmtx table bytes.

#
JstfLangSys

pub struct JstfLangSys {
priorities : Array[JstfPriority?]
} derive(Show, ToJson)

Justification language system table.

#
JstfLangSysRecord

pub struct JstfLangSysRecord {
tag :
Tag

lang_sys : JstfLangSys?
} derive(Show, ToJson)

Justification language system record.

#
JstfMax

pub struct JstfMax {
lookup_offsets : Array[Int]
} derive(Show, ToJson)

Justification max table (offsets to GPOS lookups).

#
JstfModList

pub struct JstfModList {
indices : Array[Int]
} derive(Show, ToJson)

Justification modification list.

#
JstfPriority

pub struct JstfPriority {
shrinkage_enable_gsub : JstfModList?
shrinkage_disable_gsub : JstfModList?
shrinkage_enable_gpos : JstfModList?
shrinkage_disable_gpos : JstfModList?
shrinkage_jstf_max : JstfMax?
extension_enable_gsub : JstfModList?
extension_disable_gsub : JstfModList?
extension_enable_gpos : JstfModList?
extension_disable_gpos : JstfModList?
extension_jstf_max : JstfMax?
} derive(Show, ToJson)

Justification priority table.

#
JstfScript

pub struct JstfScript {
extender_glyphs : Array[Int]
default_lang_sys : JstfLangSys?
lang_sys_records : Array[JstfLangSysRecord]
} derive(Show, ToJson)

Justification script table.

#
JstfScriptRecord

pub struct JstfScriptRecord {
tag :
Tag

script : JstfScript?
} derive(Show, ToJson)

Justification script record.

#
JstfTable

pub struct JstfTable {
major_version : Int
minor_version : Int
scripts : Array[JstfScriptRecord]
} derive(Show, ToJson)

Parsed JSTF table.

#
JstfTable::parse

fn JstfTable::parse(data : BytesView) -> Result[JstfTable, SfntError]

Parse JSTF table bytes.

#
KernClassTable

pub struct KernClassTable {
first_glyph : Int
classes : Array[Int]
class_count : Int
} derive(Show, ToJson)

Kern class table (format 2).

#
KernPair

pub struct KernPair {
left : UInt
right : UInt
value : Int
} derive(Eq, Show, ToJson)

Kern pair record (format 0).

#
KernSubtable

pub struct KernSubtable {
format : Int
horizontal : Bool
minimum : Bool
cross_stream : Bool
override_flag : Bool
pairs : Array[KernPair]
format2 : KernSubtableFormat2?
format3 : KernSubtableFormat3?
} derive(Show, ToJson)

Parsed kern subtable (format 0/2).

#
KernSubtableFormat2

pub struct KernSubtableFormat2 {
row_width : Int
left : KernClassTable
right : KernClassTable
right_class_count : Int
values : Array[Int]
} derive(Show, ToJson)

Kern subtable format 2 (class-based).

#
KernSubtableFormat3

pub struct KernSubtableFormat3 {
glyph_count : Int
kern_value_count : Int
left_class_count : Int
right_class_count : Int
values : Array[Int]
left_class : Array[Int]
right_class : Array[Int]
kern_index : Array[Int]
} derive(Show, ToJson)

Kern subtable format 3 (class-based, byte indices).

#
KernTable

pub struct KernTable {
subtables : Array[KernSubtable]
} derive(Show, ToJson)

Parsed kern table (subset).

#
KernTable::kern_value

fn KernTable::kern_value(self : KernTable, left : UInt, right : UInt) -> Int?

Lookup kern value for a glyph pair (horizontal format 0/2/3 only).

#
KernTable::parse

fn KernTable::parse(data : BytesView) -> Result[KernTable, SfntError]

Parse kern table bytes (version 0, format 0/2/3 subtables).

#
LocaTable

pub struct LocaTable {
offsets : Array[Int]
} derive(Eq, Show, ToJson)

Parsed loca table (glyph offsets).

#
LocaTable::parse

fn LocaTable::parse(data : BytesView, num_glyphs : Int, index_to_loc_format : Int) -> Result[LocaTable, SfntError]

Parse loca table bytes. index_to_loc_format: 0 (short, u16*2) or 1 (long, u32).

#
MathConstants

pub struct MathConstants {
percent_scale_down : Array[Int]
min_height : Array[Int]
math_values : Array[MathValueRecord]
radical_degree_bottom_raise_percent : Int
} derive(Show, ToJson)

Math constants table.

#
MathGlyphAssembly

pub struct MathGlyphAssembly {
italics_correction : MathValueRecord
parts : Array[MathGlyphPartRecord]
} derive(Show, ToJson)

Math glyph assembly table.

#
MathGlyphConstruction

pub struct MathGlyphConstruction {
glyph_assembly : MathGlyphAssembly?
variants : Array[MathGlyphVariantRecord]
} derive(Show, ToJson)

Math glyph construction table.

#
MathGlyphInfo

pub struct MathGlyphInfo {
italics_correction : MathItalicsCorrectionInfo?
top_accent_attachment : MathTopAccentAttachment?
extended_shape_coverage_offset : Int
math_kern_info : MathKernInfo?
} derive(Show, ToJson)

Math glyph info table.

#
MathGlyphPartRecord

pub struct MathGlyphPartRecord {
glyph : Int
start_connector_length : Int
end_connector_length : Int
full_advance : Int
flags : Int
} derive(Show, ToJson)

Math glyph part record.

#
MathGlyphVariantRecord

pub struct MathGlyphVariantRecord {
variant_glyph : Int
advance : Int
} derive(Show, ToJson)

Math glyph variant record.

#
MathItalicsCorrectionInfo

pub struct MathItalicsCorrectionInfo {
coverage_offset : Int
records : Array[MathValueRecord]
} derive(Show, ToJson)

Italics correction info.

#
MathKern

pub struct MathKern {
height_count : Int
records : Array[MathValueRecord]
} derive(Show, ToJson)

Math kern table.

#
MathKernInfo

pub struct MathKernInfo {
coverage_offset : Int
records : Array[MathKernInfoRecord]
} derive(Show, ToJson)

Math kern info table.

#
MathKernInfoRecord

pub struct MathKernInfoRecord {
math_kerns : Array[MathKern?]
} derive(Show, ToJson)

Math kern info record (four corners).

#
MathTable

pub struct MathTable {
major_version : Int
minor_version : Int
constants : MathConstants?
glyph_info : MathGlyphInfo?
variants : MathVariants?
} derive(Show, ToJson)

Parsed MATH table.

#
MathTable::parse

fn MathTable::parse(data : BytesView) -> Result[MathTable, SfntError]

Parse MATH table bytes.

#
MathTopAccentAttachment

pub struct MathTopAccentAttachment {
coverage_offset : Int
records : Array[MathValueRecord]
} derive(Show, ToJson)

Top accent attachment info.

#
MathValueRecord

pub struct MathValueRecord {
value : Int
device_offset : Int
} derive(Eq, Show, ToJson)

Math value record with optional device table offset.

#
MathVariants

pub struct MathVariants {
min_connector_overlap : Int
vert_coverage_offset : Int
horiz_coverage_offset : Int
vert_glyph_count : Int
horiz_glyph_count : Int
constructions : Array[MathGlyphConstruction?]
} derive(Show, ToJson)

Math variants table.

#
MaxpTable

pub struct MaxpTable {
num_glyphs : Int
} derive(Eq, Show, ToJson)

Parsed maxp table (subset).

#
MaxpTable::parse

fn MaxpTable::parse(data : BytesView) -> Result[MaxpTable, SfntError]

Parse maxp table bytes.

#
MetaRecord

pub struct MetaRecord {
tag :
Tag

data : Bytes
} derive(Show, ToJson)

Meta record entry.

#
MetaTable

pub struct MetaTable {
version : Int
flags : Int
records : Array[MetaRecord]
} derive(Show, ToJson)

Parsed meta table.

#
MetaTable::find

Find a meta record by tag.

#
MetaTable::parse

fn MetaTable::parse(data : BytesView) -> Result[MetaTable, SfntError]

Parse meta table bytes.

#
MinMax

pub struct MinMax {
min_coord : BaseCoord?
max_coord : BaseCoord?
records : Array[FeatMinMaxRecord]
} derive(Show, ToJson)

Min/max table.

#
NameRecord

pub struct NameRecord {
platform_id : Int
encoding_id : Int
language_id : Int
name_id : Int
value : Bytes
} derive(Show, ToJson)

Name record (string bytes in original encoding).

#
NameTable

pub struct NameTable {
records : Array[NameRecord]
} derive(Show, ToJson)

Parsed name table (subset).

#
NameTable::find_name

fn NameTable::find_name(self : NameTable, platform_id : Int, encoding_id : Int, language_id : Int, name_id : Int) -> NameRecord?

Return the first name record matching ids (simple helper).

#
NameTable::parse

fn NameTable::parse(data : BytesView) -> Result[NameTable, SfntError]

Parse name table bytes (format 0/1; string decoding is caller's responsibility).

#
Os2Table

pub struct Os2Table {
version : Int
weight_class : Int
width_class : Int
fs_type : Int
typo_ascender : Int
typo_descender : Int
typo_line_gap : Int
win_ascent : Int
win_descent : Int
code_page_range_1 : UInt?
code_page_range_2 : UInt?
x_height : Int?
cap_height : Int?
default_char : Int?
break_char : Int?
max_context : Int?
lower_optical_point_size : Int?
upper_optical_point_size : Int?
} derive(Show, ToJson)

Parsed OS/2 table (subset).

#
Os2Table::parse

fn Os2Table::parse(data : BytesView) -> Result[Os2Table, SfntError]

Parse OS/2 table bytes (version 0-5, subset of fields).

#
PostTable

pub struct PostTable {
version : Int
italic_angle : Int
underline_position : Int
underline_thickness : Int
is_fixed_pitch : Int
min_mem_type42 : Int
max_mem_type42 : Int
min_mem_type1 : Int
max_mem_type1 : Int
glyph_name_indices : Array[Int]?
custom_names : Array[Bytes]?
} derive(Show, ToJson)

Parsed post table (subset).

#
PostTable::glyph_from_name

fn PostTable::glyph_from_name(self : PostTable, name : String) -> Int?

#
PostTable::glyph_name

fn PostTable::glyph_name(self : PostTable, glyph : Int) -> String?

#
PostTable::parse

fn PostTable::parse(data : BytesView) -> Result[PostTable, SfntError]

Parse post table bytes (format 1.0/2.0/3.0 subset; names only for 2.0).

#
Sfnt

pub struct Sfnt {
blob :
Blob

records : Array[TableRecord]
} derive(Show, ToJson)

SFNT font directory.

#
Sfnt::parse

Parse a SFNT directory from a blob.

#
Sfnt::parse_at

fn Sfnt::parse_at(blob :
Blob
, base : Int) -> Result[Sfnt, SfntError]

Parse a SFNT directory from a blob at a byte offset.

#
Sfnt::table

Reference a table blob by tag.

#
Sfnt::tables

fn Sfnt::tables(self : Sfnt) -> ArrayView[TableRecord]

List all table records.

#
StatAxisRecord

pub struct StatAxisRecord {
tag :
Tag

name_id : Int
ordering : Int
} derive(Eq, Show, ToJson)

STAT design axis record.

#
StatTable

pub struct StatTable {
version : Int
design_axis_size : Int
design_axes : Array[StatAxisRecord]
axis_values : Array[AxisValue]
elided_fallback_name_id : Int
} derive(Show, ToJson)

Parsed STAT table.

#
StatTable::parse

fn StatTable::parse(data : BytesView) -> Result[StatTable, SfntError]

Parse STAT table bytes (formats 1-4).

#
TableRecord

pub struct TableRecord {
tag :
Tag

offset : Int
length : Int
} derive(Eq, Show, ToJson)

Table directory entry.

#
VheaTable

pub struct VheaTable {
number_of_vmetrics : Int
} derive(Eq, Show, ToJson)

Parsed vhea table (subset).

#
VheaTable::parse

fn VheaTable::parse(data : BytesView) -> Result[VheaTable, SfntError]

Parse vhea table bytes.

#
VmtxTable

pub struct VmtxTable {
advances : Array[Int]
tsbs : Array[Int]
} derive(Show, ToJson)

Parsed vmtx table (subset).

#
VmtxTable::parse

fn VmtxTable::parse(data : BytesView, num_glyphs : Int, number_of_vmetrics : Int) -> Result[VmtxTable, SfntError]

Parse vmtx table bytes.

#
VorgMetric

pub struct VorgMetric {
glyph : Int
origin_y : Int
} derive(Eq, Show, ToJson)

VORG metric entry.

#
VorgTable

pub struct VorgTable {
major_version : Int
minor_version : Int
default_origin_y : Int
metrics : Array[VorgMetric]
} derive(Show, ToJson)

Parsed VORG table.

#
VorgTable::origin_y_for

fn VorgTable::origin_y_for(self : VorgTable, glyph : Int) -> Int

Return origin Y for glyph, falling back to default.

#
VorgTable::origin_y_override

fn VorgTable::origin_y_override(self : VorgTable, glyph : Int) -> Int?

Return override origin for glyph if present.

#
VorgTable::parse

fn VorgTable::parse(data : BytesView) -> Result[VorgTable, SfntError]

Parse VORG table bytes.