6 /// default (built-in) font id
7 #define FNT_DEFAULT (0)
8 /// Value returned on errors
11 /** Initializes the font subsystem */
14 /** Terminates the font subsystem */
17 /** Loads a font from a file path
18 * @param path The path to the font file
19 * @return font slot id (negative value means error happened) */
20 int fntLoadFile(char* path
);
22 /** Reloads the default font */
23 void fntLoadDefault(char* path
);
25 /** Releases a font slot */
26 void fntRelease(int id
);
28 /** Sets a new aspect ratio
29 * @note Invalidates the whole glyph cache for all fonts! */
30 void fntSetAspectRatio(float aw
, float ah
);
32 /** Renders a text with specified window dimensions */
33 int fntRenderString(int id
, int x
, int y
, short aligned
, size_t width
, size_t height
, const unsigned char* string
, u64 colour
);
35 /** replaces spaces with newlines so that the text fits into the specified width.
36 * @note A destrutive operation - modifies the given string!
38 void fntFitString(int id
, unsigned char *string
, size_t width
);
40 /** Calculates the width of the given text string
41 * We can't use the height for alignment, as the horizontal center would depends of the contained text itself */
42 int fntCalcDimensions(int id
, const unsigned char* str
);