9#define FONT_COLOUR_CODE '#'
11#define FONT_FLAG_DONTREUSE \
17typedef struct glFont_s {
28typedef struct glFontRestore_s {
44typedef struct glPrintLineIterator_s {
64 const char *prefix,
unsigned int flags );
66int gl_fontAddFallbackFont(
glFont *font,
const glFont *f );
74 const glColour *
c,
const double outlineR,
const char *text );
76 const double outlineR,
const char *text );
78 const double y,
const glColour *
c,
const double outlineR,
81 const double y,
const glColour *
c,
const double outlineR,
84 double bx,
double by,
int line_height,
const glColour *
c,
85 const double outlineR,
const char *text );
87 const glColour *
c,
const char *text );
94void
gl_print( const
glFont *ft_font,
double x,
double y, const glColour *
c,
95 const
char *fmt, ... );
99 const glColour *
c, const
char *fmt, ... );
103 const glColour *
c, const
char *fmt, ... );
107 double by,
int line_height, const glColour *
c,
108 const
char *fmt, ... );
112 const
char *text,
int width );
123int gl_printEnd(
int *x,
int *y, const
glFont *ft_font,
int width,
124 const
char *fmt, ... );
int gl_printHeightRaw(const glFont *ft_font, const int width, const char *text)
Gets the height of a non-formatted string.
int gl_printLines(const glFont *ft_font, const int width, const char *fmt,...)
Gets the number of lines of the text if it were printed.
void gl_printRestoreClear(void)
Clears the restoration.
void gl_printRestoreInit(glFontRestore *restore)
Initializes a restore structure.
int gl_printLineIteratorNext(glPrintLineIterator *iter)
Updates iter with the next line's information.
void gl_printRaw(const glFont *ft_font, double x, double y, const glColour *c, double outlineR, const char *text)
Prints text on screen.
int gl_printHeight(const glFont *ft_font, const int width, const char *fmt,...)
Gets the height of the text if it were printed.
int gl_printWidthRaw(const glFont *ft_font, const char *text)
Gets the width that it would take to print some text.
int gl_printMidRaw(const glFont *ft_font, int width, double x, double y, const glColour *c, double outlineR, const char *text)
Displays text centered in position and width.
void gl_print(const glFont *ft_font, const double x, const double y, const glColour *c, const char *fmt,...)
Prints text on screen like printf.
int gl_fontAddFallback(glFont *font, const char *fname, const char *prefix)
Adds a fallback font to a font.
int gl_printTextRaw(const glFont *ft_font, const int width, const int height, double bx, double by, int line_height, const glColour *c, double outlineR, const char *text)
Prints a block of text that fits in the dimensions given.
void gl_freeFont(glFont *font)
Frees a loaded font. Caution: its glFontStash still has a slot in avail_fonts. At the time of writing...
void gl_printRawH(const glFont *ft_font, const mat4 *H, const glColour *c, const double outlineR, const char *text)
Prints text on screen using a transformation matrix.
int gl_printText(const glFont *ft_font, const int width, const int height, double bx, double by, int line_height, const glColour *c, const char *fmt,...)
Prints a block of text that fits in the dimensions given.
void gl_printRestore(const glFontRestore *restore)
Restores last colour from a restore structure.
int gl_printMax(const glFont *ft_font, const int max, double x, double y, const glColour *c, const char *fmt,...)
Behaves like gl_print but stops displaying text after reaching a certain length.
int gl_printLinesRaw(const glFont *ft_font, const int width, const char *text)
Gets the number of lines of a non-formatted string.
void gl_printLineIteratorInit(glPrintLineIterator *iter, const glFont *ft_font, const char *text, int width)
Initialize an iterator object for breaking text into lines.
int gl_printMaxRaw(const glFont *ft_font, const int max, double x, double y, const glColour *c, double outlineR, const char *text)
Behaves like gl_printRaw but stops displaying text after a certain distance.
int gl_fontInit(glFont *font, const char *fname, const unsigned int h, const char *prefix, unsigned int flags)
Initializes a font.
void gl_fontExit(void)
Frees all resources associated with the font system. This also resets font ID tracking,...
void gl_printStoreMax(glFontRestore *restore, const char *text, int max)
Stores the colour information from a piece of text limited to max characters.
void gl_printStore(glFontRestore *restore, const char *text)
Stores the colour information from a piece of text.
int gl_printMid(const glFont *ft_font, const int width, double x, double y, const glColour *c, const char *fmt,...)
Displays text centered in position and width.
void gl_printRestoreLast(void)
Restores last colour.
void gl_fontSetFilter(const glFont *ft_font, GLint min, GLint mag)
Sets the minification and magnification filters for a font.
void gl_printMarkerRaw(const glFont *ft_font, double x, double y, const glColour *c, const char *text)
Wrapper for gl_printRaw for map overlay markers.
int gl_printWidth(const glFont *ft_font, const char *fmt,...)
Gets the width that it would take to print some text.
int gl_printEndRaw(int *xo, int *yo, const glFont *ft_font, int width, const char *text)
Gets the position at which text would end writing.
Evil hack to allow restoring, yes it makes me cry myself to sleep.
Represents a font in memory.
The state of a line iteration. This matches the process of rendering text into an on-screen box: An e...