Import std.image.font
std.image.font
Font: a TrueType or OpenType font, read by the runtime itself, which checks each offset in it before it follows it, so a broken font or one made to mislead is an IOError, or draws boxes, but never reads past its bytes: its glyphs' outlines, TrueType's, simple and composite, or CFF's, cmap's formats 4 and 12, and kern's kerning, from bytes or a file. Its sizes are in pixels an em; a Canvas's FillText draws its text.
std/image/font.fb
Types
Font
class
Public Class Font
A TrueType or OpenType font, whose glyphs a Canvas draws text with.
-
The font in
data, a font file or a collection's first font. Throws an IOError of INVALID_DATA when it isn't one, or is broken, and of OTHER when it's a kind std.image doesn't read, like one of CFF2's outlines. -
The font in the file at
path, which Parse reads from its bytes. Throws the IOError File.ReadBytes does for a file that can't be read, and Parse's, its Path the file's, for one it can't read a font of. -
Load's Async twin, which reads the file on libuv's thread pool while the thread that called it goes on, and parses it there once the Await resumes.
-
The units its glyphs are in, an em of them.
-
How far its glyphs go above the baseline, at
sizepixels an em. Panics when thesizeisn't finite or is negative, as each of its metrics does. -
How far its glyphs go below the baseline, at
sizepixels an em, above 0. -
The gap between one line's descent and the next one's ascent, at
sizepixels an em. -
How far apart its lines' baselines are, at
sizepixels an em: its ascent, descent, and line gap. -
How wide the
textis atsizepixels an em, its widest line's, as FillText lays it out: each glyph's advance and the kerning between them. Panics when thesizeisn't finite or is negative. -
Whether it has a glyph for the code point, rather than its .notdef, which draws in its place.
Report an issue with this page or with FutureBlitz on GitHub.