Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Font

Container for the 172 font characters of the COLORF.FNT file.

Hierarchy

  • Font

Index

Methods

getChar

  • Returns the font character image with the given index.

    Parameters

    • index: number

      The index of the font character.

    Returns FontChar

    The font character image.

getChars

  • Returns array with all font character images.

    Returns FontChar[]

    The font character images.

getNumChars

  • getNumChars(): number
  • Returns the number of characters.

    Returns number

    The number of characters.

toCanvas

  • toCanvas(): HTMLCanvasElement
  • Creates and returns a new canvas containing all characters of the font. 16 characters per row.

    Returns HTMLCanvasElement

    The created canvas.

toDataUrl

  • toDataUrl(type?: undefined | string, ...args: any[]): string
  • Creates and returns a font image data URL. 16 font characters per row.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns string

    The created data URL.

toImage

  • toImage(type?: undefined | string, ...args: any[]): HTMLImageElement
  • Creates and returns a HTML image of the font. 16 font characters per row.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns HTMLImageElement

    The created HTML image.

Static fromArray

  • fromArray(array: Uint8Array): Font
  • Parses a font from the given array and returns it.

    Parameters

    • array: Uint8Array

    Returns Font

    The parsed font.

Static fromBlob

  • fromBlob(blob: Blob): Promise<Font>
  • Reads the color font from the given blob and returns it.

    Parameters

    • blob: Blob

      The COLORF.FNT blob to read.

    Returns Promise<Font>

    The read font.

Generated using TypeDoc