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.
|
Manages fonts used in GFX Draw. More...
Go to the source code of this file.
Macros | |
#define | DEFAULT_FONT_SIZE 15 |
#define | DEFAULT_FONT "IBMPlexSans-Medium.ttf" |
#define | FONTS_DIRECTORY "/../resources/fonts/" |
#define | FONTS_DIR "/" FONTS_DIRECTORY "/" |
#define | MAX_FONT_NAME_LENGTH 256 |
Typedefs | |
typedef void * | font_handle_t |
Handle used to reference a specific font/size configuration when restoring a font using gfxFontSelectFontFromHandle(), current font can be retrieved using gfxFontGetCurFontHandle(). More... | |
Functions | |
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 resources/fonts More... | |
int | gfxFontInit (char *path) |
Initializes the font backend, the executing binary path is required, this is usually already passed to gfx_Draw init and subsequently to gfxFontInit. More... | |
void | gfxFontExit (void) |
Exits the font backend. More... | |
TTF_Font * | gfxFontGetCurFont (void) |
Retrieved a reference to the current SDL2 TTF font, increasing the reference count of the respective gfx_font object. Objects can not be free'd until all references have been put, this for each call to gfxFontGetCurFont() a call to gfxFontPutFont() must be made, passing in the SDL2 TTF font reference returned from this function. More... | |
void | gfxFontPutFont (const TTF_Font *font) |
Finds the gfx_font object associated with the loaded SDL2 TFF font, decreasing the reference count to the object with each call, once an object's reference count has reached zero and the font backed has flagged the gfx_font object as no longer being needed it is then free'd. More... | |
void | gfxFontPutFontHandle (font_handle_t font) |
Finds the gfx_font object associated with the loaded SDL2 TFF font, decreasing the reference count to the object with each call, once an object's reference count has reached zero and the font backed has flagged the gfx_font object as no longer being needed it is then free'd. More... | |
font_handle_t | gfxFontGetCurFontHandle (void) |
Retrieved a handle to the current font, unlike gfxFontGetCurFont() the handle contains the gfx_Font's metadata structure for the font instance where as gfxFontGetCurFont() returns a SDL2 TTF Font reference. More... | |
ssize_t | gfxFontGetCurFontSize (void) |
Returns the size of the currently active font. More... | |
char * | gfxFontGetCurFontName (void) |
Retrieved the string name of the currently active font. More... | |
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 the font's name within the FONT_DIRECTORY directory. The font is only able to be made active if it was firstly loaded using gfxFontLoadFont(). More... | |
int | gfxFontSelectFontFromHandle (font_handle_t font_handle) |
Sets the active font based off of a font handle. More... | |
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 the current font's configuration (font + size) is being referenced by pending draw jobs. All subsequent text draw jobs will use the currently active font and the specified size until the size and/or font are changed again. More... | |
Manages fonts used in GFX Draw.
---------------------------------------------------------------------- Copyright (C) Alexander Hoffman, 2020 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------