From 96da6ae57fc81613d5ddfd159ecc346d2f72d76b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 27 Sep 2024 01:42:50 -0700
Subject: [PATCH] Removed solid text rendering mode
The quality is much worse than shaded or blended, which is what people will want in their games.
---
docs/README-migration.md | 13 ++--
examples/showfont.c | 16 +----
examples/testapp.c | 37 ++++------
include/SDL3_ttf/SDL_ttf.h | 140 +------------------------------------
src/SDL_ttf.c | 71 ++-----------------
src/SDL_ttf.sym | 3 -
6 files changed, 28 insertions(+), 252 deletions(-)
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 59edec5c..eec1d4d4 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -36,6 +36,8 @@ Several functions have been renamed. We have provided a handy semantic patch to
In general we have switched to using UTF8 in the API. Functions which had 3 variants, for Latin-1, UTF-8, and UCS2, now accept UTF-8 text. In addition, those functions now have an optional length parameter which allows you to render substrings.
+The solid color rendering functions have been removed in favor of the higher quality shaded and blended functions.
+
The following functions have been renamed:
* TTF_FontAscent() => TTF_GetFontAscent()
* TTF_FontDescent() => TTF_GetFontDescent()
@@ -54,15 +56,12 @@ The following functions have been renamed:
* TTF_RenderGlyph32_Blended() => TTF_RenderGlyph_Blended()
* TTF_RenderGlyph32_LCD() => TTF_RenderGlyph_LCD()
* TTF_RenderGlyph32_Shaded() => TTF_RenderGlyph_Shaded()
-* TTF_RenderGlyph32_Solid() => TTF_RenderGlyph_Solid()
* TTF_RenderUTF8_Blended() => TTF_RenderText_Blended()
* TTF_RenderUTF8_Blended_Wrapped() => TTF_RenderText_Blended_Wrapped()
* TTF_RenderUTF8_LCD() => TTF_RenderText_LCD()
* TTF_RenderUTF8_LCD_Wrapped() => TTF_RenderText_LCD_Wrapped()
* TTF_RenderUTF8_Shaded() => TTF_RenderText_Shaded()
* TTF_RenderUTF8_Shaded_Wrapped() => TTF_RenderText_Shaded_Wrapped()
-* TTF_RenderUTF8_Solid() => SDL_RenderText_Solid()
-* TTF_RenderUTF8_Solid_Wrapped() => TTF_RenderText_Solid_Wrapped()
* TTF_SetFontScriptName() => TTF_SetFontScript()
* TTF_SetFontWrappedAlign() => TTF_SetFontWrapAlignment()
* TTF_SizeText() => TTF_GetTextSize()
@@ -70,6 +69,7 @@ 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_MeasureUNICODE()
@@ -77,9 +77,12 @@ The following functions have been removed:
* TTF_OpenFontDPIIO() - replaced with TTF_OpenFontWithProperties()
* TTF_OpenFontIndex() - replaced with TTF_OpenFontWithProperties()
* TTF_OpenFontIndexDPI() - replaced with TTF_OpenFontWithProperties()
-* TTF_FontFaces() - can be retrieved from the font FT_Face, available in TTF_PROP_FONT_FACE_POINTER
* TTF_OpenFontIndexDPIIO() - replaced with TTF_OpenFontWithProperties()
* TTF_OpenFontIndexIO() - replaced with TTF_OpenFontWithProperties()
+* TTF_RenderGlyph32_Solid()
+* TTF_RenderGlyph_Solid()
+* TTF_RenderText_Solid()
+* TTF_RenderText_Solid_Wrapped()
* TTF_RenderUNICODE_Blended()
* TTF_RenderUNICODE_Blended_Wrapped()
* TTF_RenderUNICODE_LCD()
@@ -88,6 +91,8 @@ The following functions have been removed:
* TTF_RenderUNICODE_Shaded_Wrapped()
* TTF_RenderUNICODE_Solid()
* TTF_RenderUNICODE_Solid_Wrapped()
+* TTF_RenderUTF8_Solid()
+* TTF_RenderUTF8_Solid_Wrapped()
* TTF_SizeUNICODE()
The following symbols have been renamed:
diff --git a/examples/showfont.c b/examples/showfont.c
index e836658c..ac9cc194 100644
--- a/examples/showfont.c
+++ b/examples/showfont.c
@@ -35,11 +35,10 @@
#define HEIGHT 480
#define TTF_SHOWFONT_USAGE \
-"Usage: %s [-solid] [-shaded] [-blended] [-wrapped] [-b] [-i] [-u] [-s] [-outline size] [-hintlight|-hintmono|-hintnone] [-nokerning] [-wrap] [-align left|center|right] [-fgcol r,g,b,a] [-bgcol r,g,b,a] <font>.ttf [ptsize] [text]\n"
+"Usage: %s [-shaded] [-blended] [-wrapped] [-b] [-i] [-u] [-s] [-outline size] [-hintlight|-hintmono|-hintnone] [-nokerning] [-wrap] [-align left|center|right] [-fgcol r,g,b,a] [-bgcol r,g,b,a] <font>.ttf [ptsize] [text]\n"
typedef enum
{
- TextRenderSolid,
TextRenderShaded,
TextRenderBlended
} TextRenderMethod;
@@ -106,9 +105,6 @@ int main(int argc, char *argv[])
forecol = &black;
backcol = &white;
for (i=1; argv[i] && argv[i][0] == '-'; ++i) {
- if (SDL_strcmp(argv[i], "-solid") == 0) {
- rendermethod = TextRenderSolid;
- } else
if (SDL_strcmp(argv[i], "-shaded") == 0) {
rendermethod = TextRenderShaded;
} else
@@ -254,9 +250,6 @@ int main(int argc, char *argv[])
/* Show which font file we're looking at */
SDL_snprintf(string, sizeof(string), "Font file: %s", argv[0]); /* possible overflow */
switch (rendermethod) {
- case TextRenderSolid:
- text = TTF_RenderText_Solid(font, string, 0, *forecol);
- break;
case TextRenderShaded:
text = TTF_RenderText_Shaded(font, string, 0, *forecol, *backcol);
break;
@@ -280,13 +273,6 @@ int main(int argc, char *argv[])
message = DEFAULT_TEXT;
}
switch (rendermethod) {
- case TextRenderSolid:
- if (wrap) {
- text = TTF_RenderText_Solid_Wrapped(font, message, 0, *forecol, 0);
- } else {
- text = TTF_RenderText_Solid(font, message, 0, *forecol);
- }
- break;
case TextRenderShaded:
if (wrap) {
text = TTF_RenderText_Shaded_Wrapped(font, message, 0, *forecol, *backcol, 0);
diff --git a/examples/testapp.c b/examples/testapp.c
index b2e85995..62b24d10 100644
--- a/examples/testapp.c
+++ b/examples/testapp.c
@@ -99,7 +99,7 @@ static void help(void)
SDL_Log("t : ticks elapsed for 50 rendering");
SDL_Log("d : display normal texture, no screen update, stream texture ");
SDL_Log("r : start/stop random test");
- SDL_Log("m : render mode Solid/Blended/Shaded");
+ SDL_Log("m : render mode Blended/Shaded");
SDL_Log("n : change direction");
SDL_Log("9/0 : -/+ alpha color fg");
SDL_Log("7/8 : -/+ alpha color bg (Shaded only)");
@@ -191,10 +191,10 @@ static int print_elapsed_ticks = 0;
static int update_screen_mode = 0;
static int save_to_bmp = 0;
-/* RENDER_SOLID = 0, RENDER_BLENDED = 1, RENDER_SHADED = 2, RENDER_LCD = 3 } */
+/* RENDER_BLENDED = 0, RENDER_SHADED = 1, RENDER_LCD = 2 */
static int render_mode = -1;
static int render_mode_overwrite;
-static const char *render_mode_desc[] = { "Solid", "Blended", "Shaded", "LCD" };
+static const char *render_mode_desc[] = { "Blended", "Shaded", "LCD" };
static const int render_mode_count = SDL_arraysize(render_mode_desc);
static int direction = 0;
@@ -683,10 +683,6 @@ int main(void)
seed=1641805930; replay=1; font_style=9; kerning=1; sdf=1; wrap=0; wrap_size=661; w_align=2; outline=0; curr_size=20; render_mode=3; curr_str=14; curr_font=1777; hinting=1; fg_alpha=65; // light LCD
#endif
- //seed=1673390190; replay=1; font_style=12; kerning=0; sdf=1; wrap=0; wrap_size=91; w_align=0; outline=0; curr_size=16; render_mode=0; curr_str=14; curr_font=1288; hinting=0; fg_alpha=77; // none Solid
-
- //seed=1673390190; replay=1; font_style=12; kerning=0; sdf=0; wrap=0; wrap_size=91; w_align=0; outline=0; curr_size=30; render_mode=1; curr_str=14; curr_font=1288; hinting=0; fg_alpha=77; // none Solid
-
//seed=1673390190; replay=1; font_style=9; kerning=1; sdf=0; wrap=1; wrap_size=94; w_align=2; outline=7; curr_size=42; render_mode=1; curr_str=75; curr_font=1997; hinting=1; fg_alpha=90; // light Blended
if (replay) {
@@ -919,22 +915,19 @@ int main(void)
switch (render_mode)
{
- case 1:
+ case 0:
text_surface = TTF_RenderText_Blended(font, text, 0, textcol);
break;
- case 2:
+ case 1:
text_surface = TTF_RenderText_Shaded(font, text, 0, textcol, boardcol);
break;
- case 3:
+ case 2:
#if defined(HAVE_LCD)
text_surface = TTF_RenderText_LCD(font, text, 0, textcol, boardcol);
#else
text_surface = TTF_RenderText_Shaded(font, text, 0, textcol, boardcol);
#endif
break;
- case 0:
- text_surface = TTF_RenderText_Solid(font, text, 0, textcol);
- break;
}
if (text_surface) {
@@ -947,22 +940,19 @@ int main(void)
switch (render_mode)
{
- case 1:
+ case 0:
text_surface = TTF_RenderText_Blended(font, text, 0, textcol);
break;
- case 2:
+ case 1:
text_surface = TTF_RenderText_Shaded(font, text, 0, textcol, boardcol);
break;
- case 3:
+ case 2:
#if defined(HAVE_LCD)
text_surface = TTF_RenderText_LCD(font, text, 0, textcol, boardcol);
#else
text_surface = TTF_RenderText_Shaded(font, text, 0, textcol, boardcol);
#endif
break;
- case 0:
- text_surface = TTF_RenderText_Solid(font, text, 0, textcol);
- break;
}
if (print_elapsed_ticks) {
@@ -987,22 +977,19 @@ int main(void)
#if defined(HAVE_ALL_WRAPPED_FUNCTIONS)
switch (render_mode)
{
- case 1:
+ case 0:
text_surface = TTF_RenderText_Blended_Wrapped(font, text, 0, textcol, wrap_size);
break;
- case 2:
+ case 1:
text_surface = TTF_RenderText_Shaded_Wrapped(font, text, 0, textcol, boardcol, wrap_size);
break;
- case 3:
+ case 2:
#if defined(HAVE_LCD)
text_surface = TTF_RenderText_LCD_Wrapped(font, text, 0, textcol, boardcol, wrap_size);
#else
text_surface = TTF_RenderText_Shaded_Wrapped(font, text, 0, textcol, boardcol, wrap_size);
#endif
break;
- case 0:
- text_surface = TTF_RenderText_Solid_Wrapped(font, text, 0, textcol, wrap_size);
- break;
}
#else
text_surface = TTF_RenderText_Blended_Wrapped(font, text, 0, textcol, wrap_size);
diff --git a/include/SDL3_ttf/SDL_ttf.h b/include/SDL3_ttf/SDL_ttf.h
index a6b11868..f08a54e9 100644
--- a/include/SDL3_ttf/SDL_ttf.h
+++ b/include/SDL3_ttf/SDL_ttf.h
@@ -766,108 +766,6 @@ extern SDL_DECLSPEC bool SDLCALL TTF_GetTextSizeWrapped(TTF_Font *font, const ch
*/
extern SDL_DECLSPEC bool SDLCALL TTF_MeasureText(TTF_Font *font, const char *text, size_t length, int measure_width, int *extent, int *count);
-/**
- * Render UTF-8 text at fast quality to a new 8-bit surface.
- *
- * This function will allocate a new 8-bit, palettized surface. The surface's
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
- * will be set to the text color.
- *
- * This will not word-wrap the string; you'll get a surface with a single line
- * of text, as long as the string requires. You can use
- * TTF_RenderText_Solid_Wrapped() instead if you need to wrap the output to
- * multiple lines.
- *
- * This will not wrap on newline characters.
- *
- * You can render at other quality levels with TTF_RenderText_Shaded,
- * TTF_RenderText_Blended, and TTF_RenderText_LCD.
- *
- * \param font the font to render with.
- * \param text text to render, in UTF-8 encoding.
- * \param length the length of the text, in bytes, or 0 for null terminated
- * text.
- * \param fg the foreground color for the text.
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
- *
- * \threadsafety This function should be called on the thread that created the
- * font.
- *
- * \since This function is available since SDL_ttf 3.0.0.
- *
- * \sa TTF_RenderText_Blended
- * \sa TTF_RenderText_LCD
- * \sa TTF_RenderText_Shaded
- * \sa TTF_RenderText_Solid
- * \sa TTF_RenderText_Solid_Wrapped
- */
-extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font, const char *text, size_t length, SDL_Color fg);
-
-/**
- * Render word-wrapped UTF-8 text at fast quality to a new 8-bit surface.
- *
- * This function will allocate a new 8-bit, palettized surface. The surface's
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
- * will be set to the text color.
- *
- * Text is wrapped to multiple lines on line endings and on word boundaries if
- * it extends beyond `wrapLength` in pixels.
- *
- * If wrapLength is 0, this function will only wrap on newline characters.
- *
- * You can render at other quality levels with TTF_RenderText_Shaded_Wrapped,
- * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
- *
- * \param font the font to render with.
- * \param text text to render, in UTF-8 encoding.
- * \param length the length of the text, in bytes, or 0 for null terminated
- * text.
- * \param fg the foreground color for the text.
- * \param wrapLength the maximum width of the text surface or 0 to wrap on
- * newline characters.
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
- *
- * \threadsafety This function should be called on the thread that created the
- * font.
- *
- * \since This function is available since SDL_ttf 3.0.0.
- *
- * \sa TTF_RenderText_Blended_Wrapped
- * \sa TTF_RenderText_LCD_Wrapped
- * \sa TTF_RenderText_Shaded_Wrapped
- * \sa TTF_RenderText_Solid
- */
-extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, int wrapLength);
-
-/**
- * Render a single 32-bit glyph at fast quality to a new 8-bit surface.
- *
- * This function will allocate a new 8-bit, palettized surface. The surface's
- * 0 pixel will be the colorkey, giving a transparent background. The 1 pixel
- * will be set to the text color.
- *
- * The glyph is rendered without any padding or centering in the X direction,
- * and aligned normally in the Y direction.
- *
- * You can render at other quality levels with TTF_RenderGlyph_Shaded,
- * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
- *
- * \param font the font to render with.
- * \param ch the character to render.
- * \param fg the foreground color for the text.
- * \returns a new 8-bit, palettized surface, or NULL if there was an error.
- *
- * \threadsafety This function should be called on the thread that created the
- * font.
- *
- * \since This function is available since SDL_ttf 3.0.0.
- *
- * \sa TTF_RenderGlyph_Blended
- * \sa TTF_RenderGlyph_LCD
- * \sa TTF_RenderGlyph_Shaded
- */
-extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font, Uint32 ch, SDL_Color fg);
-
/**
* Render UTF-8 text at high quality to a new 8-bit surface.
*
@@ -883,9 +781,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font,
*
* This will not wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid,
- * TTF_RenderText_Blended, and TTF_RenderText_LCD.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -901,8 +796,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font,
*
* \sa TTF_RenderText_Blended
* \sa TTF_RenderText_LCD
- * \sa TTF_RenderText_Shaded
- * \sa TTF_RenderText_Solid
+ * \sa TTF_RenderText_Shaded_Wrapped
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg);
@@ -919,9 +813,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font,
*
* If wrapLength is 0, this function will only wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
- * TTF_RenderText_Blended_Wrapped, and TTF_RenderText_LCD_Wrapped.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -940,7 +831,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font,
* \sa TTF_RenderText_Blended_Wrapped
* \sa TTF_RenderText_LCD_Wrapped
* \sa TTF_RenderText_Shaded
- * \sa TTF_RenderText_Solid_Wrapped
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrapLength);
@@ -955,9 +845,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font
* The glyph is rendered without any padding or centering in the X direction,
* and aligned normally in the Y direction.
*
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
- * TTF_RenderGlyph_Blended, and TTF_RenderGlyph_LCD.
- *
* \param font the font to render with.
* \param ch the character to render.
* \param fg the foreground color for the text.
@@ -971,7 +858,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded_Wrapped(TTF_Font
*
* \sa TTF_RenderGlyph_Blended
* \sa TTF_RenderGlyph_LCD
- * \sa TTF_RenderGlyph_Solid
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font, Uint32 ch, SDL_Color fg, SDL_Color bg);
@@ -989,9 +875,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font,
*
* This will not wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid,
- * TTF_RenderText_Shaded, and TTF_RenderText_LCD.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -1007,7 +890,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font,
* \sa TTF_RenderText_Blended_Wrapped
* \sa TTF_RenderText_LCD
* \sa TTF_RenderText_Shaded
- * \sa TTF_RenderText_Solid
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font, const char *text, size_t length, SDL_Color fg);
@@ -1023,9 +905,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font,
*
* If wrapLength is 0, this function will only wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
- * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_LCD_Wrapped.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -1043,7 +922,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font,
* \sa TTF_RenderText_Blended
* \sa TTF_RenderText_LCD_Wrapped
* \sa TTF_RenderText_Shaded_Wrapped
- * \sa TTF_RenderText_Solid_Wrapped
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, int wrapLength);
@@ -1057,9 +935,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Fon
* The glyph is rendered without any padding or centering in the X direction,
* and aligned normally in the Y direction.
*
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
- * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_LCD.
- *
* \param font the font to render with.
* \param ch the character to render.
* \param fg the foreground color for the text.
@@ -1072,7 +947,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Fon
*
* \sa TTF_RenderGlyph_LCD
* \sa TTF_RenderGlyph_Shaded
- * \sa TTF_RenderGlyph_Solid
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font, Uint32 ch, SDL_Color fg);
@@ -1090,9 +964,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font
*
* This will not wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid,
- * TTF_RenderText_Shaded, and TTF_RenderText_Blended.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -1109,7 +980,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font
* \sa TTF_RenderText_Blended
* \sa TTF_RenderText_LCD_Wrapped
* \sa TTF_RenderText_Shaded
- * \sa TTF_RenderText_Solid
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg);
@@ -1126,9 +996,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font, con
*
* If wrapLength is 0, this function will only wrap on newline characters.
*
- * You can render at other quality levels with TTF_RenderText_Solid_Wrapped,
- * TTF_RenderText_Shaded_Wrapped, and TTF_RenderText_Blended_Wrapped.
- *
* \param font the font to render with.
* \param text text to render, in UTF-8 encoding.
* \param length the length of the text, in bytes, or 0 for null terminated
@@ -1147,7 +1014,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD(TTF_Font *font, con
* \sa TTF_RenderText_Blended_Wrapped
* \sa TTF_RenderText_LCD
* \sa TTF_RenderText_Shaded_Wrapped
- * \sa TTF_RenderText_Solid_Wrapped
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *font, const char *text, size_t length, SDL_Color fg, SDL_Color bg, int wrapLength);
@@ -1161,9 +1027,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *f
* The glyph is rendered without any padding or centering in the X direction,
* and aligned normally in the Y direction.
*
- * You can render at other quality levels with TTF_RenderGlyph_Solid,
- * TTF_RenderGlyph_Shaded, and TTF_RenderGlyph_Blended.
- *
* \param font the font to render with.
* \param ch the character to render.
* \param fg the foreground color for the text.
@@ -1177,7 +1040,6 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_LCD_Wrapped(TTF_Font *f
*
* \sa TTF_RenderGlyph_Blended
* \sa TTF_RenderGlyph_Shaded
- * \sa TTF_RenderGlyph_Solid
*/
extern SDL_DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_LCD(TTF_Font *font, Uint32 ch, SDL_Color fg, SDL_Color bg);
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index 21a9d5b8..101c12cc 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -325,7 +325,6 @@ static struct
TTF_CHECK_POINTER("font", font, errval)
typedef enum {
- RENDER_SOLID = 0,
RENDER_SHADED,
RENDER_BLENDED,
RENDER_LCD
@@ -1241,7 +1240,6 @@ static int Render_Line_##NAME(TTF_Font *font, SDL_Surface *textbuf, int xstart,
BUILD_RENDER_LINE(SSE_Shaded , 0, 0, 0, PIXMAP, 0 , , , BG_SSE )
BUILD_RENDER_LINE(SSE_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended_SSE , )
BUILD_RENDER_LINE(SSE_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque_SSE , , )
-BUILD_RENDER_LINE(SSE_Solid , 0, 0, 0, BITMAP, 0 , , , BG_SSE )
BUILD_RENDER_LINE(SSE_Shaded_SP , 0, 0, 0, PIXMAP, SUBPIX, , , BG_SSE )
BUILD_RENDER_LINE(SSE_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended_SSE , )
BUILD_RENDER_LINE(SSE_Blended_Opaque_SP , 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque_SSE , , )
@@ -1253,7 +1251,6 @@ BUILD_RENDER_LINE(SSE_LCD_SP , 0, 0, 1, LCD, SUBPIX,
BUILD_RENDER_LINE(NEON_Shaded , 0, 0, 0, PIXMAP, 0 , , , BG_NEON )
BUILD_RENDER_LINE(NEON_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended_NEON, )
BUILD_RENDER_LINE(NEON_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque_NEON, , )
-BUILD_RENDER_LINE(NEON_Solid , 0, 0, 0, BITMAP, 0 , , , BG_NEON )
BUILD_RENDER_LINE(NEON_Shaded_SP , 0, 0, 0, PIXMAP, SUBPIX, , , BG_NEON )
BUILD_RENDER_LINE(NEON_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended_NEON, )
BUILD_RENDER_LINE(NEON_Blended_Opaque_SP, 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque_NEON, , )
@@ -1265,7 +1262,6 @@ BUILD_RENDER_LINE(NEON_LCD_SP , 0, 0, 1, LCD, SUBPIX,
BUILD_RENDER_LINE(64_Shaded , 0, 0, 0, PIXMAP, 0 , , , BG_64 )
BUILD_RENDER_LINE(64_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended_32 , )
BUILD_RENDER_LINE(64_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque_32 , , )
-BUILD_RENDER_LINE(64_Solid , 0, 0, 0, BITMAP, 0 , , , BG_64 )
BUILD_RENDER_LINE(64_Shaded_SP , 0, 0, 0, PIXMAP, SUBPIX, , , BG_64 )
BUILD_RENDER_LINE(64_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended_32 , )
BUILD_RENDER_LINE(64_Blended_Opaque_SP , 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque_32 , , )
@@ -1275,7 +1271,6 @@ BUILD_RENDER_LINE(64_LCD_SP , 0, 0, 1, LCD, SUBPIX,
BUILD_RENDER_LINE(32_Shaded , 0, 0, 0, PIXMAP, 0 , , , BG_32 )
BUILD_RENDER_LINE(32_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended_32 , )
BUILD_RENDER_LINE(32_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque_32 , , )
-BUILD_RENDER_LINE(32_Solid , 0, 0, 0, BITMAP, 0 , , , BG_32 )
BUILD_RENDER_LINE(32_Shaded_SP , 0, 0, 0, PIXMAP, SUBPIX, , , BG_32 )
BUILD_RENDER_LINE(32_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended_32 , )
BUILD_RENDER_LINE(32_Blended_Opaque_SP , 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque_32 , , )
@@ -1285,7 +1280,6 @@ BUILD_RENDER_LINE(32_LCD_SP , 0, 0, 1, LCD, SUBPIX,
BUILD_RENDER_LINE(8_Shaded , 0, 0, 0, PIXMAP, 0 , , , BG )
BUILD_RENDER_LINE(8_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended , )
BUILD_RENDER_LINE(8_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque , , )
-BUILD_RENDER_LINE(8_Solid , 0, 0, 0, BITMAP, 0 , , , BG )
BUILD_RENDER_LINE(8_Shaded_SP , 0, 0, 0, PIXMAP, SUBPIX, , , BG )
BUILD_RENDER_LINE(8_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended , )
BUILD_RENDER_LINE(8_Blended_Opaque_SP , 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque , , )
@@ -1298,7 +1292,6 @@ BUILD_RENDER_LINE(8_LCD_SP , 0, 0, 1, LCD, SUBPIX,
static int (*Render_Line_SDF_Shaded)(TTF_Font *font, SDL_Surface *textbuf, int xstart, int ystart, SDL_Color *fg) = NULL;
BUILD_RENDER_LINE(SDF_Blended , 1, 0, 0, COLOR, 0 , , BG_Blended_SDF , )
BUILD_RENDER_LINE(SDF_Blended_Opaque , 1, 1, 0, COLOR, 0 , BG_Blended_Opaque_SDF , , )
-static int (*Render_Line_SDF_Solid)(TTF_Font *font, SDL_Surface *textbuf, int xstart, int ystart, SDL_Color *fg) = NULL;
static int (*Render_Line_SDF_Shaded_SP)(TTF_Font *font, SDL_Surface *textbuf, int xstart, int ystart, SDL_Color *fg) = NULL;
BUILD_RENDER_LINE(SDF_Blended_SP , 1, 0, 0, COLOR, SUBPIX, , BG_Blended_SDF , )
BUILD_RENDER_LINE(SDF_Blended_Opaque_SP , 1, 1, 0, COLOR, SUBPIX, BG_Blended_Opaque_SDF , , )
@@ -1314,8 +1307,6 @@ static int Render_Line(const render_mode_t render_mode, int subpixel, TTF_Font *
{
/* Render line (pos_buf) to textbuf at (xstart, ystart) */
- /* Subpixel with RENDER_SOLID doesn't make sense. */
- /* (and 'cached->subpixel.translation' would need to distinguish bitmap/pixmap). */
int is_opaque = (fg.a == SDL_ALPHA_OPAQUE);
#define Call_Specific_Render_Line(NAME) \
@@ -1339,14 +1330,12 @@ static int Render_Line(const render_mode_t render_mode, int subpixel, TTF_Font *
return Render_Line_##NAME##_Blended_SP(font, textbuf, xstart, ystart, &fg); \
} \
} \
- } else if (render_mode == RENDER_LCD) { \
+ } else /*if (render_mode == RENDER_LCD)*/ { \
if (subpixel == 0) { \
return Render_Line_##NAME##_LCD(font, textbuf, xstart, ystart, &fg); \
} else { \
return Render_Line_##NAME##_LCD_SP(font, textbuf, xstart, ystart, &fg); \
} \
- } else { \
- return Render_Line_##NAME##_Solid(font, textbuf, xstart, ystart, NULL); \
}
#if TTF_USE_SDF
@@ -1405,9 +1394,9 @@ static SDL_Surface *AllocateAlignedPixels(size_t width, size_t height, SDL_Pixel
* Considerer also for instance, that when we read 1 block of 16 bytes from source, for the blended
* format (bbp == 4), it writes(and reads) 4 blocks of 16 in the dest, like BG_Blended_SSE()).
*
- * Remark: for Solid/Shaded, block ratio read/write is 1:1.
+ * Remark: for Shaded, block ratio read/write is 1:1.
* For Color / LCD / SDF, it is byte vs
(Patch may be truncated, please check the link at the top of this post.)