From 2d5464086de17e353339812f7e1660bfac97939c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 9 Oct 2024 09:56:46 -0700
Subject: [PATCH] Removed TTF_PROP_FONT_FACE_POINTER
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?
---
include/SDL3_ttf/SDL_ttf.h | 6 ------
src/SDL_ttf.c | 10 +++-------
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/include/SDL3_ttf/SDL_ttf.h b/include/SDL3_ttf/SDL_ttf.h
index bcb93b9d..a4b81f31 100644
--- a/include/SDL3_ttf/SDL_ttf.h
+++ b/include/SDL3_ttf/SDL_ttf.h
@@ -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.
@@ -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.
*
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index 59a45d05..950a666e 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -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
@@ -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;
}