zscript-doc/api/drawing/Font.md

62 lines
1.2 KiB
Markdown
Raw Normal View History

2018-12-29 16:05:19 -08:00
# Font
A font as defined in `FONTDEFS` or a bitmap font file. **Not serializable. Do
not use as a member unless marked as `transient`.**
2018-12-29 16:05:19 -08:00
```
struct Font
{
static Font FindFont(name fontname);
static int FindFontColor(name color);
static Font GetFont(name fontname);
2018-12-29 20:04:32 -08:00
double GetBottomAlignOffset(int code);
2018-12-29 16:05:19 -08:00
int GetCharWidth(int code);
string GetCursor();
int GetHeight();
int StringWidth(string code);
BrokenLines BreakLines(string text, int maxlen);
}
```
2019-08-14 03:31:41 -07:00
### `FindFont`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Gets a font as defined in `FONTDEFS`.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `FindFontColor`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the color range enumeration for a named color.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetFont`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Gets a font either as defined in `FONTDEFS` or a ZDoom/bitmap font.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetBottomAlignOffset`
2018-12-29 20:04:32 -08:00
2019-08-14 03:31:41 -07:00
Returns the baseline for the character `code`.
2018-12-29 20:04:32 -08:00
2019-08-14 03:31:41 -07:00
### `GetCharWidth`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the width in pixels of a character code.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetCursor`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the string used as a blinking cursor graphic for this font.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `GetHeight`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the line height of the font.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `StringWidth`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Returns the width in pixels of the string.
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
### `BreakLines`
2018-12-29 16:05:19 -08:00
2019-08-14 03:31:41 -07:00
Breaks `text` up into a `BrokenLines` structure according to the screen and
clip region, as well as appropriately accounting for a maximum width in pixels
of `maxlen`.
2018-12-29 16:05:19 -08:00
<!-- EOF -->