Class representing font used in the UI.

Constructors

  • Constructs new instance of the font with specified parameters.

    Parameters

    • color: number

      font color, android integer color value (produced by android.graphics.Color)

    • size: number

      font size

    • shadow: number

      shadow offset

    Returns Font

  • Constructs new instance of the font with specified parameters.

    Parameters

    Returns Font

Methods

  • Draws text on the canvas using created font.

    Parameters

    • canvas: Canvas

      android.graphics.Canvas instance to draw the text on

    • x: number

      x coordinate of the text in pixels

    • y: number

      x coordinate of the text in pixels

    • text: string

      text string to draw

    • scale: number

      additional scale to apply to the text

    Returns void

  • Calculates bounds of the text given text position, text string and additional scale.

    Parameters

    • text: string
    • x: number
    • y: number
    • scale: number

    Returns Rect

    rect object containing calculated bounds of the text

  • Calculates text height given text string and additional scale.

    Parameters

    • text: string
    • x: number
    • y: number
    • scale: number

    Returns number

    height of the specified string when painted with specified scale

  • Calculates text width given text string and additional scale.

    Parameters

    • text: string
    • scale: number

    Returns number

    width of the specified string when painted with specified scale

Properties

alignment: number
color: number
isBold: boolean
isCursive: boolean
isUnderlined: boolean
shadow: number
size: number
ALIGN_CENTER: number

Aligns text to the start of the element (left for English locale).

ALIGN_CENTER_HORIZONTAL: number

Aligns text to the center of the element horizontally.

2.2.1b96

ALIGN_DEFAULT: number

Aligns text to the center of the element.

ALIGN_END: number

Aligns text to the end of the element (right for English locale).

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.