display: add a dfont_default() function to get the default font

This commit is contained in:
Lephe 2021-02-28 22:27:12 +01:00
parent bd40a0a41c
commit 97ca5ba82f
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 12 additions and 3 deletions

View file

@ -229,9 +229,6 @@ typedef struct
dtext_opt(), dtext() and the related functions. If the specified font is dtext_opt(), dtext() and the related functions. If the specified font is
NULL, gint's default font is used instead. NULL, gint's default font is used instead.
On fx-9860G, the default font is a 5x7 font very close to the system's.
On fx-CG 50, the default font is an original, proportional 8x9 font.
This function returns the previously configured font. Normally you want to This function returns the previously configured font. Normally you want to
restore it after you're done so as to not affect ambiant calls to text restore it after you're done so as to not affect ambiant calls to text
rendering functions. It would look like this: rendering functions. It would look like this:
@ -244,6 +241,12 @@ typedef struct
Returns the previously configured font. */ Returns the previously configured font. */
font_t const *dfont(font_t const *font); font_t const *dfont(font_t const *font);
/* dfont_default(): Get gint's default font
On fx-9860G, the default font is a 5x7 font very close to the system's.
On fx-CG 50, the default font is an original, proportional 8x9 font. */
font_t const *dfont_default(void);
/* dsize(): Get the width and height of rendered text /* dsize(): Get the width and height of rendered text
This function computes the size that the given string would take up if This function computes the size that the given string would take up if

View file

@ -12,6 +12,12 @@ font_t const *dfont(font_t const * font)
return old_font; return old_font;
} }
/* dfont_default(): Get gint's default font */
font_t const *dfont_default(void)
{
return gint_default_font;
}
/* topti_glyph_index(): Obtain the glyph index of a Unicode code point */ /* topti_glyph_index(): Obtain the glyph index of a Unicode code point */
int topti_glyph_index(font_t const *f, uint32_t code_point) int topti_glyph_index(font_t const *f, uint32_t code_point)
{ {