Merge pull request #2270 from Shreeshrii/U_ARABIC_NUMBER

Treat U_ARABIC_NUMBER as LTR
This commit is contained in:
zdenop 2019-02-28 09:27:54 +01:00 committed by GitHub
commit d7ddc4c5b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -398,8 +398,7 @@ class WERD_RES : public ELIST_LINK {
UNICHARSET::Direction dir =
uch_set->get_direction(unichar_id);
if (dir == UNICHARSET::U_RIGHT_TO_LEFT ||
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC ||
dir == UNICHARSET::U_ARABIC_NUMBER)
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC)
return true;
}
return false;
@ -413,7 +412,8 @@ class WERD_RES : public ELIST_LINK {
if (unichar_id < 0 || unichar_id >= uch_set->size())
continue; // Ignore illegal chars.
UNICHARSET::Direction dir = uch_set->get_direction(unichar_id);
if (dir == UNICHARSET::U_LEFT_TO_RIGHT)
if (dir == UNICHARSET::U_LEFT_TO_RIGHT ||
dir == UNICHARSET::U_ARABIC_NUMBER)
return true;
}
return false;

View File

@ -63,9 +63,10 @@ void BoxChar::GetDirection(int* num_rtl, int* num_ltr) const {
for (char32 ch : uni_vector) {
UCharDirection dir = u_charDirection(ch);
if (dir == U_RIGHT_TO_LEFT || dir == U_RIGHT_TO_LEFT_ARABIC ||
dir == U_ARABIC_NUMBER || dir == U_RIGHT_TO_LEFT_ISOLATE) {
dir == U_RIGHT_TO_LEFT_ISOLATE) {
++*num_rtl;
} else if (dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL) {
} else if ((dir == U_ARABIC_NUMBER) ||
(dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL)) {
++*num_ltr;
}
}