Type Alias BpxGlyph

BpxGlyph: {
    advance: number;
    isTextColor: ((color: BpxRgbColor | null) => boolean);
    kerning?: BpxKerningPrevSegmentMap;
    offset?: BpxVector2d;
    sprite: BpxSprite;
    type: "sprite";
} | {
    advance: number;
    kerning?: BpxKerningPrevSegmentMap;
    offset?: BpxVector2d;
    pixels: BpxPixels;
    type: "pixels";
} | {
    advance: number;
    kerning?: BpxKerningPrevSegmentMap;
    type: "whitespace";
}

A definition of a glyph used by a font. Used as values in BpxFontConfig.glyphs.

Type declaration

  • advance: number

    How much to move the text drawing cursor to the right after drawing this glyph. Measured from the left edge of the glyph.

  • isTextColor: ((color: BpxRgbColor | null) => boolean)

    A function used to distinguish text from its background on a sprite sheet.

      • (color): boolean
      • Parameters

        Returns boolean

  • Optionalkerning?: BpxKerningPrevSegmentMap

    The map of how much to adjust the vertical placement of this glyph if the previous text segment (char) was one of the keys in this map.

  • Optionaloffset?: BpxVector2d

    The relative position of the glyph to be drawn in relation to the current cursor position.

  • sprite: BpxSprite

    A sprite to be drawn for this glyph.

  • type: "sprite"

    A property used in checking which type of a glyph it is, so TypeScript can infer its properties correctly.

Type declaration

  • advance: number

    How much to move the text drawing cursor to the right after drawing this glyph. Measured from the left edge of the glyph.

  • Optionalkerning?: BpxKerningPrevSegmentMap

    The map of how much to adjust the vertical placement of this glyph if the previous text segment (char) was one of the keys in this map.

  • Optionaloffset?: BpxVector2d

    The relative position of the glyph to be drawn in relation to the current cursor position.

  • pixels: BpxPixels

    A sprite to be drawn for this glyph, represented by 1-bit representation in the game code.

  • type: "pixels"

    A property used in checking which type of a glyph it is, so TypeScript can infer its properties correctly.

Type declaration

  • advance: number

    How much to move the text drawing cursor to the right after processing this glyph. Measured from the left edge of the glyph.

  • Optionalkerning?: BpxKerningPrevSegmentMap

    The map of how much to adjust the vertical placement of this glyph if the previous text segment (char) was one of the keys in this map.

  • type: "whitespace"

    A property used in checking which type of a glyph it is, so TypeScript can infer its properties correctly.