FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
gfx_font.h
Go to the documentation of this file.
1 
25 #ifndef __GFX_FONT_H__
26 #define __GFX_FONT_H__
27 
28 #include <SDL2/SDL_ttf.h>
29 
30 #include "EmulatorConfig.h"
31 
48 #ifndef DEFAULT_FONT_SIZE
49 #define DEFAULT_FONT_SIZE 15
50 #endif //DEFAULT_FONT_SIZE
51 
55 #ifndef DEFAULT_FONT
56 #define DEFAULT_FONT "IBMPlexSans-Medium.ttf"
57 #endif //DEFAULT_FONT
58 
62 #ifndef FONTS_DIRECTORY
63 #ifdef RESOURCES_DIRECTORY
64 #define FONTS_DIRECTORY "/" RESOURCES_DIRECTORY "/fonts/"
65 #else
66 #define FONTS_DIRECTORY "/../resources/fonts/"
67 #endif //RESOURCES_DIRECTORY
68 #endif // FONTS_DIRECTORY
69 
70 #define FONTS_DIR "/" FONTS_DIRECTORY "/"
71 
75 #define MAX_FONT_NAME_LENGTH 256
76 
82 typedef void *font_handle_t;
83 
94 int gfxFontLoadFont(char *font_name, ssize_t size);
95 
104 int gfxFontInit(char *path);
105 
110 void gfxFontExit(void);
111 
122 TTF_Font *gfxFontGetCurFont(void);
123 
132 void gfxFontPutFont(const TTF_Font *font);
133 
143 
152 
158 ssize_t gfxFontGetCurFontSize(void);
159 
166 char *gfxFontGetCurFontName(void);
167 
177 int gfxFontSelectFontFromName(char *font_name);
178 
186 
197 int gfxFontSetSize(ssize_t font_size);
198 
200 #endif // __GFX_FONT_H__
Config file for the FreeRTOS Emulator.
void gfxFontPutFontHandle(font_handle_t font)
Finds the gfx_font object associated with the loaded SDL2 TFF font, decreasing the reference count to...
Definition: gfx_font.c:149
char * gfxFontGetCurFontName(void)
Retrieved the string name of the currently active font.
Definition: gfx_font.c:229
font_handle_t gfxFontGetCurFontHandle(void)
Retrieved a handle to the current font, unlike gfxFontGetCurFont() the handle contains the gfx_Font's...
Definition: gfx_font.c:237
void gfxFontPutFont(const TTF_Font *font)
Finds the gfx_font object associated with the loaded SDL2 TFF font, decreasing the reference count to...
Definition: gfx_font.c:178
int gfxFontLoadFont(char *font_name, ssize_t size)
Loads a font with the given font name from the FONTS_DIRECTORY directory, by default this is in resou...
Definition: gfx_font.c:261
TTF_Font * gfxFontGetCurFont(void)
Retrieved a reference to the current SDL2 TTF font, increasing the reference count of the respective ...
Definition: gfx_font.c:207
int gfxFontSelectFontFromName(char *font_name)
Sets the active font from a string of the font's filename. The filename is not the absolute file but ...
Definition: gfx_font.c:277
int gfxFontSetSize(ssize_t font_size)
Sets the size of the current font to be used. The font is set by making a copy of the current font if...
Definition: gfx_font.c:312
ssize_t gfxFontGetCurFontSize(void)
Returns the size of the currently active font.
Definition: gfx_font.c:221
int gfxFontSelectFontFromHandle(font_handle_t font_handle)
Sets the active font based off of a font handle.
Definition: gfx_font.c:295
void gfxFontExit(void)
Exits the font backend.
Definition: gfx_font.c:133
void * font_handle_t
Handle used to reference a specific font/size configuration when restoring a font using gfxFontSelect...
Definition: gfx_font.h:82
int gfxFontInit(char *path)
Initializes the font backend, the executing binary path is required, this is usually already passed t...
Definition: gfx_font.c:111