ASCII style
The same character, typed out in glyphs. Every state, shape and face is available, including the default cute face and the effects around it, because the ascii series reuses the pixel series' rasteriser and only decides which character each cell is written as. It is the only series whose output is also plain text you can copy.
The default series is vector; a character that does not name a style is drawn in it.
Variants
The plate behind crt is part of the picture and does not follow the theme: a terminal is dark on a light page too, so the character is lit in its dark-page ink on either page, the same rule as the pixel dot panel.
Charsets
charset chooses the glyph set the cells are written from.
Fills
fill chooses how the inside of the body is written.
Effects
effect adds motion to the glyphs themselves.
Effects are off in static output and under reduced motion: a static document is the settled picture, byte for byte the same every time.
Parameters
Parameters go in styleOptions. The engine merges them over the defaults, clamps numbers to their range and snaps them to the step, so a slider and a typed value agree. Unknown keys are dropped.
Pick a variant and the panel lists only the parameters that variant reads. It is built from the registry, so it stays in step with the table above, and its option names come from the locale.
Because cols is measured in shape space, the number of characters does not change with sizePx. A 16px mark and a 120px mark are the same character at two sizes, not two different drawings. Style parameters never reach the simulation: the same seed blinks at the same moments in every series.
As plain text
renderAsciiText returns the character as rows of text, joined by \n with trailing spaces trimmed. It takes the same options as renderStaticSvg, so a chat message, a terminal, a CLI banner, an agent log or a README can show exactly the character the series draws.
__-----__ ♥
--===++++++xxxx--
-====+=====++++XXXXX-
.=========++++++xxxx####.
.==+=====++++++xxxxxXXX#%%.
=+==.OOo++++xoOO.xXXXXXX#%%
(++==Oo'O|+xx|O'oOXXXX####@@)
(+++++++xxxxxxXXXXXX######%@)
-xx+++xxxxx'XXXXXX#####%%%@@-
'XXXXxxxXXXXXX######%%@@@@'
--X#####%%%###@@@@@@@@@--
----%%%%@@@@@@@----In a terminal, add ansi: true to get 24-bit colour escape codes, then print the result:
renderAsciiText is exported from @aora-bot/engine and from @aora-bot/engine/static, so it runs in Node, a worker or a CLI without a DOM.
How a cell is chosen
The series does not draw a picture of its own. It rasterises the frame with the pixel series' rasteriser on a finer sub-grid, cols * 2 sub-cells across. Each block of 2×4 sub-cells then becomes one character cell, and a glyph is chosen from the charset by the shape of the cell's coverage, that is, which of the eight sub-cells are filled.
- The body is sampled into sub-cells, in the pixel series' painter's order, so every shape, state, face, part, belt and HUD arrives without a drawing of its own.
- The face, the belt and the HUD primitives sit over the body: they are rasterised after it, so an eye replaces the body glyph beneath it. In
monothose cells are left blank. - A cell on the edge picks a glyph that follows the contour; a cell inside the body picks one from the shading ramp, lit at the upper left and deepest at the lower right (
filldecides how much of this is used). - Mood effects (Zz, sparkles, the heart, the tear, the bang, the spinner, the pencil) and confetti are written as literal characters:
z Z * ♥ ' ! . o - | / \.
The output is still an SVG root: one <text> per colour and one <tspan> per row, with an explicit x for every glyph and a monospace font stack, so each character sits on its own cell whatever the font's advance. That is why CharacterMark, StagedMark, mirrors and static rendering all work without special handling.
In the engine
Static output is deterministic and needs no DOM, so it is safe during server rendering.
CHARSETS is the registry of glyph sets, keyed by the charset ids above, and is extensible, so a host can add a set of its own.
A variant the series does not have falls back to its default, so a vector character using outline is drawn as ansi when switched to ascii.
In React
CharacterMark, CharacterMarkMirror and StagedMark take styleId, variant and styleOptions, and put data-style and data-variant on the root. The prop is styleId because style on a mark is already inline CSS.
AppearanceProvider sets them for a subtree. A prop on the mark wins over it, and nested providers merge field by field.
StagedMark shares one running engine between every mark of the same appearance. The style, the variant and the parameters that differ from the defaults are part of that appearance, so an ascii source is never mirrored by a pixel mark, and {} and { cols: 28 } share a source.
Limits
- Glyph shapes depend on the host's monospace font. Each glyph is placed on its cell by an explicit
x, but how an edge character such as/or(looks still changes from one font to the next. blockandbrailleneed a font that has those glyphs. Most systems fall back to one, but the weight and the spacing of the fallback may not match the rest of the line.- The numbers printed on a HUD dial are not drawn. They are too small to read as glyphs; the dial itself is drawn.
- As in the pixel series, translucency is quantised to quarters and replaces the cell beneath it rather than blending with it.
- Effects are off in static output and under reduced motion.