Remove lang_use_right_to_left_word stuff; it's unused
For https://sourceforge.net/p/tuxpaint/tasks/33/` Next step: remove `textdir()` completely.
This commit is contained in:
parent
111c9b4dc8
commit
5c7c1b6083
4 changed files with 7 additions and 59 deletions
|
|
@ -114,6 +114,10 @@ https://tuxpaint.org/
|
||||||
h/t https://github.com/xfce-mirror/xfce4-xkb-plugin/commit/825fa1c
|
h/t https://github.com/xfce-mirror/xfce4-xkb-plugin/commit/825fa1c
|
||||||
Bill Kendrick <bill@newbreedsoftware.com>
|
Bill Kendrick <bill@newbreedsoftware.com>
|
||||||
|
|
||||||
|
* Removed unused `need_right_to_left_word` internal flags and [WIP] `textdir()`.
|
||||||
|
Closes https://sourceforge.net/p/tuxpaint/tasks/33/
|
||||||
|
Bill Kendrick <bill@newbreedsoftware.com>
|
||||||
|
|
||||||
* Documentation updates:
|
* Documentation updates:
|
||||||
----------------------
|
----------------------
|
||||||
* Troubleshooting Guide (TROUBLESHOOTING.txt) updated regarding
|
* Troubleshooting Guide (TROUBLESHOOTING.txt) updated regarding
|
||||||
|
|
|
||||||
12
src/i18n.c
12
src/i18n.c
|
|
@ -254,14 +254,8 @@ static int lang_use_right_to_left[] = {
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: Remove! (We now require SDL_Pango all the time, so this is unnecessary -bjk 2023.04.30) */
|
|
||||||
static int lang_use_right_to_left_word[] = {
|
|
||||||
-1
|
|
||||||
};
|
|
||||||
|
|
||||||
int need_own_font;
|
int need_own_font;
|
||||||
int need_right_to_left;
|
int need_right_to_left;
|
||||||
int need_right_to_left_word;
|
|
||||||
const char *lang_prefix, *short_lang_prefix;
|
const char *lang_prefix, *short_lang_prefix;
|
||||||
|
|
||||||
w_langs wished_langs[255];
|
w_langs wished_langs[255];
|
||||||
|
|
@ -1227,7 +1221,6 @@ static void set_current_language(const char *restrict loc, int *ptr_num_wished_l
|
||||||
wished_langs[j].lang_prefix = lang_prefixes[langint];
|
wished_langs[j].lang_prefix = lang_prefixes[langint];
|
||||||
wished_langs[j].need_own_font = search_int_array(langint, lang_use_own_font);
|
wished_langs[j].need_own_font = search_int_array(langint, lang_use_own_font);
|
||||||
wished_langs[j].need_right_to_left = search_int_array(langint, lang_use_right_to_left);
|
wished_langs[j].need_right_to_left = search_int_array(langint, lang_use_right_to_left);
|
||||||
wished_langs[j].need_right_to_left_word = search_int_array(langint, lang_use_right_to_left_word);
|
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
env_language_lang = strtok(NULL, ":");
|
env_language_lang = strtok(NULL, ":");
|
||||||
|
|
@ -1247,11 +1240,10 @@ static void set_current_language(const char *restrict loc, int *ptr_num_wished_l
|
||||||
|
|
||||||
need_own_font = wished_langs[0].need_own_font;
|
need_own_font = wished_langs[0].need_own_font;
|
||||||
need_right_to_left = wished_langs[0].need_right_to_left;
|
need_right_to_left = wished_langs[0].need_right_to_left;
|
||||||
need_right_to_left_word = wished_langs[0].need_right_to_left_word;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: Language is %s (%d) %s/%s\n",
|
fprintf(stderr, "DEBUG: Language is %s (%d) %s\n",
|
||||||
lang_prefix, langint, need_right_to_left ? "(RTL)" : "", need_right_to_left_word ? "(RTL words)" : "");
|
lang_prefix, langint, need_right_to_left ? "(RTL)" : "");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ typedef struct language_to_locale_struct
|
||||||
extern const char *lang_prefixes[NUM_LANGS];
|
extern const char *lang_prefixes[NUM_LANGS];
|
||||||
extern int need_own_font;
|
extern int need_own_font;
|
||||||
extern int need_right_to_left; // Right-justify
|
extern int need_right_to_left; // Right-justify
|
||||||
extern int need_right_to_left_word; // Words need to be reversed, too! (e.g., Hebrew, but not Arabic)
|
|
||||||
extern const char *lang_prefix, *short_lang_prefix;
|
extern const char *lang_prefix, *short_lang_prefix;
|
||||||
|
|
||||||
typedef struct w_langs
|
typedef struct w_langs
|
||||||
|
|
@ -193,7 +192,6 @@ typedef struct w_langs
|
||||||
int langint;
|
int langint;
|
||||||
int need_own_font;
|
int need_own_font;
|
||||||
int need_right_to_left;
|
int need_right_to_left;
|
||||||
int need_right_to_left_word;
|
|
||||||
int lang_y_nudge;
|
int lang_y_nudge;
|
||||||
const char *lang_prefix;
|
const char *lang_prefix;
|
||||||
const char *short_lang_prefix;
|
const char *short_lang_prefix;
|
||||||
|
|
|
||||||
|
|
@ -13414,7 +13414,6 @@ static char *loaddesc(const char *const fname, Uint8 * locale_text)
|
||||||
|
|
||||||
need_own_font = wished_langs[i].need_own_font;
|
need_own_font = wished_langs[i].need_own_font;
|
||||||
need_right_to_left = wished_langs[i].need_right_to_left;
|
need_right_to_left = wished_langs[i].need_right_to_left;
|
||||||
need_right_to_left_word = wished_langs[i].need_right_to_left_word;
|
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
||||||
|
|
@ -20369,57 +20368,12 @@ static wchar_t *uppercase_w(const wchar_t *restrict const str)
|
||||||
static char *textdir(const char *const str)
|
static char *textdir(const char *const str)
|
||||||
{
|
{
|
||||||
unsigned char *dstr;
|
unsigned char *dstr;
|
||||||
unsigned i, j;
|
|
||||||
unsigned char c1, c2, c3, c4;
|
|
||||||
|
|
||||||
DEBUG_PRINTF("ORIG_DIR: %s\n", str);
|
DEBUG_PRINTF("ORIG_DIR: %s\n", str);
|
||||||
|
|
||||||
dstr = malloc(strlen(str) + 5);
|
dstr = malloc(strlen(str) + 5);
|
||||||
|
|
||||||
if (need_right_to_left_word)
|
strcpy((char *)dstr, str); /* safe; malloc'd to a sufficient size */
|
||||||
{
|
|
||||||
dstr[strlen(str)] = '\0';
|
|
||||||
|
|
||||||
for (i = 0; i < strlen(str); i++)
|
|
||||||
{
|
|
||||||
j = (strlen(str) - i - 1);
|
|
||||||
|
|
||||||
c1 = (unsigned char)str[i + 0];
|
|
||||||
c2 = (unsigned char)str[i + 1];
|
|
||||||
c3 = (unsigned char)str[i + 2];
|
|
||||||
c4 = (unsigned char)str[i + 3];
|
|
||||||
|
|
||||||
if (c1 < 128) /* 0xxx xxxx - 1 byte */
|
|
||||||
{
|
|
||||||
dstr[j] = str[i];
|
|
||||||
}
|
|
||||||
else if ((c1 & 0xE0) == 0xC0) /* 110x xxxx - 2 bytes */
|
|
||||||
{
|
|
||||||
dstr[j - 1] = c1;
|
|
||||||
dstr[j - 0] = c2;
|
|
||||||
i = i + 1;
|
|
||||||
}
|
|
||||||
else if ((c1 & 0xF0) == 0xE0) /* 1110 xxxx - 3 bytes */
|
|
||||||
{
|
|
||||||
dstr[j - 2] = c1;
|
|
||||||
dstr[j - 1] = c2;
|
|
||||||
dstr[j - 0] = c3;
|
|
||||||
i = i + 2;
|
|
||||||
}
|
|
||||||
else /* 1111 0xxx - 4 bytes */
|
|
||||||
{
|
|
||||||
dstr[j - 3] = c1;
|
|
||||||
dstr[j - 2] = c2;
|
|
||||||
dstr[j - 1] = c3;
|
|
||||||
dstr[j - 0] = c4;
|
|
||||||
i = i + 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy((char *)dstr, str); /* safe; malloc'd to a sufficient size */
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_PRINTF("L2R_DIR: %s\n", dstr);
|
DEBUG_PRINTF("L2R_DIR: %s\n", dstr);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue