Right-aligning right-to-left text.
This commit is contained in:
parent
a241607224
commit
f9ea0e0f6e
1 changed files with 10 additions and 11 deletions
|
|
@ -9541,6 +9541,12 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
if (need_own_font && (strcmp(gettext(str), str) || locale_text))
|
if (need_own_font && (strcmp(gettext(str), str) || locale_text))
|
||||||
myfont = locale_font;
|
myfont = locale_font;
|
||||||
|
|
||||||
|
if (strcmp(str, gettext(str)) == 0)
|
||||||
|
{
|
||||||
|
/* String isn't translated! Don't write right-to-left */
|
||||||
|
want_right_to_left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NO_SDLPANGO
|
#ifndef NO_SDLPANGO
|
||||||
/* Letting SDL_Pango do all this stuff! */
|
/* Letting SDL_Pango do all this stuff! */
|
||||||
|
|
@ -9549,7 +9555,10 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
|
|
||||||
SDLPango_SetDefaultColor(myfont->pango_context, &pango_color);
|
SDLPango_SetDefaultColor(myfont->pango_context, &pango_color);
|
||||||
SDLPango_SetMinimumSize(myfont->pango_context, right - left, canvas->h - top);
|
SDLPango_SetMinimumSize(myfont->pango_context, right - left, canvas->h - top);
|
||||||
SDLPango_SetText(myfont->pango_context, gettext(str), -1);
|
if (want_right_to_left)
|
||||||
|
SDLPango_SetText_GivenAlignment(myfont->pango_context, gettext(str), -1, SDLPANGO_ALIGN_RIGHT);
|
||||||
|
else
|
||||||
|
SDLPango_SetText(myfont->pango_context, gettext(str), -1);
|
||||||
text = SDLPango_CreateSurfaceDraw(myfont->pango_context);
|
text = SDLPango_CreateSurfaceDraw(myfont->pango_context);
|
||||||
|
|
||||||
dest.x = left;
|
dest.x = left;
|
||||||
|
|
@ -9574,20 +9583,10 @@ static void wordwrap_text_ex(const char *const str, SDL_Color color,
|
||||||
|
|
||||||
if (strcmp(str, "") != 0)
|
if (strcmp(str, "") != 0)
|
||||||
{
|
{
|
||||||
if (strcmp(str, gettext(str)) == 0)
|
|
||||||
{
|
|
||||||
/* String isn't translated! Don't write right-to-left */
|
|
||||||
want_right_to_left = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NO_SDLPANGO
|
|
||||||
if (want_right_to_left == 0)
|
if (want_right_to_left == 0)
|
||||||
locale_str = (unsigned char *) strdup(gettext(str));
|
locale_str = (unsigned char *) strdup(gettext(str));
|
||||||
else
|
else
|
||||||
locale_str = (unsigned char *) textdir(gettext(str));
|
locale_str = (unsigned char *) textdir(gettext(str));
|
||||||
#else
|
|
||||||
locale_str = (unsigned char *) strdup(gettext(str));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* For each UTF8 character: */
|
/* For each UTF8 character: */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue