From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.

The Font struct contains functions and data related to the use of fonts in ZScript.



Static methods require the Font. prefix.

  • int FindFontColor(Name color)
Retrieves a font color. The argument color must be a color name defined in the TEXTCOLO lump.
  • Font FindFont(Name fontname)
Returns a pointer to a font.
  • Font GetFont(Name fontname)
(Need more info)


Dynamic methods must be called on a font-type pointer.

  • int GetCharWidth(int code)
Returns the width of the provided character in the given font.
  • int StringWidth(String code)
Returns the width of the provided string in the given font in pixels.
code: a text string.
  • int GetMaxAscender(String code)
  • bool CanPrint(String code)
Returns true if the provided string can be printed in the given font.
  • int GetHeight()
Returns the height of the given font in pixels.
  • int GetDisplacement()
(Need more info)
  • String GetCursor()
Returns the character used as a cursor in the given font (see FONTDEFS).
  • double GetBottomAlignOffset(int code)
(Need more info)
  • double GetDisplayTopOffset(int code)
(Need more info)
  • BrokenLines BreakLines(String text, int maxlen)
Breaks the given string into multiple lines (according to the maximum length provided with maxlen), puts them in an instance of a BrokenLines class and returns a pointer to that instance.
BrokenLines methods Count(), StringWidth(int line) and StringAt(int line) can be used to interact with the text.
  • int GetGlyphHeight(int code)
(Need more info)
  • int GetDefaultKerning()
(Need more info)