moon_swash

moon add Milky2018/moon_swash@0.1.10
Download zip
Author
Version
0.1.10
License
Apache-2.0
Last updated
2 months ago
Downloads
32K
README

#Milky2018/moon_swash

MoonBit port of the Rust swash reference implementation.

This repo provides:
  • Font metadata APIs (FontRef, attributes, localized strings, variation axes/instances, metrics, palettes, strikes).
  • Text shaping (Milky2018/moon_swash/shape).
  • Scaling and rendering (Milky2018/moon_swash/scale).

#Install

Add dependencies in your moon.pkg.json:

{ "import": [ { "path": "Milky2018/moon_swash", "alias": "swash" }, { "path": "Milky2018/moon_swash/shape", "alias": "swash_shape" }, { "path": "Milky2018/moon_swash/scale", "alias": "swash_scale" }, // Optional: API parity with upstream swash module paths { "path": "Milky2018/moon_swash/iter", "alias": "swash_iter" }, { "path": "Milky2018/moon_swash/proxy", "alias": "swash_proxy" } ] }

#Quickstart

Load a font:

let data : Bytes = ...
let font = @swash.FontRef::from_offset(data, 0).unwrap()

Shape a string:

let cx = @swash_shape.ShapeContext::new()
let shaper = cx.builder(font).size(14.0).build()
shaper.add_str("Hello, world!")
shaper.shape_with(fn(cluster) {
// cluster.glyphs() / cluster.source() ...
cluster |> ignore
})

Scale and render a glyph:

let gid = font.charmap().map(('Q').to_int().reinterpret_as_uint())
let scx = @swash_scale.ScaleContext::new()
let scaler = scx.builder(font).size(14.0).hint(true).build()

let render = @swash_scale.Render::new([@swash_scale.Source::Outline])
let img = render.render(scaler, gid).unwrap()

// Zero-copy pixel access:
let pixels = img.data_view()
pixels |> ignore

// GPU-friendly RGBA8 (premultiplied):
let white = [(255).to_byte(), (255).to_byte(), (255).to_byte(), (255).to_byte()]
img.to_rgba8(white) |> ignore
let rgba8 = img.data_view()
rgba8 |> ignore

#SubpixelMask Notes

  • Content::SubpixelMask stores per-channel coverage in RGB; the alpha channel is unused by the rasterizer.
  • Image::to_rgba8(base_color) converts Mask / SubpixelMask into premultiplied RGBA8 and sets alpha to max(r, g, b) coverage (modulated by base_color[3]).
  • Use premultiplied-alpha blending when compositing (src = 1, dst = 1 - srcA).

#API Compatibility Notes

  • Milky2018/moon_swash/iter and Milky2018/moon_swash/proxy exist for API parity with upstream swash module paths.
  • They currently provide stable type aliases (so downstream import paths match), while the underlying implementations live in the main packages.

#Verify It Works

Basic:

moon test moon check

Diff against an external reference dumper (requires wasmtime):

python3 tools/verify_reference.py \ --font /path/to/font.ttf \ --text "abc" \ --size 14 \ --ref-cmd /path/to/reference_dump_json

Matrix mode (repeatable --font, --text, --size):

python3 tools/verify_reference.py \ --font /path/to/font-a.ttf \ --font /path/to/font-b.ttf \ --text "abc" \ --text "Hello, world!" \ --size 12 \ --size 14 \ --ref-cmd /path/to/reference_dump_json

Case-file mode (.json / .jsonl entries like {"font":"...","text":"...","size":14}):

python3 tools/verify_reference.py \ --case-file /path/to/cases.jsonl \ --ref-cmd /path/to/reference_dump_json

Notes:
  • The verifier uses a numeric tolerance (default --tol 0.02) because outline floats may differ slightly between MoonBit and Rust.
  • For emoji/math-heavy fonts, use --tol 0.05 to avoid small outline-bound jitter.
  • For strict schema checks, add --strict-keys (default mode allows extra MoonBit-only keys).

#Development

  • moon check - lint/type-check
  • moon test - run tests
  • moon fmt - format
  • moon info - regenerate .mbti interface files

Standard workflow before committing:

moon info && moon fmt moon test moon check

#License

Apache-2.0.

#
Decompose

type Decompose = Iter[Char]

External iterator type. Iterator[X] is a mutable type: iterators internally maintain mutable state to advance iteration. All read operations on Iterator will advance the iterator, and would give different result when called multiple times.

#
FeatureSetting

type FeatureSetting = Setting[UInt16]

Feature setting (Setting<u16> in swash).

#
GlyphId

type GlyphId = UInt16

Glyph identifier.

#
NormalizedCoord

type NormalizedCoord = Int

Normalized variation coordinate in 2.14 fixed point format.

Port note: swash uses i16; we use Int in MoonBit and keep the value in the same 2.14 fixed-point bit representation.

#
Tag

type Tag = UInt

Ported from swash/src/tag.rs (swash is dual-licensed Apache-2.0 OR MIT).

#
UserData

type UserData = UInt

Arbitrary user data that can be associated with a character throughout the shaping pipeline.

#
VariationSetting

type VariationSetting = Setting[Double]

Variation setting (Setting<f32> in swash; we use Double).

#
Codepoint

pub(open) trait Codepoint {
properties(Self) -> Properties
opening_bracket(Self) -> Char?
closing_bracket(Self) -> Char?
mirror(Self) -> Char?
bracket_type(Self) -> BracketType
decompose(Self) -> Iter[Char]
decompose_compatible(Self) -> Iter[Char]
}

impl Codepoint for Char

#
TableProvider

pub(open) trait TableProvider {
table_by_tag(Self, tag : UInt) -> BytesView?
}

Source that can provide table data by tag.

#
Action

pub(all) enum Action {
Substitution
Attachment
Adjustment
}

Modification performed by a feature.

#
Analyze

pub struct Analyze {
chars : CharStream
state : BoundaryState
}

Iterator that yields Unicode properties and boundary analysis. This iterator is created by the [analyze] function.

#
Analyze::iter

fn Analyze::iter(self : Analyze) -> Iter[(Properties, Boundary)]

#
Analyze::needs_bidi_resolution

fn Analyze::needs_bidi_resolution(self : Analyze) -> Bool

#
Analyze::next

fn Analyze::next(self : Analyze) -> (Properties, Boundary)?

#
Analyze::set_break_strength

fn Analyze::set_break_strength(self : Analyze, strength : WordBreakStrength) -> Unit

Sets the word breaking strength that will be used to analyze the next character.

#
Attributes

pub struct Attributes {
value : UInt
}

Primary attributes for font classification: stretch, weight and style.

This struct is created by the attributes() method on FontRef.
impl Eq for Attributes
impl Show for Attributes

#
Attributes::from_font

fn Attributes::from_font(font : FontRef) -> Attributes

Extracts the attributes from the specified font.

#
Attributes::has_italic_variation

fn Attributes::has_italic_variation(self : Attributes) -> Bool

#
Attributes::has_oblique_variation

fn Attributes::has_oblique_variation(self : Attributes) -> Bool

#
Attributes::has_stretch_variation

fn Attributes::has_stretch_variation(self : Attributes) -> Bool

#
Attributes::has_variations

fn Attributes::has_variations(self : Attributes) -> Bool

#
Attributes::has_weight_variation

fn Attributes::has_weight_variation(self : Attributes) -> Bool

#
Attributes::new

fn Attributes::new(stretch : Stretch, weight : Weight, style : Style) -> Attributes

#
Attributes::parts

fn Attributes::parts(self : Attributes) -> (Stretch, Weight, Style)

#
Attributes::stretch

fn Attributes::stretch(self : Attributes) -> Stretch

#
Attributes::style

fn Attributes::style(self : Attributes) -> Style

#
Attributes::synthesize

fn Attributes::synthesize(self : Attributes, requested : Attributes) -> Synthesis

Returns a synthesis analysis based on the requested attributes with respect to this set of attributes.

#
Attributes::weight

fn Attributes::weight(self : Attributes) -> Weight

#
BidiClass

pub(all) enum BidiClass {
AL
AN
B
BN
CS
EN
ES
ET
FSI
L
LRE
LRI
LRO
NSM
ON
PDF
PDI
R
RLE
RLI
RLO
S
WS
}

#
BidiClass::needs_resolution

fn BidiClass::needs_resolution(self : BidiClass) -> Bool

#
BitmapStrike

pub struct BitmapStrike {
b :
BeBytes

bitmap_data : BytesView
offset : Int
upem : UInt
is_sbix : Bool
is_apple : Bool
}

Collection of bitmaps of a specific size and format.

#
BitmapStrike::bit_depth

fn BitmapStrike::bit_depth(self : BitmapStrike) -> Byte

Returns the bit depth of the strike.

#
BitmapStrike::contains

fn BitmapStrike::contains(self : BitmapStrike, glyph_id : UInt16) -> Bool

Returns true if the specified glyph is covered by the strike.

#
BitmapStrike::ppem

fn BitmapStrike::ppem(self : BitmapStrike) -> UInt16

Returns the size of the strike in pixels per em.

#
BitmapStrike::ppi

fn BitmapStrike::ppi(self : BitmapStrike) -> UInt16

Returns the device pixel density for which the strike was designed.

#
BitmapStrikes

pub struct BitmapStrikes {
b :
BeBytes

bitmap_data : BytesView
is_sbix : Bool
is_apple : Bool
upem : UInt
len : Int
}

Collection of bitmap strikes.

#
BitmapStrikes::find_by_exact_ppem

fn BitmapStrikes::find_by_exact_ppem(self : BitmapStrikes, ppem : UInt16, glyph_id : UInt16) -> BitmapStrike?

current state of the iterator.

#
BitmapStrikes::find_by_largest_ppem

fn BitmapStrikes::find_by_largest_ppem(self : BitmapStrikes, glyph_id : UInt16) -> BitmapStrike?

current state of the iterator.

#
BitmapStrikes::find_by_nearest_ppem

fn BitmapStrikes::find_by_nearest_ppem(self : BitmapStrikes, ppem : UInt16, glyph_id : UInt16) -> BitmapStrike?

current state of the iterator.

#
BitmapStrikes::iter

Returns an iterator over the strikes.

#
BitmapStrikes::len

fn BitmapStrikes::len(self : BitmapStrikes) -> Int

Returns the number of strikes in the collection.

#
BitmapStrikesProxy

pub struct BitmapStrikesProxy {
bitmaps : (UInt, UInt)
color_bitmaps : (UInt, UInt)
upem : UInt
is_apple : Bool
}

Proxy for rematerializing strike collections.

#
BitmapStrikesProxy::from_font

#
BitmapStrikesProxy::has_alpha

fn BitmapStrikesProxy::has_alpha(self : BitmapStrikesProxy) -> Bool

Returns true if the font has alpha bitmap strikes.

#
BitmapStrikesProxy::has_color

fn BitmapStrikesProxy::has_color(self : BitmapStrikesProxy) -> Bool

Returns true if the font has color bitmap strikes.

#
BitmapStrikesProxy::materialize_alpha

fn BitmapStrikesProxy::materialize_alpha(self : BitmapStrikesProxy, font : FontRef) -> BitmapStrikes

must have been created from the same font.

#
BitmapStrikesProxy::materialize_color

fn BitmapStrikesProxy::materialize_color(self : BitmapStrikesProxy, font : FontRef) -> BitmapStrikes

must have been created from the same font.

#
Block

pub(all) enum Block {
Adlam
AegeanNumbers
Ahom
AlchemicalSymbols
AlphabeticPresentationForms
AnatolianHieroglyphs
AncientGreekMusicalNotation
AncientGreekNumbers
AncientSymbols
Arabic
ArabicExtendedA
ArabicMathematicalAlphabeticSymbols
ArabicPresentationFormsA
ArabicPresentationFormsB
ArabicSupplement
Armenian
Arrows
BasicLatin
Avestan
Balinese
Bamum
BamumSupplement
BassaVah
Batak
Bengali
Bhaiksuki
BlockElements
Bopomofo
BopomofoExtended
BoxDrawing
Brahmi
BraillePatterns
Buginese
Buhid
ByzantineMusicalSymbols
Carian
CaucasianAlbanian
Chakma
Cham
Cherokee
CherokeeSupplement
ChessSymbols
Chorasmian
CJKUnifiedIdeographs
CJKCompatibility
CJKCompatibilityForms
CJKCompatibilityIdeographs
CJKCompatibilityIdeographsSupplement
CJKUnifiedIdeographsExtensionA
CJKUnifiedIdeographsExtensionB
CJKUnifiedIdeographsExtensionC
CJKUnifiedIdeographsExtensionD
CJKUnifiedIdeographsExtensionE
CJKUnifiedIdeographsExtensionF
CJKUnifiedIdeographsExtensionG
CJKRadicalsSupplement
CJKStrokes
HangulCompatibilityJamo
ControlPictures
Coptic
CopticEpactNumbers
CountingRodNumerals
Cuneiform
CurrencySymbols
CypriotSyllabary
Cyrillic
CyrillicExtendedA
CyrillicExtendedB
CyrillicExtendedC
CyrillicSupplement
Deseret
Devanagari
DevanagariExtended
CombiningDiacriticalMarks
CombiningDiacriticalMarksExtended
CombiningDiacriticalMarksSupplement
Dingbats
DivesAkuru
Dogra
DominoTiles
Duployan
EarlyDynasticCuneiform
EgyptianHieroglyphFormatControls
EgyptianHieroglyphs
Elbasan
Elymaic
Emoticons
EnclosedAlphanumerics
EnclosedAlphanumericSupplement
EnclosedIdeographicSupplement
Ethiopic
EthiopicExtended
EthiopicExtendedA
EthiopicSupplement
GeometricShapes
GeometricShapesExtended
Georgian
GeorgianExtended
GeorgianSupplement
Glagolitic
GlagoliticSupplement
Gothic
Grantha
GreekExtended
Gujarati
GunjalaGondi
Gurmukhi
CombiningHalfMarks
HangulSyllables
HanifiRohingya
Hanunoo
Hatran
Hebrew
HighPrivateUseSurrogates
HighSurrogates
Hiragana
IdeographicDescriptionCharacters
ImperialAramaic
CommonIndicNumberForms
IndicSiyaqNumbers
InscriptionalPahlavi
InscriptionalParthian
IPAExtensions
HangulJamo
HangulJamoExtendedA
HangulJamoExtendedB
Javanese
Kaithi
KanaExtendedA
KanaSupplement
Kanbun
KangxiRadicals
Kannada
Katakana
KatakanaPhoneticExtensions
KayahLi
Kharoshthi
KhitanSmallScript
Khmer
KhmerSymbols
Khojki
Khudawadi
Lao
Latin1Supplement
LatinExtendedA
LatinExtendedAdditional
LatinExtendedB
LatinExtendedC
LatinExtendedD
LatinExtendedE
Lepcha
LetterlikeSymbols
Limbu
LinearA
LinearBIdeograms
LinearBSyllabary
Lisu
LisuSupplement
LowSurrogates
Lycian
Lydian
Mahajani
MahjongTiles
Makasar
Malayalam
Mandaic
Manichaean
Marchen
MasaramGondi
MathematicalAlphanumericSymbols
MathematicalOperators
MayanNumerals
Medefaidrin
MeeteiMayek
MeeteiMayekExtensions
MendeKikakui
MeroiticCursive
MeroiticHieroglyphs
Miao
MiscellaneousMathematicalSymbolsA
MiscellaneousMathematicalSymbolsB
MiscellaneousSymbols
MiscellaneousTechnical
Modi
SpacingModifierLetters
ModifierToneLetters
Mongolian
MongolianSupplement
Mro
Multani
MusicalSymbols
Myanmar
MyanmarExtendedA
MyanmarExtendedB
Nabataean
Nandinagari
NoBlock
NewTaiLue
Newa
NKo
NumberForms
Nushu
NyiakengPuachueHmong
OpticalCharacterRecognition
Ogham
OlChiki
OldHungarian
OldItalic
OldNorthArabian
OldPermic
OldPersian
OldSogdian
OldSouthArabian
OldTurkic
Oriya
OrnamentalDingbats
Osage
Osmanya
OttomanSiyaqNumbers
PahawhHmong
Palmyrene
PauCinHau
PhaistosDisc
Phoenician
PhoneticExtensions
PhoneticExtensionsSupplement
PlayingCards
PsalterPahlavi
PrivateUseArea
GeneralPunctuation
Rejang
RumiNumeralSymbols
Runic
Samaritan
Saurashtra
Sharada
Shavian
ShorthandFormatControls
Siddham
Sinhala
SinhalaArchaicNumbers
SmallFormVariants
SmallKanaExtension
Sogdian
SoraSompeng
Soyombo
Specials
Sundanese
SundaneseSupplement
SupplementalArrowsA
SupplementalArrowsB
SupplementalArrowsC
SupplementalMathematicalOperators
SupplementaryPrivateUseAreaA
SupplementaryPrivateUseAreaB
SupplementalPunctuation
SuttonSignWriting
SylotiNagri
Syriac
SyriacSupplement
Tagalog
Tagbanwa
Tags
TaiLe
TaiTham
TaiViet
TaiXuanJingSymbols
Takri
Tamil
TamilSupplement
Tangut
TangutComponents
TangutSupplement
Telugu
Thaana
Thai
Tibetan
Tifinagh
Tirhuta
UnifiedCanadianAboriginalSyllabics
UnifiedCanadianAboriginalSyllabicsExtended
Ugaritic
Vai
VedicExtensions
VerticalForms
VariationSelectors
VariationSelectorsSupplement
Wancho
WarangCiti
Yezidi
YiRadicals
YiSyllables
YijingHexagramSymbols
ZanabazarSquare
GreekandCoptic
SuperscriptsandSubscripts
CombiningDiacriticalMarksforSymbols
MiscellaneousSymbolsandArrows
CJKSymbolsandPunctuation
EnclosedCJKLettersandMonths
Phagspa
HalfwidthandFullwidthForms
CuneiformNumbersandPunctuation
IdeographicSymbolsandPunctuation
MiscellaneousSymbolsandPictographs
TransportandMapSymbols
SupplementalSymbolsandPictographs
SymbolsandPictographsExtendedA
SymbolsforLegacyComputing
}

#
Boundary

pub(all) enum Boundary {
None
Word
Line
Mandatory
}

Boundary type of a character or cluster.

#
BoundaryState

type BoundaryState

#
BracketType

pub(all) enum BracketType {
None
Open(Char)
Close(Char)
}

#
CacheKey

pub struct CacheKey {
value : UInt64
}

Uniquely generated value for identifying and caching fonts.

#
CacheKey::new

fn CacheKey::new() -> CacheKey

#
CacheKey::value

fn CacheKey::value(self : CacheKey) -> UInt64

#
Category

pub(all) enum Category {
Other
Control
Format
Unassigned
PrivateUse
Surrogate
Letter
CasedLetter
LowercaseLetter
ModifierLetter
OtherLetter
TitlecaseLetter
UppercaseLetter
Mark
SpacingMark
EnclosingMark
NonspacingMark
Number
DecimalNumber
LetterNumber
OtherNumber
Punctuation
ConnectorPunctuation
DashPunctuation
ClosePunctuation
FinalPunctuation
InitialPunctuation
OtherPunctuation
OpenPunctuation
Symbol
CurrencySymbol
ModifierSymbol
MathSymbol
OtherSymbol
Separator
LineSeparator
ParagraphSeparator
SpaceSeparator
}

#
CharCluster

type CharCluster

Character cluster; output from the parser and input to the shaper.

#
CharCluster::chars

#
CharCluster::clear

fn CharCluster::clear(self : CharCluster) -> Unit

#
CharCluster::info

fn CharCluster::info(self : CharCluster) -> ClusterInfo

#
CharCluster::is_empty

fn CharCluster::is_empty(self : CharCluster) -> Bool

#
CharCluster::map

fn CharCluster::map(self : CharCluster, f : (Char) -> UInt16) -> Status

#
CharCluster::mapped_chars

fn CharCluster::mapped_chars(self : CharCluster) -> ArrayView[ClusterChar]

#
CharCluster::new

#
CharCluster::range

fn CharCluster::range(self : CharCluster) -> SourceRange

#
CharCluster::user_data

fn CharCluster::user_data(self : CharCluster) -> UInt

#
CharInfo

type CharInfo

Information about a character including unicode properties and boundary analysis.

#
CharInfo::boundary

fn CharInfo::boundary(self : CharInfo) -> Boundary

#
CharInfo::category

fn CharInfo::category(self : CharInfo) -> Category

#
CharInfo::cluster_break

fn CharInfo::cluster_break(self : CharInfo) -> ClusterBreak

#
CharInfo::cluster_class

fn CharInfo::cluster_class(self : CharInfo) -> (ClusterBreak, Bool)

#
CharInfo::contributes_to_shaping

fn CharInfo::contributes_to_shaping(self : CharInfo) -> Bool

#
CharInfo::default

fn CharInfo::default() -> CharInfo

#
CharInfo::from_char

fn CharInfo::from_char(ch : Char) -> CharInfo

#
CharInfo::is_ignorable

fn CharInfo::is_ignorable(self : CharInfo) -> Bool

#
CharInfo::is_variation_selector

fn CharInfo::is_variation_selector(self : CharInfo) -> Bool

#
CharInfo::joining_type

fn CharInfo::joining_type(self : CharInfo) -> JoiningType

#
CharInfo::myanmar_class

fn CharInfo::myanmar_class(self : CharInfo) -> (MyanmarClass, Bool)

#
CharInfo::new

fn CharInfo::new(properties : Properties, boundary : Boundary) -> CharInfo

#
CharInfo::properties

fn CharInfo::properties(self : CharInfo) -> Properties

#
CharInfo::use_class

fn CharInfo::use_class(self : CharInfo) -> (UseClass, Bool, Bool)

#
CharStream

type CharStream

#
Charmap

pub struct Charmap {
data : Bytes
proxy : CharmapProxy
}

Maps characters to nominal glyph identifiers.

#
Charmap::enumerate

fn Charmap::enumerate(self : Charmap, f : (UInt, UInt16) -> Unit) -> Unit

#
Charmap::from_font

fn Charmap::from_font(font : FontRef) -> Charmap

#
Charmap::map

fn Charmap::map(self : Charmap, codepoint : UInt) -> UInt16

#
Charmap::proxy

fn Charmap::proxy(self : Charmap) -> CharmapProxy

#
CharmapProxy

pub struct CharmapProxy {
offset : UInt
format : UInt
symbol : Bool
}

Proxy for rematerializing a character map.

#
CharmapProxy::from_font

fn CharmapProxy::from_font(font : FontRef) -> CharmapProxy

#
CharmapProxy::materialize

fn CharmapProxy::materialize(self : CharmapProxy, font : FontRef) -> Charmap

Materializes a character map from the specified font. This proxy must have been created from the same font.

#
Cjk

pub(all) enum Cjk {
None
Traditional
Simplified
Japanese
Korean
}

Chinese, Japanese and Korean languages.

#
ClusterBreak

pub(all) enum ClusterBreak {
CN
CR
EX
L
LF
LV
LVT
PP
RI
SM
T
V
XX
ZWJ
}

#
ClusterChar

type ClusterChar

Character output from the cluster parser.

#
ClusterChar::ch

fn ClusterChar::ch(self : ClusterChar) -> Char

#
ClusterChar::contributes_to_shaping

fn ClusterChar::contributes_to_shaping(self : ClusterChar) -> Bool

#
ClusterChar::data

fn ClusterChar::data(self : ClusterChar) -> UInt

#
ClusterChar::glyph_id

fn ClusterChar::glyph_id(self : ClusterChar) -> UInt16

#
ClusterChar::is_ignorable

fn ClusterChar::is_ignorable(self : ClusterChar) -> Bool

#
ClusterChar::joining_type

fn ClusterChar::joining_type(self : ClusterChar) -> JoiningType

#
ClusterChar::new

fn ClusterChar::new(ch : Char, offset : UInt, shape_class : ShapeClass, joining_type : JoiningType, ignorable : Bool, contributes_to_shaping : Bool, glyph_id : UInt16, data : UInt) -> ClusterChar

#
ClusterChar::offset

fn ClusterChar::offset(self : ClusterChar) -> UInt

#
ClusterChar::shape_class

fn ClusterChar::shape_class(self : ClusterChar) -> ShapeClass

#
ClusterInfo

type ClusterInfo

Information about a cluster including content properties and boundary analysis.

#
ClusterInfo::boundary

fn ClusterInfo::boundary(self : ClusterInfo) -> Boundary

#
ClusterInfo::emoji

fn ClusterInfo::emoji(self : ClusterInfo) -> Emoji

#
ClusterInfo::is_boundary

fn ClusterInfo::is_boundary(self : ClusterInfo) -> Bool

#
ClusterInfo::is_broken

fn ClusterInfo::is_broken(self : ClusterInfo) -> Bool

#
ClusterInfo::is_emoji

fn ClusterInfo::is_emoji(self : ClusterInfo) -> Bool

#
ClusterInfo::is_whitespace

fn ClusterInfo::is_whitespace(self : ClusterInfo) -> Bool

#
ClusterInfo::whitespace

fn ClusterInfo::whitespace(self : ClusterInfo) -> Whitespace

#
ColorPalette

pub struct ColorPalette {
font : FontRef
b :
BeBytes

version : UInt16
index : UInt16
num_entries : UInt16
offset : Int
}

Collection of colors.

#
ColorPalette::get

fn ColorPalette::get(self : ColorPalette, index : UInt16) -> (Byte, Byte, Byte, Byte)

Returns the color for the specified entry in RGBA order.

#
ColorPalette::index

fn ColorPalette::index(self : ColorPalette) -> UInt16

#
ColorPalette::is_empty

fn ColorPalette::is_empty(self : ColorPalette) -> Bool

#
ColorPalette::len

fn ColorPalette::len(self : ColorPalette) -> UInt16

#
ColorPalette::name

fn ColorPalette::name(self : ColorPalette, language : String?) -> LocalizedString?

#
ColorPalette::name_id

fn ColorPalette::name_id(self : ColorPalette) -> StringId?

#
ColorPalette::usability

fn ColorPalette::usability(self : ColorPalette) -> Usability?

#
ColorPalettes

pub struct ColorPalettes {
font : FontRef
b :
BeBytes

len : Int
}

Iterator over a collection of color palettes.

#
ColorPalettes::from_font

fn ColorPalettes::from_font(font : FontRef) -> ColorPalettes

#
ColorPalettes::iter

#
ColorPalettes::len

fn ColorPalettes::len(self : ColorPalettes) -> Int

#
CombiningClass

pub(all) enum CombiningClass {
NotReordered
Overlay
HanReading
Nukta
KanaVoicing
Virama
Ccc10
Ccc11
Ccc12
Ccc13
Ccc14
Ccc15
Ccc16
Ccc17
Ccc18
Ccc19
Ccc20
Ccc21
Ccc22
Ccc23
Ccc24
Ccc25
Ccc26
Ccc27
Ccc28
Ccc29
Ccc30
Ccc31
Ccc32
Ccc33
Ccc34
Ccc35
Ccc36
Ccc84
Ccc91
Ccc103
Ccc107
Ccc118
Ccc122
Ccc129
Ccc130
Ccc132
Ccc133
AttachedBelowLeft
AttachedBelow
AttachedAbove
AttachedAboveRight
BelowLeft
Below
BelowRight
Left
Right
AboveLeft
Above
AboveRight
DoubleBelow
DoubleAbove
IotaSubscript
}

#
Emoji

pub(all) enum Emoji {
None
Default
Text
Color
}

Presentation mode for an emoji cluster.

#
Encoding

pub(all) enum Encoding {
Unicode
MacRoman
Other(UInt16, UInt16)
}

Encoding of a localized string.

Fonts can contain a variety of platform specific and legacy encodings. Only the ones we decode are listed here.

#
Encoding::is_decodable

fn Encoding::is_decodable(self : Encoding) -> Bool

#
Entry

type Entry[T]

#
Feature

type Feature

Typographic rule that produces modifications to a sequence of glyphs.

#
Feature::action

fn Feature::action(self : Feature) -> Action

Returns the action of the feature.

#
Feature::name

fn Feature::name(self : Feature) -> String?

Returns the name of the feature, if available.

#
Feature::tag

fn Feature::tag(self : Feature) -> UInt

Returns the feature tag.

#
Features

type Features

Iterator over a collection of typographic features.

#
Features::from_font

fn Features::from_font(font : FontRef) -> Features

#
Features::iter

fn Features::iter(self : Features) -> Iter[Feature]

#
FontCache

pub struct FontCache[T] {
entries : Array[Entry[T]]
max_entries : Int
epoch : UInt64
}

Simple LRU cache keyed by a custom font identifier.

Ported from swash/src/cache.rs (FontCache<T>).

#
FontCache::get

fn[T] FontCache::get(self : FontCache[T], font : FontRef, id_override : (UInt64, UInt64)?, f : (FontRef) -> T) -> ((UInt64, UInt64), Ref[T])

#
FontCache::new

fn[T] FontCache::new(max_entries : Int) -> FontCache[T]

#
FontDataRef

pub struct FontDataRef {
data : Bytes
len : Int
}

Reference to the content of a font file.

#
FontDataRef::data

fn FontDataRef::data(self : FontDataRef) -> Bytes

#
FontDataRef::fonts

fn FontDataRef::fonts(self : FontDataRef) -> Iter[FontRef]

#
FontDataRef::get

fn FontDataRef::get(self : FontDataRef, index : Int) -> FontRef?

#
FontDataRef::is_collection

fn FontDataRef::is_collection(self : FontDataRef) -> Bool

#
FontDataRef::is_empty

fn FontDataRef::is_empty(self : FontDataRef) -> Bool

#
FontDataRef::len

fn FontDataRef::len(self : FontDataRef) -> Int

#
FontDataRef::new

fn FontDataRef::new(data : Bytes) -> FontDataRef?

#
FontRef

pub struct FontRef {
data : Bytes
offset : Int
key : CacheKey
}

Reference to a font.
impl RawFont for FontRef

#
FontRef::alpha_strikes

fn FontRef::alpha_strikes(self : FontRef) -> BitmapStrikes

Returns an iterator over the alpha bitmap strikes for the font.

#
FontRef::attributes

fn FontRef::attributes(self : FontRef) -> Attributes

#
FontRef::color_palettes

fn FontRef::color_palettes(self : FontRef) -> ColorPalettes

#
FontRef::color_strikes

fn FontRef::color_strikes(self : FontRef) -> BitmapStrikes

Returns an iterator over the color bitmap strikes for the font.

#
FontRef::data

fn FontRef::data(self : FontRef) -> Bytes

#
FontRef::features

fn FontRef::features(self : FontRef) -> Features

#
FontRef::from_index

fn FontRef::from_index(data : Bytes, index : Int) -> FontRef?

#
FontRef::from_offset

fn FontRef::from_offset(data : Bytes, offset : Int) -> FontRef?

#
FontRef::glyph_metrics

fn FontRef::glyph_metrics(self : FontRef, coords : ArrayView[Int]) -> GlyphMetrics

Returns glyph metrics for the font and the specified normalized variation coordinates.

#
FontRef::glyph_name

fn FontRef::glyph_name(self : FontRef, glyph_id : UInt16) -> String?

Returns the name for the specified glyph identifier.

Note: upstream marks this API as unstable and uses it for testing only.

#
FontRef::instances

fn FontRef::instances(self : FontRef) -> Instances

#
FontRef::key

fn FontRef::key(self : FontRef) -> CacheKey

#
FontRef::localized_strings

fn FontRef::localized_strings(self : FontRef) -> LocalizedStrings

#
FontRef::metrics

fn FontRef::metrics(self : FontRef, coords : ArrayView[Int]) -> Metrics

Returns metrics for the font and the specified normalized variation coordinates.

#
FontRef::offset

fn FontRef::offset(self : FontRef) -> Int

#
FontRef::table_data

fn FontRef::table_data(self : FontRef, tag : UInt) -> BytesView?

#
FontRef::table_offset

fn FontRef::table_offset(self : FontRef, tag : UInt) -> UInt

Returns the byte offset of the table with the specified tag.

#
FontRef::variations

fn FontRef::variations(self : FontRef) -> Variations

#
FontRef::writing_systems

fn FontRef::writing_systems(self : FontRef) -> WritingSystems

#
GlyphMetrics

type GlyphMetrics

Glyph advances, side bearings and vertical origins.

#
GlyphMetrics::advance_height

fn GlyphMetrics::advance_height(self : GlyphMetrics, glyph_id : UInt16) -> Double

Returns the vertical advance for the specified glyph.

#
GlyphMetrics::advance_width

fn GlyphMetrics::advance_width(self : GlyphMetrics, glyph_id : UInt16) -> Double

Returns the horizontal advance for the specified glyph.

#
GlyphMetrics::glyph_count

fn GlyphMetrics::glyph_count(self : GlyphMetrics) -> UInt16

#
GlyphMetrics::has_variations

fn GlyphMetrics::has_variations(self : GlyphMetrics) -> Bool

Returns true if variations are supported.

#
GlyphMetrics::has_vertical_metrics

fn GlyphMetrics::has_vertical_metrics(self : GlyphMetrics) -> Bool

Returns true if the font provides canonical vertical glyph metrics.

#
GlyphMetrics::linear_scale

fn GlyphMetrics::linear_scale(self : GlyphMetrics, scale : Double) -> GlyphMetrics

Creates a new set of metrics scaled by the specified factor.

#
GlyphMetrics::lsb

fn GlyphMetrics::lsb(self : GlyphMetrics, glyph_id : UInt16) -> Double

Returns the left side bearing for the specified glyph.

#
GlyphMetrics::scale

fn GlyphMetrics::scale(self : GlyphMetrics, ppem : Double) -> GlyphMetrics

Creates a new set of metrics scaled for the specified pixels per em unit.

#
GlyphMetrics::tsb

fn GlyphMetrics::tsb(self : GlyphMetrics, glyph_id : UInt16) -> Double

Returns the top side bearing for the specified glyph.

#
GlyphMetrics::units_per_em

fn GlyphMetrics::units_per_em(self : GlyphMetrics) -> UInt16

#
GlyphMetrics::vertical_origin

fn GlyphMetrics::vertical_origin(self : GlyphMetrics, glyph_id : UInt16) -> Double

Returns the vertical origin for the specified glyph id.

#
Instance

type Instance

#
Instance::index

fn Instance::index(self : Instance) -> Int

#
Instance::name

fn Instance::name(self : Instance, language : String?) -> LocalizedString?

#
Instance::name_id

fn Instance::name_id(self : Instance) -> StringId

#
Instance::normalized_coords

fn Instance::normalized_coords(self : Instance) -> ArrayView[Int]

#
Instance::postscript_name

fn Instance::postscript_name(self : Instance, language : String?) -> LocalizedString?

#
Instance::postscript_name_id

fn Instance::postscript_name_id(self : Instance) -> StringId?

#
Instance::values

fn Instance::values(self : Instance) -> ArrayView[Double]

#
Instances

type Instances

#
Instances::find_by_name

fn Instances::find_by_name(self : Instances, name : String) -> Instance?

#
Instances::find_by_postscript_name

fn Instances::find_by_postscript_name(self : Instances, name : String) -> Instance?

#
Instances::iter

fn Instances::iter(self : Instances) -> Iter[Instance]

#
Instances::next

fn Instances::next(self : Instances) -> Instance?

#
JoiningType

pub(all) enum JoiningType {
U
L
R
D
Alaph
DalathRish
T
}

#
Language

pub struct Language {
language : Array[Byte]
script : Array[Byte]
region : Array[Byte]
lang_len : Int
script_len : Int
region_len : Int
cjk : Cjk
name_index : Int
tag : UInt?
}

Representation of a language and its associated script and region.
impl Show for Language

#
Language::cjk

fn Language::cjk(self : Language) -> Cjk

Returns the CJK language.

#
Language::from_opentype

fn Language::from_opentype(tag : UInt) -> Language?

Returns the language associated with the specified OpenType language tag.

#
Language::language

fn Language::language(self : Language) -> String

Returns the language component.

#
Language::name

fn Language::name(self : Language) -> String?

Returns the name of the language.

#
Language::parse

fn Language::parse(tag : String) -> Language?

Parses a language tag.

#
Language::region

fn Language::region(self : Language) -> String?

Returns the region component.

#
Language::script

fn Language::script(self : Language) -> String?

Returns the script component.

#
Language::to_opentype

fn Language::to_opentype(self : Language) -> UInt?

Returns the associated OpenType language tag.

#
Language::to_string

fn Language::to_string(self : Language) -> String

#
LineBreak

pub(all) enum LineBreak {
AI
AL
B2
BA
BB
BK
CB
CJ
CL
CM
CP
CR
EB
EM
EX
GL
H2
H3
HL
HY
ID
IN
IS
JL
JT
JV
LF
NL
NS
NU
OP
PO
PR
QU
RI
SA
SG
SP
SY
WJ
XX
ZW
ZWJ
}

#
LocalizedString

pub struct LocalizedString {
b :
BeBytes

storage : Int
offset : Int
}

Represents a single localized string in a font.

#
LocalizedString::chars

fn LocalizedString::chars(self : LocalizedString) -> Iter[Char]

#
LocalizedString::id

#
LocalizedString::is_decodable

fn LocalizedString::is_decodable(self : LocalizedString) -> Bool

#
LocalizedString::is_unicode

fn LocalizedString::is_unicode(self : LocalizedString) -> Bool

#
LocalizedString::language

fn LocalizedString::language(self : LocalizedString) -> String

#
LocalizedString::to_string

fn LocalizedString::to_string(self : LocalizedString) -> String

#
LocalizedStrings

pub struct LocalizedStrings {
b :
BeBytes

len : Int
storage : Int
}

Iterator over a collection of localized strings.

#
LocalizedStrings::find_by_id

fn LocalizedStrings::find_by_id(self : LocalizedStrings, id : StringId, language : String?) -> LocalizedString?

Searches for a string with the specified identifier, and if specified, language.

This function searches the entire string collection without regard for the current state of the iterator.

#
LocalizedStrings::iter

#
LocalizedStrings::len

fn LocalizedStrings::len(self : LocalizedStrings) -> Int

#
Metrics

pub struct Metrics {
units_per_em : UInt16
glyph_count : UInt16
is_monospace : Bool
has_vertical_metrics : Bool
ascent : Double
descent : Double
leading : Double
vertical_ascent : Double
vertical_descent : Double
vertical_leading : Double
cap_height : Double
x_height : Double
average_width : Double
max_width : Double
underline_offset : Double
strikeout_offset : Double
stroke_size : Double
}

Global font metrics.

#
Metrics::linear_scale

fn Metrics::linear_scale(self : Metrics, s : Double) -> Metrics

Creates a new set of metrics scaled by the specified factor.

#
Metrics::scale

fn Metrics::scale(self : Metrics, ppem : Double) -> Metrics

Creates a new set of metrics scaled for the specified pixels per em unit.

#
MetricsProxy

type MetricsProxy

Proxy for rematerializing metrics.

#
MetricsProxy::from_font

fn MetricsProxy::from_font(font : FontRef) -> MetricsProxy

#
MetricsProxy::glyph_count

fn MetricsProxy::glyph_count(self : MetricsProxy) -> UInt16

#
MetricsProxy::materialize_glyph_metrics

fn MetricsProxy::materialize_glyph_metrics(self : MetricsProxy, font : FontRef, coords : ArrayView[Int]) -> GlyphMetrics

Materializes glyph metrics for the specified font and normalized variation coordinates. This proxy must have been created from the same font.

#
MetricsProxy::materialize_metrics

fn MetricsProxy::materialize_metrics(self : MetricsProxy, font : FontRef, coords : ArrayView[Int]) -> Metrics

Materializes font metrics for the specified font and normalized variation coordinates. This proxy must have been created from the same font.

#
MetricsProxy::units_per_em

fn MetricsProxy::units_per_em(self : MetricsProxy) -> UInt16

#
MyanmarClass

pub(all) enum MyanmarClass {
A
As
C
D
D0
DB
GB
H
IV
J
K
MH
MR
MW
MY
O
P
PT
R
S
V
VAbv
VBlw
VPre
VPst
VS
WJ
}

#
ObliqueAngle

pub struct ObliqueAngle {
value : UInt16
}

Angle of an oblique style in degrees from -90 to 90.

#
ObliqueAngle::from_degrees

fn ObliqueAngle::from_degrees(degrees : Double) -> ObliqueAngle

#
ObliqueAngle::from_gradians

fn ObliqueAngle::from_gradians(gradians : Double) -> ObliqueAngle

#
ObliqueAngle::from_radians

fn ObliqueAngle::from_radians(radians : Double) -> ObliqueAngle

#
ObliqueAngle::from_turns

fn ObliqueAngle::from_turns(turns : Double) -> ObliqueAngle

#
ObliqueAngle::to_degrees

fn ObliqueAngle::to_degrees(self : ObliqueAngle) -> Double

#
Parser

type Parser

Parser that accepts a sequence of characters and outputs character clusters.

#
Parser::new

fn Parser::new(script : Script, tokens : Iter[Token]) -> Parser

#
Parser::next

fn Parser::next(self : Parser, cluster : CharCluster) -> Bool

#
Properties

pub struct Properties {
bits : UInt
}

Compact reference to Unicode properties for a character.

#
Properties::bidi_class

fn Properties::bidi_class(self : Properties) -> BidiClass

#
Properties::block

fn Properties::block(self : Properties) -> Block

#
Properties::boundary

fn Properties::boundary(self : Properties) -> UInt

#
Properties::category

fn Properties::category(self : Properties) -> Category

#
Properties::cluster_break

fn Properties::cluster_break(self : Properties) -> ClusterBreak

#
Properties::cluster_class

fn Properties::cluster_class(self : Properties) -> (ClusterBreak, Bool)

#
Properties::combining_class

fn Properties::combining_class(self : Properties) -> UInt

#
Properties::contributes_to_shaping

fn Properties::contributes_to_shaping(self : Properties) -> Bool

#
Properties::is_close_bracket

fn Properties::is_close_bracket(self : Properties) -> Bool

#
Properties::is_emoji

fn Properties::is_emoji(self : Properties) -> Bool

#
Properties::is_extended_pictographic

fn Properties::is_extended_pictographic(self : Properties) -> Bool

#
Properties::is_ignorable

fn Properties::is_ignorable(self : Properties) -> Bool

#
Properties::is_open_bracket

fn Properties::is_open_bracket(self : Properties) -> Bool

#
Properties::is_variation_selector

fn Properties::is_variation_selector(self : Properties) -> Bool

#
Properties::joining_type

fn Properties::joining_type(self : Properties) -> JoiningType

#
Properties::line_break

fn Properties::line_break(self : Properties) -> LineBreak

#
Properties::myanmar_class

fn Properties::myanmar_class(self : Properties) -> (MyanmarClass, Bool)

#
Properties::script

fn Properties::script(self : Properties) -> Script

#
Properties::use_class

fn Properties::use_class(self : Properties) -> (UseClass, Bool, Bool)

#
Properties::with_boundary

fn Properties::with_boundary(self : Properties, boundary : UInt) -> Properties

#
Properties::word_break

fn Properties::word_break(self : Properties) -> WordBreak

#
Script

pub(all) enum Script {
Adlam
CaucasianAlbanian
Ahom
Arabic
ImperialAramaic
Armenian
Avestan
Balinese
Bamum
BassaVah
Batak
Bengali
Bhaiksuki
Bopomofo
Brahmi
Braille
Buginese
Buhid
Chakma
CanadianAboriginal
Carian
Cham
Cherokee
Chorasmian
Coptic
Cypriot
Cyrillic
Devanagari
DivesAkuru
Dogra
Deseret
Duployan
EgyptianHieroglyphs
Elbasan
Elymaic
Ethiopic
Georgian
Glagolitic
GunjalaGondi
MasaramGondi
Gothic
Grantha
Greek
Gujarati
Gurmukhi
Hangul
Han
Hanunoo
Hatran
Hebrew
Hiragana
AnatolianHieroglyphs
PahawhHmong
NyiakengPuachueHmong
OldHungarian
OldItalic
Javanese
KayahLi
Katakana
Kharoshthi
Khmer
Khojki
KhitanSmallScript
Kannada
Kaithi
TaiTham
Lao
Latin
Lepcha
Limbu
LinearA
LinearB
Lisu
Lycian
Lydian
Mahajani
Makasar
Mandaic
Manichaean
Marchen
Medefaidrin
MendeKikakui
MeroiticCursive
MeroiticHieroglyphs
Malayalam
Modi
Mongolian
Mro
MeeteiMayek
Multani
Myanmar
Nandinagari
OldNorthArabian
Nabataean
Newa
Nko
Nushu
Ogham
OlChiki
OldTurkic
Oriya
Osage
Osmanya
Palmyrene
PauCinHau
OldPermic
PhagsPa
InscriptionalPahlavi
PsalterPahlavi
Phoenician
Miao
InscriptionalParthian
Rejang
HanifiRohingya
Runic
Samaritan
OldSouthArabian
Saurashtra
SignWriting
Shavian
Sharada
Siddham
Khudawadi
Sinhala
Sogdian
OldSogdian
SoraSompeng
Soyombo
Sundanese
SylotiNagri
Syriac
Tagbanwa
Takri
TaiLe
NewTaiLue
Tamil
Tangut
TaiViet
Telugu
Tifinagh
Tagalog
Thaana
Thai
Tibetan
Tirhuta
Ugaritic
Vai
WarangCiti
Wancho
OldPersian
Cuneiform
Yezidi
Yi
ZanabazarSquare
Inherited
Common
Unknown
}

Unicode script.

#
Script::from_opentype

fn Script::from_opentype(tag : UInt) -> Script?

Returns the script associated with the specified OpenType script tag.

#
Script::is_complex

fn Script::is_complex(self : Script) -> Bool

Returns true if the script requires complex shaping.

#
Script::is_joined

fn Script::is_joined(self : Script) -> Bool

Returns true if the script has cursive joining.

#
Script::name

fn Script::name(self : Script) -> String

Returns the name of the script.

#
Script::to_opentype

fn Script::to_opentype(self : Script) -> UInt

Returns the script as an OpenType tag.

#
SeenFeatures

pub struct SeenFeatures {
bits : Array[UInt]
}

Bitset for feature de-duplication.

#
SeenFeatures::mark

fn SeenFeatures::mark(self : SeenFeatures, feature_index : Int) -> Bool

#
SeenFeatures::new

#
Setting

pub struct Setting[T] {
tag : UInt
value : T
}

#
Setting::new

fn[T] Setting::new(tag : UInt, value : T) -> Setting[T]

#
Setting::parse_feature

fn Setting::parse_feature(s : String) -> Setting[UInt16]?

#
Setting::parse_feature_list

fn Setting::parse_feature_list(s : String) -> Iter[Setting[UInt16]]

#
Setting::parse_variation

fn Setting::parse_variation(s : String) -> Setting[Double]?

#
Setting::parse_variation_list

fn Setting::parse_variation_list(s : String) -> Iter[Setting[Double]]

#
ShapeClass

pub(all) enum ShapeClass {
Reph
Pref
Kinzi
Base
Mark
Halant
MedialRa
VMPre
VPre
VBlw
Anusvara
Zwj
Zwnj
Control
Vs
Other
}

Shaping class of a character.

#
SourceRange

type SourceRange

Source range of a cluster in code units.

#
SourceRange::end

fn SourceRange::end(self : SourceRange) -> UInt

#
SourceRange::new

fn SourceRange::new(start : UInt, end : UInt) -> SourceRange

#
SourceRange::start

fn SourceRange::start(self : SourceRange) -> UInt

#
Status

pub(all) enum Status {
Discard
Keep
Complete
}

Iterative status of mapping a character cluster to nominal glyph identifiers.

#
Stretch

pub struct Stretch {
value : UInt16
}

Visual width of a font-- a relative change from the normal aspect ratio.
impl Compare for Stretch
impl Eq for Stretch
impl Show for Stretch

#
Stretch::condensed

fn Stretch::condensed() -> Stretch

#
Stretch::expanded

fn Stretch::expanded() -> Stretch

#
Stretch::extra_condensed

fn Stretch::extra_condensed() -> Stretch

#
Stretch::extra_expanded

fn Stretch::extra_expanded() -> Stretch

#
Stretch::from_percentage

fn Stretch::from_percentage(percentage : Double) -> Stretch

#
Stretch::is_condensed

fn Stretch::is_condensed(self : Stretch) -> Bool

#
Stretch::is_expanded

fn Stretch::is_expanded(self : Stretch) -> Bool

#
Stretch::is_normal

fn Stretch::is_normal(self : Stretch) -> Bool

#
Stretch::normal

fn Stretch::normal() -> Stretch

#
Stretch::parse

fn Stretch::parse(s0 : String) -> Stretch?

#
Stretch::raw

fn Stretch::raw(self : Stretch) -> UInt16

#
Stretch::semi_condensed

fn Stretch::semi_condensed() -> Stretch

#
Stretch::semi_expanded

fn Stretch::semi_expanded() -> Stretch

#
Stretch::to_percentage

fn Stretch::to_percentage(self : Stretch) -> Double

#
Stretch::to_string

fn Stretch::to_string(self : Stretch) -> String

#
Stretch::ultra_condensed

fn Stretch::ultra_condensed() -> Stretch

#
Stretch::ultra_expanded

fn Stretch::ultra_expanded() -> Stretch

#
StringId

pub(all) enum StringId {
Copyright
Family
SubFamily
UniqueId
Full
Version
PostScript
Trademark
Manufacturer
Designer
Description
VendorUrl
DesignerUrl
License
LicenseUrl
TypographicFamily
TypographicSubFamily
CompatibleFull
SampleText
PostScriptCid
WwsFamily
WwsSubFamily
LightBackgroundPalette
DarkBackgroundPalette
VariationsPostScriptNamePrefix
Other(UInt16)
}

Identifier for well-known localized strings in a font.

#
StringId::from_raw

fn StringId::from_raw(value : UInt16) -> StringId

#
StringId::to_raw

fn StringId::to_raw(self : StringId) -> UInt16

#
Style

pub(all) enum Style {
Normal
Italic
Oblique(ObliqueAngle)
}

Visual style or 'slope' of a font.
impl Eq for Style
impl Show for Style

#
Style::from_degrees

fn Style::from_degrees(degrees : Double) -> Style

#
Style::parse

fn Style::parse(s0 : String) -> Style?

#
Style::to_degrees

fn Style::to_degrees(self : Style) -> Double

#
Style::to_string

fn Style::to_string(self : Style) -> String

#
Synthesis

pub struct Synthesis {
vars : Array[Setting[Double]]
embolden : Bool
skew : Int
}

Synthesis suggestions for mismatched font attributes.

This is generated by Attributes::synthesize.
impl Eq for Synthesis

#
Synthesis::any

fn Synthesis::any(self : Synthesis) -> Bool

#
Synthesis::embolden

fn Synthesis::embolden(self : Synthesis) -> Bool

#
Synthesis::skew

fn Synthesis::skew(self : Synthesis) -> Double?

#
Synthesis::variations

fn Synthesis::variations(self : Synthesis) -> ArrayView[Setting[Double]]

#
Token

type Token

Character input to the cluster parser.

#
Token::ch

fn Token::ch(self : Token) -> Char

#
Token::data

fn Token::data(self : Token) -> UInt

#
Token::default

fn Token::default() -> Token

#
Token::info

fn Token::info(self : Token) -> CharInfo

#
Token::len

fn Token::len(self : Token) -> UInt

#
Token::new

fn Token::new(ch : Char, offset : UInt, len : UInt, info : CharInfo, data : UInt) -> Token

#
Token::offset

fn Token::offset(self : Token) -> UInt

#
Usability

pub(all) enum Usability {
Light
Dark
Both
}

Theme of a palette with respect to background color.

#
UseClass

pub(all) enum UseClass {
B
CGJ
CMAbv
CMBlw
CS
FAbv
FBlw
FPst
FM
GB
H
HN
IND
MAbv
MBlw
MPre
MPst
N
O
R
Rsv
S
SMAbv
SMBlw
SUB
VAbv
VBlw
VPre
VPst
VMAbv
VMBlw
VMPre
VMPst
VS
WJ
ZWJ
ZWNJ
}

#
Variation

type Variation

#
Variation::default_value

fn Variation::default_value(self : Variation) -> Double

#
Variation::index

fn Variation::index(self : Variation) -> Int

#
Variation::is_hidden

fn Variation::is_hidden(self : Variation) -> Bool

#
Variation::max_value

fn Variation::max_value(self : Variation) -> Double

#
Variation::min_value

fn Variation::min_value(self : Variation) -> Double

#
Variation::name

fn Variation::name(self : Variation, language : String?) -> LocalizedString?

#
Variation::name_id

fn Variation::name_id(self : Variation) -> StringId

#
Variation::normalize

fn Variation::normalize(self : Variation, value : Double) -> Int

#
Variation::tag

fn Variation::tag(self : Variation) -> UInt

#
Variations

type Variations

#
Variations::find_by_tag

fn Variations::find_by_tag(self : Variations, tag : UInt) -> Variation?

#
Variations::iter

fn Variations::iter(self : Variations) -> Iter[Variation]

#
Variations::len

fn Variations::len(self : Variations) -> Int

#
Variations::next

fn Variations::next(self : Variations) -> Variation?

#
Variations::normalized_coords

fn Variations::normalized_coords(self : Variations, settings : Iter[Setting[Double]]) -> Iter[Int]

#
VariationsProxy

type VariationsProxy

#
VariationsProxy::from_font

fn VariationsProxy::from_font(font : FontRef) -> VariationsProxy

#
VariationsProxy::materialize

fn VariationsProxy::materialize(self : VariationsProxy, font : FontRef) -> Variations

#
Weight

pub struct Weight {
value : UInt16
}

Visual weight class of a font on a scale from 1 to 1000.
impl Compare for Weight
impl Eq for Weight
impl Show for Weight

#
Weight::black

fn Weight::black() -> Weight

#
Weight::bold

fn Weight::bold() -> Weight

#
Weight::extra_bold

fn Weight::extra_bold() -> Weight

#
Weight::extra_light

fn Weight::extra_light() -> Weight

#
Weight::light

fn Weight::light() -> Weight

#
Weight::medium

fn Weight::medium() -> Weight

#
Weight::normal

fn Weight::normal() -> Weight

#
Weight::parse

fn Weight::parse(s0 : String) -> Weight?

#
Weight::semi_bold

fn Weight::semi_bold() -> Weight

#
Weight::thin

fn Weight::thin() -> Weight

#
Weight::to_string

fn Weight::to_string(self : Weight) -> String

#
Whitespace

pub(all) enum Whitespace {
None
Space
NoBreakSpace
Tab
Newline
Other
}

Whitespace content of a cluster.

#
Whitespace::is_space_or_nbsp

fn Whitespace::is_space_or_nbsp(self : Whitespace) -> Bool

#
WordBreak

pub(all) enum WordBreak {
CR
DQ
EX
Extend
FO
HL
KA
LE
LF
MB
ML
MN
NL
NU
RI
SQ
WSegSpace
XX
ZWJ
}

#
WordBreakStrength

pub(all) enum WordBreakStrength {
Normal
BreakAll
KeepAll
}

Word breaking strength (corresponds to https://drafts.csswg.org/css-text/#word-break-property).

Ported from swash/src/text/analyze.rs (swash is dual-licensed Apache-2.0 OR MIT).

#
WritingSystem

type WritingSystem

Script, language and associated typographic features available in a font.

#
WritingSystem::features

fn WritingSystem::features(self : WritingSystem) -> Features

Returns an iterator over the features provided by the writing system.

#
WritingSystem::language

fn WritingSystem::language(self : WritingSystem) -> Language?

Returns the language for the writing system.

#
WritingSystem::language_tag

fn WritingSystem::language_tag(self : WritingSystem) -> UInt

Returns the OpenType language tag for the writing system.

#
WritingSystem::script

fn WritingSystem::script(self : WritingSystem) -> Script?

Returns the script for the writing system.

#
WritingSystem::script_tag

fn WritingSystem::script_tag(self : WritingSystem) -> UInt

Returns the OpenType script tag for the writing system.

#
WritingSystems

type WritingSystems

Iterator over a collection of writing systems.

#
WritingSystems::from_font

fn WritingSystems::from_font(font : FontRef) -> WritingSystems

#
WritingSystems::iter

#
COMPOSE1_COUNT

let COMPOSE1_COUNT : Int

#
MAX_CLUSTER_SIZE

let MAX_CLUSTER_SIZE : Int

The maximum number of characters in a single cluster.

#
UNICODE_VERSION_MAJOR

let UNICODE_VERSION_MAJOR : Int

The version of the Unicode Character Database used to generate properties.

#
UNICODE_VERSION_MINOR

let UNICODE_VERSION_MINOR : Int

#
UNICODE_VERSION_PATCH

let UNICODE_VERSION_PATCH : Int

#
analyze

fn analyze(chars : Iter[Char]) -> Analyze

Returns an iterator yielding unicode properties and boundary analysis for each character in the specified sequence.

#
compose_pair

fn compose_pair(a : Char, b : Char) -> Char?

#
decompose

fn decompose(c : Char) -> Iter[Char]

#
decompose_compat

fn decompose_compat(c : Char) -> Iter[Char]

#
desc_from_aat

fn desc_from_aat(feature : UInt16, selector : UInt16) -> (Int, UInt, String)?

Returns a feature tag and description from an AAT feature and selector.

#
desc_from_at

fn desc_from_at(tag : UInt) -> (Int, String)?

Returns a feature description for the specified tag.

#
tag_from_bytes

fn tag_from_bytes(bytes : Bytes) -> UInt?

#
tag_from_str_lossy

fn tag_from_str_lossy(s : String) -> UInt

#
unicode_version

fn unicode_version() -> (Int, Int, Int)