* fix for theme font handling (when switching back to the default theme, the language...
[open-ps2-loader.git] / include / fntsys.h
blobb24aa8e36be4d6083abaff623ae116cb10450602
1 #ifndef __FNTSYS_H
2 #define __FNTSYS_H
4 #include <gsToolkit.h>
6 /// default (built-in) font id
7 #define FNT_DEFAULT (0)
8 /// Value returned on errors
9 #define FNT_ERROR (-1)
11 /** Initializes the font subsystem */
12 void fntInit();
14 /** Terminates the font subsystem */
15 void fntEnd();
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);
44 #endif