Expand description
A bitmap font atlas: a grid of fixed-size glyph cells in one image, and
a glyph map (a RON file) from char to cell index. The game names the
two files and the glyphs it needs. As a format (ADR-0007), the glyph
map is a sidecar read with the PNG beside it (FontAtlasRon). Once
the atlas and the game’s text both load, undrawn finds every
character of the text the atlas can’t draw.
An atlas may hold a second, wide font beside the narrow one: a wide
glyph (a Japanese or Chinese character) takes two cells of the atlas,
side by side, and two cells of the screen. CellWidths says which
characters are wide, for everything that measures text.
Wide sets. Japanese and Chinese share code points but not shapes
(直, 骨, 角), so an atlas may hold several wide fonts, each a set:
the unnamed one (FontAtlasDef::wide) and named ones
(FontAtlasDef::wide_sets). A language pack names the set it draws
from (LangInfo::wide_font), and a
wide glyph is looked up in that set first, then in the others
(FontAtlasDef::wide_cell), so a pack’s name for itself shows in its
own shapes whatever language is on. The punctuation of
WIDE_PUNCTUATION is narrow, but wide in a language whose pack says
so (CellWidths::in_lang).
Structs§
- Atlas
Rect - A pixel rectangle inside the atlas image.
- Cell
Widths - How many cells of the screen each character takes, in one language:
two for a character with a wide glyph in any set of the atlas
(
FontAtlasDef::wide,FontAtlasDef::wide_sets), and forWIDE_PUNCTUATIONin a language whose pack has it wide; one for any other.text_widthmeasures text with it, and a glyph buffer prints with it. It also names the language’s wide set, which a renderer looks wide glyphs up in first (wide_font).CellWidths::NARROWhas nothing wide. Cheap to clone: the set is shared. - Font
Atlas Def - The validated font atlas layout.
- Font
Atlas Ron - A font atlas’s glyph map (
font-atlas,.ron), checked asFontAtlasDef::from_sourcesays against the PNG beside it with its name (fonts/atlas.ronandfonts/atlas.png) and the glyphs the game requires.
Constants§
- FALLBACK_
GLYPH - The glyph used when a cell’s glyph is not in the atlas.
- WIDE_
PUNCTUATION - The punctuation narrow in English and wide in Chinese, with the same
code points:
“ ” ‘ ’ … —. An atlas may have each both narrow and in a wide set; a language’s pack says which it is (LangInfo::wide_punctuation).
Functions§
- ascii_
spelling - The ASCII spelling of typographic punctuation (
’is',…is...), ifcis some. - describe
'x' (U+0078), readable even for invisible or confusable glyphs.- is_
combining_ mark - Whether
cis a combining mark (U+0300 to U+036F). A cell draws one beside its letter, not over it, so text needs the accented letter as one character instead (é, U+00E9), and an atlas never keeps one. - is_
wide_ punctuation - Whether
cis one ofWIDE_PUNCTUATION. - undrawn
- Every character of
lang’s text (Lang::texts) thatatlascan’t draw in its language: a check across assets, after both load. A language’s wide characters (as its widths have them,Lang::widths: a pack’s or the source’s) must be in the wide set it names, or in any set if it names none; the rest narrow. A pack that names a set the atlas lacks is one error, on itslang.ron(the source, on its folder), and its wide characters aren’t checked. One error per language and character, in the order of their first use, on the file of that use (TextAt::path), naming its key and how many more keys of that language use it. Control characters (a\n) are never errors; a combining mark (is_combining_mark) always is, glyph or not. The errors have no line: aLangkeeps keys, which find the line.
Type Aliases§
- WideSet
- A set of wide glyphs: each character → the cell index of its left half.