From 205290043e82bd19b9c50514787c65d574724d4f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 27 Jan 2025 16:11:13 -0800 Subject: [PATCH] Re-added TTF_GetNumFontFaces() to the API Closes https://github.com/libsdl-org/SDL_ttf/pull/466 --- build-scripts/SDL_migration.cocci | 5 +++++ docs/README-migration.md | 3 +-- include/SDL3_ttf/SDL_ttf.h | 12 ++++++++++++ src/SDL_ttf.sym | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 2d75ba16..a4ab7eec 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -132,6 +132,11 @@ (...) @@ @@ +- TTF_FontFaces ++ TTF_GetNumFontFaces + (...) +@@ +@@ - TTF_FontFaceIsFixedWidth + TTF_FontIsFixedWidth (...) diff --git a/docs/README-migration.md b/docs/README-migration.md index be2903a9..dc449243 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -44,6 +44,7 @@ The following functions have been renamed: * TTF_FontFaceFamilyName() => TTF_GetFontFamilyName() * TTF_FontFaceIsFixedWidth() => TTF_FontIsFixedWidth() * TTF_FontFaceStyleName() => TTF_GetFontStyleName() +* TTF_FontFaces() => TTF_GetNumFontFaces() * TTF_FontHeight() => TTF_GetFontHeight() * TTF_FontLineSkip() => TTF_GetFontLineSkip() * TTF_GetFontWrappedAlign() => TTF_GetFontWrapAlignment() @@ -71,7 +72,6 @@ The following functions have been renamed: The following functions have been removed: * TTF_ByteSwappedUNICODE() -* TTF_FontFaces() - can be retrieved from the font FT_Face, available in TTF_PROP_FONT_FACE_POINTER * TTF_GetFontKerningSizeGlyphs() - replaced with TTF_GetGlyphKerning() * TTF_GetFontKerningSizeGlyphs32() - replaced with TTF_GetGlyphKerning() * TTF_MeasureText() - replaced with TTF_MeasureString() @@ -95,7 +95,6 @@ The following functions have been removed: * TTF_RenderUNICODE_Solid() * TTF_RenderUNICODE_Solid_Wrapped() * TTF_SizeUNICODE() - The following symbols have been renamed: * TTF_WRAPPED_ALIGN_CENTER => TTF_HORIZONTAL_ALIGN_CENTER * TTF_WRAPPED_ALIGN_LEFT => TTF_HORIZONTAL_ALIGN_LEFT diff --git a/include/SDL3_ttf/SDL_ttf.h b/include/SDL3_ttf/SDL_ttf.h index 5501b4bb..d5a82f89 100644 --- a/include/SDL3_ttf/SDL_ttf.h +++ b/include/SDL3_ttf/SDL_ttf.h @@ -564,6 +564,18 @@ typedef enum TTF_HintingFlags */ extern SDL_DECLSPEC void SDLCALL TTF_SetFontHinting(TTF_Font *font, TTF_HintingFlags hinting); +/** + * Query the number of faces of a font. + * + * \param font the font to query. + * \returns the number of FreeType font faces. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL_ttf 3.0.0. + */ +extern SDL_DECLSPEC int SDLCALL TTF_GetNumFontFaces(const TTF_Font *font); + /** * Query a font's current FreeType hinter setting. * diff --git a/src/SDL_ttf.sym b/src/SDL_ttf.sym index f79e51a6..bfe5fae3 100644 --- a/src/SDL_ttf.sym +++ b/src/SDL_ttf.sym @@ -46,6 +46,7 @@ SDL3_ttf_0.0.0 { TTF_GetGPUTextEngineWinding; TTF_GetHarfBuzzVersion; TTF_GetNextTextSubString; + TTF_GetNumFontFaces; TTF_GetPreviousTextSubString; TTF_GetStringSize; TTF_GetStringSizeWrapped;