mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-08 18:25:13 +00:00
Reimplemented the _FREEFONT command
A new function has been added to parts/video/fonts/ttf/src.c, FontFree(). This takes an index into the fonts array, and calls FT_Done_Face() on the handle, free() on the ttf_data then sets in_use to 0. The sub__freefont() function calls FontFree(), and sets the appropriate font[] element to NULL (after checking the passed font handle is valid, of course.
This commit is contained in:
parent
5158950119
commit
160624a2b5
|
@ -20890,8 +20890,8 @@ int32 func__printwidth(qbs* text, int32 screenhandle, int32 passed){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//remove font
|
//remove font
|
||||||
//NO_S_D_L//TTF_CloseFont(font[f]);
|
FontFree(font[f]);
|
||||||
//NO_S_D_L//font[f]=NULL;
|
font[f]=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub__printmode(int32 mode,int32 i,int32 passed){
|
void sub__printmode(int32 mode,int32 i,int32 passed){
|
||||||
|
|
|
@ -13,6 +13,7 @@ int32 FontLoad (uint8 *content_original,int32 content_bytes,int32 default_pixel_
|
||||||
int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
|
int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
|
||||||
uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){return NULL;}
|
uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){return NULL;}
|
||||||
int32 FontWidth(int32 i){return NULL;}
|
int32 FontWidth(int32 i){return NULL;}
|
||||||
|
void FontFree(int32 i){return;}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
|
@ -297,6 +298,12 @@ return i;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FontFree(int32 i) {
|
||||||
|
FT_Done_Face(fonts[i].handle);
|
||||||
|
free(fonts[i].ttf_data);
|
||||||
|
fonts[i].in_use = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
|
int32 FontRenderTextASCII(int32 i,uint8*codepoint,int32 codepoints,int32 options,
|
||||||
uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){
|
uint8**out_data,int32*out_x,int32 *out_y,int32*out_x_pre_increment,int32*out_x_post_increment){
|
||||||
static uint32 *utf32_codepoint;
|
static uint32 *utf32_codepoint;
|
||||||
|
|
Loading…
Reference in a new issue