Skip to content

Commit

Permalink
Removed TTF_PROP_FONT_FACE_POINTER
Browse files Browse the repository at this point in the history
There's no guarantee that the version of FreeType linked with SDL_ttf is compatible with the version linked with the application. We'll have to explicitly add APIs for anything we expose from the font.

Maybe we should add TTF_FontInfo that takes a font file and face index as a parameter?
  • Loading branch information
slouken committed Oct 9, 2024
1 parent 3029cd2 commit 2d54640
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 0 additions & 6 deletions include/SDL3_ttf/SDL_ttf.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontWithProperties(SDL_Properties
/**
* Get the properties associated with a font.
*
* The following read-only properties are provided by SDL:
*
* - `TTF_PROP_FONT_FACE_POINTER`: the FT_Face associated with the font.
*
* \param font the font to query.
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.
Expand All @@ -248,8 +244,6 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontWithProperties(SDL_Properties
*/
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL TTF_GetFontProperties(TTF_Font *font);

#define TTF_PROP_FONT_FACE_POINTER "SDL_ttf.font.face"

/**
* Get the font generation.
*
Expand Down
10 changes: 3 additions & 7 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1953,13 +1953,6 @@ TTF_Font *TTF_OpenFontWithProperties(SDL_PropertiesID props)
}
face = font->face;

font->props = SDL_CreateProperties();
if (!font->props) {
TTF_CloseFont(font);
return NULL;
}
SDL_SetPointerProperty(font->props, TTF_PROP_FONT_FACE_POINTER, face);

// Set charmap for loaded font
found = 0;
#if 0 // Font debug code
Expand Down Expand Up @@ -2090,6 +2083,9 @@ SDL_PropertiesID TTF_GetFontProperties(TTF_Font *font)
{
TTF_CHECK_FONT(font, 0);

if (!font->props) {
font->props = SDL_CreateProperties();
}
return font->props;
}

Expand Down

0 comments on commit 2d54640

Please sign in to comment.