Module ui.font

Font module.

Functions

Font:getFace (font, size, faceindex) Gets font face object.
Font:getAdjustedFace (provided, bold) Returns an alternative face instance to be used for measuring and drawing (in most cases, the one provided untouched)

If 'bold' is true, or if 'face' is a real bold face, we may need to use an alternative instance of the font, with possibly the associated real bold font, and/or with tweaks so fallback fonts are rendered bold too, without affecting the regular 'face'.

Tables

FontFaceObj Freetype font face wrapper object


Functions

Font:getFace (font, size, faceindex)
Gets font face object.

Parameters:

  • font string
  • size integer optional size
  • faceindex integer optional index of font face in font file

Returns:

    table FontFaceObj
Font:getAdjustedFace (provided, bold)
Returns an alternative face instance to be used for measuring and drawing (in most cases, the one provided untouched)

If 'bold' is true, or if 'face' is a real bold face, we may need to use an alternative instance of the font, with possibly the associated real bold font, and/or with tweaks so fallback fonts are rendered bold too, without affecting the regular 'face'. (This function should only be used by TextWidget and TextBoxWidget. Other widgets should not use it, and neither _getFallbackFont() which will do its own processing.)

Parameters:

Returns:

  1. ui.font.FontFaceObj face face to use for drawing
  2. bool bold adjusted bold properties

Tables

FontFaceObj
Freetype font face wrapper object

Fields:

  • orig_font font name requested
  • size size of the font face (after scaled by screen size)
  • orig_size raw size of the font face (before scale)
  • ftsize font size object from freetype
  • hash hash key for this font face
generated by LDoc 1.5.0 Last updated 2024-03-18 16:45:36