import { layoutVertical } from '@datamoc/mw_games/two-d/ui';
const glyphs = layoutVertical('AB', { lineHeight: 10, columnHeight: 100 });
console.log(glyphs[0]); // { char: 'A', x: -5, y: 5, rotate: true } - Latin letters rotate by default
console.log(glyphs[1]); // { char: 'B', x: -5, y: 15, rotate: true }
The pure layout math behind
VerticalLabel, kept separate from Pixi'sTextso it can be tested without a canvas -Textneeds a realdocumentto measure glyphs, which does not exist outside a browser.Columns run right to left, each one top to bottom, which is the traditional order for vertical Japanese and Chinese.
\nin the source text forces a new column, the same way it forces a new line in horizontal text.