font reference
The font package: font.
font
struct Slot
wolang
offer struct Slotfield x
wolang
var x: intfield y
wolang
var y: intfield width
wolang
var width: intfield height
wolang
var height: intfield left
wolang
var left: intfield top
wolang
var top: intfield advance
wolang
var advance: floatclass Atlas
wolang
offer class Atlasfield pixels
wolang
var pixels: []mut u8field width
wolang
var width: intfield height
wolang
var height: intfield slots
wolang
var slots: Map<int, Slot>field cursor_x
wolang
var cursor_x: int = 0field cursor_y
wolang
var cursor_y: int = 0field row_height
wolang
var row_height: int = 0method deinit
wolang
deinitmethod Count
wolang
fun Count() -> intmethod At
wolang
fun At(x: int, y: int) -> intmethod Key
wolang
fun Key(glyph: int, size: float) -> intmethod Find
wolang
fun Find(glyph: int, size: float) -> Slot? uses unsafemethod Get
wolang
fun Get(font: Font, glyph: int, size: float) -> Slot? uses unsafemethod ToImage
wolang
fun ToImage() -> Image? uses unsafefunction AtlasNew
wolang
offer fun AtlasNew(width: int, height: int) -> Atlas!(BadSize, TooLarge) uses unsafeerror Missing
wolang
offer error Missingfunction SystemFontFile
wolang
offer fun SystemFontFile(name: text) -> text? uses io, unsafefunction Available
wolang
offer fun Available() -> bool uses io, unsafefunction FontLoadFile
wolang
offer fun FontLoadFile(path: text) -> Font!(Malformed, TooLarge, Unsupported, Missing) uses io, unsafefunction SampleFont
wolang
offer fun SampleFont() -> Font!(Malformed, TooLarge, Unsupported) uses unsafeerror Malformed
wolang
offer error Malformederror Unsupported
wolang
offer error Unsupportederror TooLarge
wolang
offer error TooLargeconstant kMaxFontBytes
wolang
offer const kMaxFontBytes: int = 67108864constant kMaxPoints
wolang
offer const kMaxPoints: int = 16384struct Affine
wolang
offer struct Affinefield a
wolang
var a: floatfield b
wolang
var b: floatfield c
wolang
var c: floatfield d
wolang
var d: floatfield e
wolang
var e: floatfield f
wolang
var f: floatmethod Then
wolang
fun Then(child: Affine) -> Affinefunction AffineIdentity
wolang
offer fun AffineIdentity() -> Affineclass Outline
wolang
offer class Outlinefield xs
wolang
var xs: List<float>field ys
wolang
var ys: List<float>field on
wolang
var on: List<bool>field ends
wolang
var ends: List<int>method Contours
wolang
fun Contours() -> intmethod Points
wolang
fun Points() -> intfunction OutlineNew
wolang
offer fun OutlineNew() -> Outline uses unsafeclass Font
wolang
offer class Fontfield data
wolang
var data: []mut u8field units
wolang
var units: int = 0field glyphs
wolang
var glyphs: int = 0field long_loca
wolang
var long_loca: bool = falsefield ascent
wolang
var ascent: int = 0field descent
wolang
var descent: int = 0field gap
wolang
var gap: int = 0field metrics
wolang
var metrics: int = 0field hmtx
wolang
var hmtx: int = 0field loca
wolang
var loca: int = 0field glyf
wolang
var glyf: int = 0field glyf_len
wolang
var glyf_len: int = 0field cmap
wolang
var cmap: int = 0field cmap_format
wolang
var cmap_format: int = 0field kern
wolang
var kern: int = 0field kern_pairs
wolang
var kern_pairs: int = 0method deinit
wolang
deinitmethod UnitsPerEm
wolang
fun UnitsPerEm() -> intmethod GlyphCount
wolang
fun GlyphCount() -> intmethod Ascent
wolang
fun Ascent() -> intmethod Descent
wolang
fun Descent() -> intmethod LineGap
wolang
fun LineGap() -> intmethod Scale
wolang
fun Scale(size: float) -> floatmethod Advance
wolang
fun Advance(glyph: int) -> intmethod LeftBearing
wolang
fun LeftBearing(glyph: int) -> intmethod GlyphIndex
wolang
fun GlyphIndex(code: int) -> intmethod LookupFormat4
wolang
fun LookupFormat4(code: int) -> intmethod LookupFormat12
wolang
fun LookupFormat12(code: int) -> intmethod Kerning
wolang
fun Kerning(left: int, right: int) -> intmethod GlyphStart
wolang
fun GlyphStart(glyph: int) -> intmethod GlyphEnd
wolang
fun GlyphEnd(glyph: int) -> intmethod GlyphOutline
wolang
fun GlyphOutline(glyph: int) -> Outline!Malformed uses unsafemethod Collect
wolang
fun Collect(glyph: int, depth: int, t: Affine, out: Outline) -> bool uses unsafemethod CollectSimple
wolang
fun CollectSimple(at: int, limit: int, contours: int, t: Affine, out: Outline) -> bool uses unsafemethod CollectComposite
wolang
fun CollectComposite(
first: int,
limit: int,
depth: int,
t: Affine,
out: Outline) -> bool uses unsafefunction FontLoad
wolang
offer fun FontLoad(bytes: []u8) -> Font!(Malformed, TooLarge, Unsupported) uses unsafestruct Placement
wolang
offer struct Placementfield glyph
wolang
var glyph: intfield code
wolang
var code: intfield x
wolang
var x: floatfield y
wolang
var y: floatfield line
wolang
var line: intclass Layout
wolang
offer class Layoutfield items
wolang
var items: List<Placement>field width
wolang
var width: floatfield height
wolang
var height: floatfield lines
wolang
var lines: intfield line_height
wolang
var line_height: floatmethod Count
wolang
fun Count() -> intmethod At
wolang
fun At(index: int) -> Placementfunction LineHeight
wolang
offer fun LineHeight(font: Font, size: float) -> floatfunction LayoutText
wolang
offer fun LayoutText(font: Font, value: text, size: float, wrap: float) -> Layout uses unsafefunction Measure
wolang
offer fun Measure(font: Font, value: text, size: float) -> float uses unsafefunction DrawText
wolang
offer fun DrawText(
target: Image,
font: Font,
value: text,
size: float,
x: int,
y: int,
colour: u32) uses unsafeerror BadSize
wolang
offer error BadSizeconstant kMaxBitmapSide
wolang
offer const kMaxBitmapSide: int = 4096class Glyph
wolang
offer class Glyphfield coverage
wolang
var coverage: []mut u8field width
wolang
var width: intfield height
wolang
var height: intfield left
wolang
var left: intfield top
wolang
var top: intfield advance
wolang
var advance: floatmethod deinit
wolang
deinitmethod At
wolang
fun At(x: int, y: int) -> intmethod Total
wolang
fun Total() -> intmethod ToImage
wolang
fun ToImage(red: int, green: int, blue: int) -> Image? uses unsafefunction Flatten
wolang
offer fun Flatten(outline: Outline, scale: float, edges: List<float>) uses unsafefunction AccumulateLine
wolang
offer fun AccumulateLine(
acc: []mut float,
w: int,
h: int,
ax: float,
ay: float,
bx: float,
by: float)function Rasterize
wolang
offer fun Rasterize(font: Font, glyph: int, size: float) -> Glyph!(Malformed, TooLarge, BadSize) uses unsafefunction DrawGlyph
wolang
offer fun DrawGlyph(target: Image, glyph: Glyph, x: int, y: int, colour: u32)function BlendPixel
wolang
offer fun BlendPixel(
target: Image,
x: int,
y: int,
red: int,
green: int,
blue: int,
alpha: int)