SDL_ttf: Add TTF_GetFontScalable to distinguish bitmap vs outline fonts (#268)

From 1659723b95254600ba044964c8e23fd3db4b9bfd Mon Sep 17 00:00:00 2001
From: Dan Lawrence <[EMAIL REDACTED]>
Date: Sat, 11 Mar 2023 23:01:34 +0000
Subject: [PATCH] Add TTF_GetFontScalable to distinguish bitmap vs outline
 fonts (#268)

closes #169
---
 SDL_ttf.c              |  9 +++++++++
 include/SDL3/SDL_ttf.h | 15 +++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/SDL_ttf.c b/SDL_ttf.c
index b9ceb60..6c313a5 100644
--- a/SDL_ttf.c
+++ b/SDL_ttf.c
@@ -4248,4 +4248,13 @@ int TTF_GetFontKerningSizeGlyphs32(TTF_Font *font, Uint32 previous_ch, Uint32 ch
     return (int)(delta.x >> 6);
 }
 
+SDL_bool TTF_IsFontScalable(const TTF_Font *font)
+{
+    TTF_CHECK_POINTER(font, SDL_FALSE);
+    if (FT_IS_SCALABLE(font->face)) {
+        return SDL_TRUE;
+    }
+    return SDL_FALSE;
+}
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/include/SDL3/SDL_ttf.h b/include/SDL3/SDL_ttf.h
index aa88c0a..60fe252 100644
--- a/include/SDL3/SDL_ttf.h
+++ b/include/SDL3/SDL_ttf.h
@@ -2311,6 +2311,21 @@ extern DECLSPEC int SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction d
  */
 extern DECLSPEC int SDLCALL TTF_SetFontScriptName(TTF_Font *font, const char *script);
 
+/**
+ * Query whether a font is scalable or not.
+ *
+ * Scalability lets us distinguish between outline and bitmap fonts.
+ *
+ * \param font the font to query
+ *
+ * \returns SDL_TRUE if the font is scalable, SDL_FALSE otherwise.
+ *
+ * \since This function is available since SDL_ttf 2.21.0.
+ *
+ * \sa TTF_SetFontSDF
+ */
+extern DECLSPEC SDL_bool TTF_IsFontScalable(const TTF_Font *font);
+
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
 }