mwg API
    Preparing search index...

    Function layoutVertical

    • The pure layout math behind VerticalLabel, kept separate from Pixi's Text so it can be tested without a canvas - Text needs a real document to 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. \n in the source text forces a new column, the same way it forces a new line in horizontal text.

      Parameters

      Returns GlyphLayout[]

      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 }