Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 27x 18x | import type { Container, Text } from 'pixi.js';
import {
addHUDText,
addSkinNumber,
addSkinText,
type ChildPool,
type HUDTextOptions,
type SkinTextOptions,
} from '../pixi-kit/index.ts';
import { SYN_DISPLAY_FONT } from './style.ts';
const DIGIT = /\d/u;
/**
* Skin text in Synesthesia's faces, with Orbitron's figures tabular: Orbitron's digits are proportional (a 1 is half
* as wide as a 0), so a display-face text holding a digit is laid out in tabular cells ({@link addSkinNumber}) and
* lines up down a list. Other text is drawn as it is.
*/
export function addSynesthesiaText(
layer: Container,
text: string,
x: number,
y: number,
options: SkinTextOptions = {},
): Container {
return options.fontFamily === SYN_DISPLAY_FONT && DIGIT.test(text)
? addSkinNumber(layer, text, x, y, options)
: addSkinText(layer, text, x, y, { ...options, squeezeShortOverflow: true });
}
export function addSynesthesiaHUDText(
layer: Container,
text: string,
x: number,
y: number,
options: HUDTextOptions = {},
pool?: ChildPool,
): Text {
return addHUDText(layer, text, x, y, { ...options, squeezeShortOverflow: true }, pool);
}
|