From 67784516ac8efa5cea98158d86b5ea73d30baf5b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 18 Sep 2024 12:10:49 -0700
Subject: [PATCH] Updated to the latest version of SDL
---
external/SDL | 2 +-
include/SDL3_ttf/SDL_ttf.h | 116 +++++++++++++-------------
src/SDL_ttf.c | 166 ++++++++++++++++++-------------------
3 files changed, 142 insertions(+), 142 deletions(-)
diff --git a/external/SDL b/external/SDL
index 03ae792d..95c3ee77 160000
--- a/external/SDL
+++ b/external/SDL
@@ -1 +1 @@
-Subproject commit 03ae792df35a15e80e16a41ea2cf19971fc8d8f6
+Subproject commit 95c3ee77c101c60aab69663be2bc4eee3d4302b2
diff --git a/include/SDL3_ttf/SDL_ttf.h b/include/SDL3_ttf/SDL_ttf.h
index bce69162..750d84b2 100644
--- a/include/SDL3_ttf/SDL_ttf.h
+++ b/include/SDL3_ttf/SDL_ttf.h
@@ -118,7 +118,7 @@ extern SDL_DECLSPEC void SDLCALL TTF_GetHarfBuzzVersion(int *major, int *minor,
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(SDL_bool swapped);
+extern SDL_DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(bool swapped);
/**
* The internal structure containing font information.
@@ -141,14 +141,14 @@ typedef struct TTF_Font TTF_Font;
* calls, and decrements it on each call to TTF_Quit, so you must pair your
* init and quit calls.
*
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_Quit
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_Init(void);
+extern SDL_DECLSPEC bool SDLCALL TTF_Init(void);
/**
* Create a font from a file, using a specified point size.
@@ -200,14 +200,14 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int p
* size becomes the index of choosing which size. If the value is too high,
* the last indexed size will be the default.
*
- * If `closeio` is SDL_TRUE, `src` will be automatically closed once the font
+ * If `closeio` is true, `src` will be automatically closed once the font
* is closed. Otherwise you should close `src` yourself after closing the
* font.
*
* When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
*
* \param src an SDL_IOStream to provide a font file's data.
- * \param closeio SDL_TRUE to close `src` when the font is closed, SDL_FALSE
+ * \param closeio true to close `src` when the font is closed, false
* to leave it open.
* \param ptsize point size to use for the newly-opened font.
* \returns a valid TTF_Font, or NULL on error.
@@ -216,7 +216,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int p
*
* \sa TTF_CloseFont
*/
-extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, SDL_bool closeio, int ptsize);
+extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, bool closeio, int ptsize);
/**
* Create a font from an SDL_IOStream, using a specified face index.
@@ -225,7 +225,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, SDL_boo
* size becomes the index of choosing which size. If the value is too high,
* the last indexed size will be the default.
*
- * If `closeio` is SDL_TRUE `src` will be automatically closed once the font
+ * If `closeio` is true `src` will be automatically closed once the font
* is closed. Otherwise you should close `src` yourself after closing the
* font.
*
@@ -236,7 +236,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, SDL_boo
* When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
*
* \param src an SDL_IOStream to provide a font file's data.
- * \param closeio SDL_TRUE to close `src` when the font is closed, SDL_FALSE
+ * \param closeio true to close `src` when the font is closed, false
* to leave it open.
* \param ptsize point size to use for the newly-opened font.
* \param index index of the face in the font file.
@@ -246,7 +246,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIO(SDL_IOStream *src, SDL_boo
*
* \sa TTF_CloseFont
*/
-extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, long index);
+extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexIO(SDL_IOStream *src, bool closeio, int ptsize, long index);
/**
* Create a font from a file, using target resolutions (in DPI).
@@ -308,14 +308,14 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPI(const char *file, in
* size becomes the index of choosing which size. If the value is too high,
* the last indexed size will be the default.
*
- * If `closeio` is SDL_TRUE `src` will be automatically closed once the font
+ * If `closeio` is true `src` will be automatically closed once the font
* is closed. Otherwise you should close `src` yourself after closing the
* font.
*
* When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
*
* \param src an SDL_IOStream to provide a font file's data.
- * \param closeio SDL_TRUE to close `src` when the font is closed, SDL_FALSE
+ * \param closeio true to close `src` when the font is closed, false
* to leave it open.
* \param ptsize point size to use for the newly-opened font.
* \param hdpi the target horizontal DPI.
@@ -326,7 +326,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPI(const char *file, in
*
* \sa TTF_CloseFont
*/
-extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, unsigned int hdpi, unsigned int vdpi);
+extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIIO(SDL_IOStream *src, bool closeio, int ptsize, unsigned int hdpi, unsigned int vdpi);
/**
* Opens a font from an SDL_IOStream with target resolutions (in DPI).
@@ -337,7 +337,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIIO(SDL_IOStream *src, SDL_
* size becomes the index of choosing which size. If the value is too high,
* the last indexed size will be the default.
*
- * If `closeio` is SDL_TRUE `src` will be automatically closed once the font
+ * If `closeio` is true `src` will be automatically closed once the font
* is closed. Otherwise you should close `src` yourself after closing the
* font.
*
@@ -348,7 +348,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIIO(SDL_IOStream *src, SDL_
* When done with the returned TTF_Font, use TTF_CloseFont() to dispose of it.
*
* \param src an SDL_IOStream to provide a font file's data.
- * \param closeio SDL_TRUE to close `src` when the font is closed, SDL_FALSE
+ * \param closeio true to close `src` when the font is closed, false
* to leave it open.
* \param ptsize point size to use for the newly-opened font.
* \param index index of the face in the font file.
@@ -360,7 +360,7 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontDPIIO(SDL_IOStream *src, SDL_
*
* \sa TTF_CloseFont
*/
-extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPIIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
+extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPIIO(SDL_IOStream *src, bool closeio, int ptsize, long index, unsigned int hdpi, unsigned int vdpi);
/**
* Set a font's size dynamically.
@@ -369,12 +369,12 @@ extern SDL_DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexDPIIO(SDL_IOStream *src,
*
* \param font the font to resize.
* \param ptsize the new point size.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontSize(TTF_Font *font, int ptsize);
+extern SDL_DECLSPEC bool SDLCALL TTF_SetFontSize(TTF_Font *font, int ptsize);
/**
* Set font size dynamically with target resolutions (in DPI).
@@ -385,12 +385,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontSize(TTF_Font *font, int ptsize)
* \param ptsize the new point size.
* \param hdpi the target horizontal DPI.
* \param vdpi the target vertical DPI.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi);
+extern SDL_DECLSPEC bool SDLCALL TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi);
/**
* Font style flags
@@ -612,11 +612,11 @@ extern SDL_DECLSPEC int SDLCALL TTF_FontLineSkip(const TTF_Font *font);
* Query whether or not kerning is enabled for a font.
*
* \param font the font to query.
- * \returns SDL_TRUE if kerning is enabled, SDL_FALSE otherwise.
+ * \returns true if kerning is enabled, false otherwise.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GetFontKerning(const TTF_Font *font);
+extern SDL_DECLSPEC bool SDLCALL TTF_GetFontKerning(const TTF_Font *font);
/**
* Set if kerning is enabled for a font.
@@ -627,11 +627,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GetFontKerning(const TTF_Font *font);
* the word `kerning` as something that looks like `keming` for example).
*
* \param font the font to set kerning on.
- * \param enabled SDL_TRUE to enable kerning, SDL_FALSE to disable.
+ * \param enabled true to enable kerning, false to disable.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, SDL_bool enabled);
+extern SDL_DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, bool enabled);
/**
* Query the number of faces of a font.
@@ -653,11 +653,11 @@ extern SDL_DECLSPEC long SDLCALL TTF_FontFaces(const TTF_Font *font);
* are more likely to not be fixed-width in most cases.
*
* \param font the font to query.
- * \returns SDL_TRUE if fixed-width, SDL_FALSE if not.
+ * \returns true if fixed-width, false if not.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_FontFaceIsFixedWidth(const TTF_Font *font);
+extern SDL_DECLSPEC bool SDLCALL TTF_FontFaceIsFixedWidth(const TTF_Font *font);
/**
* Query a font's family name.
@@ -705,14 +705,14 @@ extern SDL_DECLSPEC const char * SDLCALL TTF_FontFaceStyleName(const TTF_Font *f
*
* \param font the font to query.
* \param ch the character code to check.
- * \returns SDL_TRUE if font provides a glyph for this character, SDL_FALSE if
+ * \returns true if font provides a glyph for this character, false if
* not.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_GlyphIsProvided32
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
+extern SDL_DECLSPEC bool SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16 ch);
/**
* Check whether a glyph is provided by the font for a 32-bit codepoint.
@@ -724,12 +724,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphIsProvided(TTF_Font *font, Uint16
*
* \param font the font to query.
* \param ch the character code to check.
- * \returns SDL_TRUE if font provides a glyph for this character, SDL_FALSE if
+ * \returns true if font provides a glyph for this character, false if
* not.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch);
+extern SDL_DECLSPEC bool SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint32 ch);
/**
* Query the metrics (dimensions) of a font's 16-bit glyph.
@@ -749,14 +749,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphIsProvided32(TTF_Font *font, Uint3
*
* \param font the font to query.
* \param ch the character code to check.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_GlyphMetrics32
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
+extern SDL_DECLSPEC bool SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);
@@ -774,12 +774,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
*
* \param font the font to query.
* \param ch the character code to check.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
+extern SDL_DECLSPEC bool SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);
@@ -800,7 +800,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 c
* \param text text to calculate, in Latin1 encoding.
* \param w will be filled with width, in pixels, on return.
* \param h will be filled with height, in pixels, on return.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
@@ -808,7 +808,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_GlyphMetrics32(TTF_Font *font, Uint32 c
* \sa TTF_SizeUTF8
* \sa TTF_SizeUNICODE
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
+extern SDL_DECLSPEC bool SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
/**
* Calculate the dimensions of a rendered string of UTF-8 text.
@@ -822,14 +822,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeText(TTF_Font *font, const char *te
* \param text text to calculate, in UTF-8 encoding.
* \param w will be filled with width, in pixels, on return.
* \param h will be filled with height, in pixels, on return.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_SizeUNICODE
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
+extern SDL_DECLSPEC bool SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
/**
* Calculate the dimensions of a rendered string of UCS-2 text.
@@ -848,14 +848,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *te
* \param text text to calculate, in UCS-2 encoding.
* \param w will be filled with width, in pixels, on return.
* \param h will be filled with height, in pixels, on return.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_SizeUTF8
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
+extern SDL_DECLSPEC bool SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
/**
* Calculate how much of a Latin1 string will fit in a given width.
@@ -876,7 +876,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint1
* \param extent on return, filled with latest calculated width.
* \param count on return, filled with number of characters that can be
* rendered.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
@@ -885,7 +885,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint1
* \sa TTF_MeasureUTF8
* \sa TTF_MeasureUNICODE
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureText(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
+extern SDL_DECLSPEC bool SDLCALL TTF_MeasureText(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
/**
* Calculate how much of a UTF-8 string will fit in a given width.
@@ -901,7 +901,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureText(TTF_Font *font, const char
* \param extent on return, filled with latest calculated width.
* \param count on return, filled with number of characters that can be
* rendered.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
@@ -910,7 +910,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureText(TTF_Font *font, const char
* \sa TTF_MeasureUTF8
* \sa TTF_MeasureUNICODE
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
+extern SDL_DECLSPEC bool SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char *text, int measure_width, int *extent, int *count);
/**
* Calculate how much of a UCS-2 string will fit in a given width.
@@ -931,7 +931,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char
* \param extent on return, filled with latest calculated width.
* \param count on return, filled with number of characters that can be
* rendered.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
@@ -940,7 +940,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureUTF8(TTF_Font *font, const char
* \sa TTF_MeasureUTF8
* \sa TTF_MeasureUNICODE
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_MeasureUNICODE(TTF_Font *font, const Uint16 *text, int measure_width, int *extent, int *count);
+extern SDL_DECLSPEC bool SDLCALL TTF_MeasureUNICODE(TTF_Font *font, const Uint16 *text, int measure_width, int *extent, int *count);
/**
* Render Latin1 text at fast quality to a new 8-bit surface.
@@ -2130,28 +2130,28 @@ extern SDL_DECLSPEC int TTF_GetFontKerningSizeGlyphs32(TTF_Font *font, Uint32 pr
* This clears already-generated glyphs, if any, from the cache.
*
* \param font the font to set SDF support on.
- * \param enabled SDL_TRUE to enable SDF, SDL_FALSE to disable.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \param enabled true to enable SDF, false to disable.
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_GetFontSDF
*/
-extern SDL_DECLSPEC SDL_bool TTF_SetFontSDF(TTF_Font *font, SDL_bool enabled);
+extern SDL_DECLSPEC bool TTF_SetFontSDF(TTF_Font *font, bool enabled);
/**
* Query whether Signed Distance Field rendering is enabled for a font.
*
* \param font the font to query
*
- * \returns SDL_TRUE if enabled, SDL_FALSE otherwise.
+ * \returns true if enabled, false otherwise.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_SetFontSDF
*/
-extern SDL_DECLSPEC SDL_bool TTF_GetFontSDF(const TTF_Font *font);
+extern SDL_DECLSPEC bool TTF_GetFontSDF(const TTF_Font *font);
/**
* Direction flags
@@ -2180,12 +2180,12 @@ typedef enum TTF_Direction
*
* \param font the font to specify a direction for.
* \param direction the new direction for text to flow.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);
+extern SDL_DECLSPEC bool SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Direction direction);
/**
* Set script to be used for text shaping by a font.
@@ -2197,12 +2197,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontDirection(TTF_Font *font, TTF_Di
*
* \param font the font to specify a script name for.
* \param script null-terminated string of exactly 4 characters.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontScriptName(TTF_Font *font, const char *script);
+extern SDL_DECLSPEC bool SDLCALL TTF_SetFontScriptName(TTF_Font *font, const char *script);
/**
* Set language to be used for text shaping by a font.
@@ -2211,12 +2211,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL TTF_SetFontScriptName(TTF_Font *font, const
*
* \param font the font to specify a language for.
* \param language_bcp47 a null-terminated string containing the desired language's BCP47 code. Or null to reset the value.
- * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
+ * \returns true on success or false on failure; call SDL_GetError()
* for more information.
*
* \since This function is available since SDL_ttf 3.0.0.
*/
-extern SDL_DECLSPEC SDL_bool TTF_SetFontLanguage(TTF_Font *font, const char *language_bcp47);
+extern SDL_DECLSPEC bool TTF_SetFontLanguage(TTF_Font *font, const char *language_bcp47);
/**
* Query whether a font is scalable or not.
@@ -2225,13 +2225,13 @@ extern SDL_DECLSPEC SDL_bool TTF_SetFontLanguage(TTF_Font *font, const char *lan
*
* \param font the font to query
*
- * \returns SDL_TRUE if the font is scalable, SDL_FALSE otherwise.
+ * \returns true if the font is scalable, false otherwise.
*
* \since This function is available since SDL_ttf 3.0.0.
*
* \sa TTF_SetFontSDF
*/
-extern SDL_DECLSPEC SDL_bool TTF_IsFontScalable(const TTF_Font *font);
+extern SDL_DECLSPEC bool TTF_IsFontScalable(const TTF_Font *font);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index a2423d11..8ca4da33 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -228,9 +228,9 @@ struct TTF_Font {
int outline_val;
/* Whether kerning is desired */
- SDL_bool enable_kerning;
+ bool enable_kerning;
#if !TTF_USE_HARFBUZZ
- SDL_bool use_kerning;
+ bool use_kerning;
#endif
/* Extra width in glyph bounds for text styles */
@@ -247,7 +247,7 @@ struct TTF_Font {
/* We are responsible for closing the font stream */
SDL_IOStream *src;
- SDL_bool closeio;
+ bool closeio;
FT_Open_Args args;
/* Internal buffer to store positions computed by TTF_Size_Internal()
@@ -267,7 +267,7 @@ struct TTF_Font {
hb_direction_t hb_direction;
hb_language_t hb_language;
#endif
- SDL_bool render_sdf;
+ bool render_sdf;
/* Extra layout setting for wrapped text */
int horizontal_align;
@@ -285,7 +285,7 @@ struct TTF_Font {
/* The FreeType font engine/library */
static FT_Library library = NULL;
static int TTF_initialized = 0;
-static SDL_bool TTF_byteswapped = SDL_FALSE;
+static bool TTF_byteswapped = false;
#define TTF_CHECK_INITIALIZED(errval) \
if (!TTF_initialized) { \
@@ -314,7 +314,7 @@ typedef enum {
static int TTF_initFontMetrics(TTF_Font *font);
-static SDL_bool TTF_Size_Internal(TTF_Font *font, const char *text, str_type_t str_type,
+static bool TTF_Size_Internal(TTF_Font *font, const char *text, str_type_t str_type,
int *w, int *h, int *xstart, int *ystart, int measure_width, int *extent, int *count);
#define NO_MEASUREMENT \
@@ -1489,7 +1489,7 @@ static SDL_Surface* Create_Surface_Solid(int width, int height, SDL_Color fg, Ui
palette->colors[1].a = fg.a;
}
- SDL_SetSurfaceColorKey(textbuf, SDL_TRUE, 0);
+ SDL_SetSurfaceColorKey(textbuf, true, 0);
return textbuf;
}
@@ -1611,13 +1611,13 @@ int TTF_Version(void)
/* This function tells the library whether UNICODE text is generally
byteswapped. A UNICODE BOM character at the beginning of a string
will override this setting for that string. */
-void TTF_ByteSwappedUNICODE(SDL_bool swapped)
+void TTF_ByteSwappedUNICODE(bool swapped)
{
TTF_byteswapped = swapped;
}
#if defined(USE_FREETYPE_ERRORS)
-static SDL_bool TTF_SetFTError(const char *msg, FT_Error error)
+static bool TTF_SetFTError(const char *msg, FT_Error error)
{
#undef FTERRORS_H_
#define FT_ERRORDEF(e, v, s) { e, s },
@@ -1648,9 +1648,9 @@ static SDL_bool TTF_SetFTError(const char *msg, FT_Error error)
#define TTF_SetFTError(msg, error) SDL_SetError(msg)
#endif /* USE_FREETYPE_ERRORS */
-SDL_bool TTF_Init(void)
+bool TTF_Init(void)
{
- SDL_bool result = SDL_TRUE;
+ bool result = true;
/* Some debug to know how it gets compiled */
#if 0
@@ -1734,7 +1734,7 @@ static unsigned long IOread(
return SDL_ReadIO(src, buffer, count);
}
-TTF_Font* TTF_OpenFontIndexDPIIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, long index, unsigned int hdpi, unsigned int vdpi)
+TTF_Font* TTF_OpenFontIndexDPIIO(SDL_IOStream *src, bool closeio, int ptsize, long index, unsigned int hdpi, unsigned int vdpi)
{
TTF_Font *font;
FT_Error error;
@@ -1880,7 +1880,7 @@ TTF_Font* TTF_OpenFontIndexDPIIO(SDL_IOStream *src, SDL_bool closeio, int ptsize
return font;
}
-SDL_bool TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi)
+bool TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsigned int vdpi)
{
FT_Face face = font->face;
FT_Error error;
@@ -1923,10 +1923,10 @@ SDL_bool TTF_SetFontSizeDPI(TTF_Font *font, int ptsize, unsigned int hdpi, unsig
hb_ft_font_changed(font->hb_font);
#endif
- return SDL_TRUE;
+ return true;
}
-SDL_bool TTF_SetFontSize(TTF_Font *font, int ptsize)
+bool TTF_SetFontSize(TTF_Font *font, int ptsize)
{
return TTF_SetFontSizeDPI(font, ptsize, 0, 0);
}
@@ -2004,12 +2004,12 @@ static int TTF_initFontMetrics(TTF_Font *font)
return 0;
}
-TTF_Font* TTF_OpenFontDPIIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, unsigned int hdpi, unsigned int vdpi)
+TTF_Font* TTF_OpenFontDPIIO(SDL_IOStream *src, bool closeio, int ptsize, unsigned int hdpi, unsigned int vdpi)
{
return TTF_OpenFontIndexDPIIO(src, closeio, ptsize, 0, hdpi, vdpi);
}
-TTF_Font* TTF_OpenFontIndexIO(SDL_IOStream *src, SDL_bool closeio, int ptsize, long index)
+TTF_Font* TTF_OpenFontIndexIO(SDL_IOStream *src, bool closeio, int ptsize, long index)
{
return TTF_OpenFontIndexDPIIO(src, closeio, ptsize, index, 0, 0);
}
@@ -2023,7 +2023,7 @@ TTF_Font* TTF_OpenFontIndexDPI(const char *file, int ptsize, long index, unsigne
return TTF_OpenFontIndexDPIIO(rw, 1, ptsize, index, hdpi, vdpi);
}
-TTF_Font* TTF_OpenFontIO(SDL_IOStream *src, SDL_bool closeio, int ptsize)
+TTF_Font* TTF_OpenFontIO(SDL_IOStream *src, bool closeio, int ptsize)
{
return TTF_OpenFontIndexIO(src, closeio, ptsize, 0);
}
@@ -2754,16 +2754,16 @@ static size_t LATIN1_to_UTF8_len(const char *text)
/* Gets the number of bytes needed to convert a UCS2 string to UTF-8 */
static size_t UCS2_to_UTF8_len(const Uint16 *text)
{
- SDL_bool swapped = TTF_byteswapped;
+ bool swapped = TTF_byteswapped;
size_t bytes = 1;
while (*text) {
Uint16 ch = *text++;
if (ch == UNICODE_BOM_NATIVE) {
- swapped = SDL_FALSE;
+ swapped = false;
continue;
}
if (ch == UNICODE_BOM_SWAPPED) {
- swapped = SDL_TRUE;
+ swapped = true;
continue;
}
if (swapped) {
@@ -2798,16 +2798,16 @@ static void LATIN1_to_UTF8(const char *src, Uint8 *dst)
/* Convert a UCS-2 string to a UTF-8 string */
static void UCS2_to_UTF8(const Uint16 *src, Uint8 *dst)
{
- SDL_bool swapped = TTF_byteswapped;
+ bool swapped = TTF_byteswapped;
while (*src) {
Uint16 ch = *src++;
if (ch == UNICODE_BOM_NATIVE) {
- swapped = SDL_FALSE;
+ swapped = false;
continue;
}
if (ch == UNICODE_BOM_SWAPPED) {
- swapped = SDL_TRUE;
+ swapped = true;
continue;
}
if (swapped) {
@@ -2828,7 +2828,7 @@ static void UCS2_to_UTF8(const Uint16 *src, Uint8 *dst)
}
/* Convert a unicode char to a UTF-8 string */
-static SDL_bool Char_to_UTF8(Uint32 ch, Uint8 *dst)
+static bool Char_to_UTF8(Uint32 ch, Uint8 *dst)
{
if (ch <= 0x7F) {
*dst++ = (Uint8) ch;
@@ -2859,10 +2859,10 @@ static SDL_bool Char_to_UTF8(Uint32 ch, Uint8 *dst)
*dst++ = 0x80 | (Uint8) (ch & 0x3F);
} else {
SDL_SetError("Invalid character");
- return SDL_FALSE;
+ return false;
}
*dst = '\0';
- return SDL_TRUE;
+ return true;
}
/* Gets a unicode value from a UTF-8 encoded string
@@ -2873,8 +2873,8 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
const Uint8 *p = (const Uint8 *)src;
size_t left = 0;
size_t save_srclen = srclen;
- SDL_bool overlong = SDL_FALSE;
- SDL_bool underflow = SDL_FALSE;
+ bool overlong = false;
+ bool underflow = false;
Uint32 ch = UNKNOWN_UNICODE;
if (srclen == 0) {
@@ -2883,7 +2883,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
if (p[0] >= 0xFC) {
if ((p[0] & 0xFE) == 0xFC) {
if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) {
- overlong = SDL_TRUE;
+ overlong = true;
}
ch = (Uint32) (p[0] & 0x01);
left = 5;
@@ -2891,7 +2891,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
} else if (p[0] >= 0xF8) {
if ((p[0] & 0xFC) == 0xF8) {
if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) {
- overlong = SDL_TRUE;
+ overlong = true;
}
ch = (Uint32) (p[0] & 0x03);
left = 4;
@@ -2899,7 +2899,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
} else if (p[0] >= 0xF0) {
if ((p[0] & 0xF8) == 0xF0) {
if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) {
- overlong = SDL_TRUE;
+ overlong = true;
}
ch = (Uint32) (p[0] & 0x07);
left = 3;
@@ -2907,7 +2907,7 @@ static Uint32 UTF8_getch(const char *src, size_
(Patch may be truncated, please check the link at the top of this post.)