"Uppercase only" option support for builds that use Pango to render text.
This commit is contained in:
parent
4aa7703811
commit
5d1204f83c
2 changed files with 35 additions and 4 deletions
|
|
@ -128,6 +128,9 @@ $Id$
|
||||||
Arunodai Vudem <arunvudem@gmail.com>
|
Arunodai Vudem <arunvudem@gmail.com>
|
||||||
Mark K. Kim <mkkim214@gmail.com>
|
Mark K. Kim <mkkim214@gmail.com>
|
||||||
|
|
||||||
|
* "Uppercase only" option support for builds that use Pango to render text.
|
||||||
|
(Note: Needs help in some/many? locales.)
|
||||||
|
|
||||||
* New Starters:
|
* New Starters:
|
||||||
-------------
|
-------------
|
||||||
* Spirograph
|
* Spirograph
|
||||||
|
|
|
||||||
|
|
@ -10120,11 +10120,25 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
if (want_right_to_left && need_right_to_left)
|
if (want_right_to_left && need_right_to_left)
|
||||||
{
|
{
|
||||||
SDLPango_SetBaseDirection(locale_font->pango_context, SDLPANGO_DIRECTION_RTL);
|
SDLPango_SetBaseDirection(locale_font->pango_context, SDLPANGO_DIRECTION_RTL);
|
||||||
|
if (only_uppercase)
|
||||||
|
{
|
||||||
|
char * upper_str = uppercase(gettext(str));
|
||||||
|
SDLPango_SetText_GivenAlignment(myfont->pango_context, upper_str, -1, SDLPANGO_ALIGN_RIGHT);
|
||||||
|
free(upper_str);
|
||||||
|
}
|
||||||
|
else
|
||||||
SDLPango_SetText_GivenAlignment(myfont->pango_context, gettext(str), -1, SDLPANGO_ALIGN_RIGHT);
|
SDLPango_SetText_GivenAlignment(myfont->pango_context, gettext(str), -1, SDLPANGO_ALIGN_RIGHT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SDLPango_SetBaseDirection(locale_font->pango_context, SDLPANGO_DIRECTION_LTR);
|
SDLPango_SetBaseDirection(locale_font->pango_context, SDLPANGO_DIRECTION_LTR);
|
||||||
|
if (only_uppercase)
|
||||||
|
{
|
||||||
|
char * upper_str = uppercase(gettext(str));
|
||||||
|
SDLPango_SetText_GivenAlignment(myfont->pango_context, upper_str, -1, SDLPANGO_ALIGN_LEFT);
|
||||||
|
free(upper_str);
|
||||||
|
}
|
||||||
|
else
|
||||||
SDLPango_SetText_GivenAlignment(myfont->pango_context, gettext(str), -1, SDLPANGO_ALIGN_LEFT);
|
SDLPango_SetText_GivenAlignment(myfont->pango_context, gettext(str), -1, SDLPANGO_ALIGN_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10175,6 +10189,13 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
|
|
||||||
if (locale_str[i] == ' ' || locale_str[i] == '\0')
|
if (locale_str[i] == ' ' || locale_str[i] == '\0')
|
||||||
{
|
{
|
||||||
|
if (only_uppercase)
|
||||||
|
{
|
||||||
|
wchar * upper_utf8_str = uppercase_w(utf8_str);
|
||||||
|
text = render_text(myfont, (char *) upper_utf8_str, color);
|
||||||
|
free(upper_utf8_str);
|
||||||
|
}
|
||||||
|
else
|
||||||
text = render_text(myfont, (char *) utf8_str, color);
|
text = render_text(myfont, (char *) utf8_str, color);
|
||||||
|
|
||||||
if (!text)
|
if (!text)
|
||||||
|
|
@ -10376,6 +10397,13 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
/* Render the word for display... */
|
/* Render the word for display... */
|
||||||
|
|
||||||
|
|
||||||
|
if (only_uppercase)
|
||||||
|
{
|
||||||
|
char uppercase_substr = uppercase(substr);
|
||||||
|
text = render_text(myfont, uppercase_substr, color);
|
||||||
|
free(uppercase_substr);
|
||||||
|
}
|
||||||
|
else
|
||||||
text = render_text(myfont, substr, color);
|
text = render_text(myfont, substr, color);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue