Skip to content

Commit 25b02bf

Browse files
committed
Treat U_ARABIC_NUMBER as LTR
1 parent 449f1cd commit 25b02bf

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/ccstruct/pageres.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ class WERD_RES : public ELIST_LINK {
398398
UNICHARSET::Direction dir =
399399
uch_set->get_direction(unichar_id);
400400
if (dir == UNICHARSET::U_RIGHT_TO_LEFT ||
401-
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC ||
402-
dir == UNICHARSET::U_ARABIC_NUMBER)
401+
dir == UNICHARSET::U_RIGHT_TO_LEFT_ARABIC)
403402
return true;
404403
}
405404
return false;
@@ -413,7 +412,8 @@ class WERD_RES : public ELIST_LINK {
413412
if (unichar_id < 0 || unichar_id >= uch_set->size())
414413
continue; // Ignore illegal chars.
415414
UNICHARSET::Direction dir = uch_set->get_direction(unichar_id);
416-
if (dir == UNICHARSET::U_LEFT_TO_RIGHT)
415+
if (dir == UNICHARSET::U_LEFT_TO_RIGHT ||
416+
dir == UNICHARSET::U_ARABIC_NUMBER)
417417
return true;
418418
}
419419
return false;

src/training/boxchar.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ void BoxChar::GetDirection(int* num_rtl, int* num_ltr) const {
6363
for (char32 ch : uni_vector) {
6464
UCharDirection dir = u_charDirection(ch);
6565
if (dir == U_RIGHT_TO_LEFT || dir == U_RIGHT_TO_LEFT_ARABIC ||
66-
dir == U_ARABIC_NUMBER || dir == U_RIGHT_TO_LEFT_ISOLATE) {
66+
dir == U_RIGHT_TO_LEFT_ISOLATE) {
6767
++*num_rtl;
68-
} else if (dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL) {
68+
} else if ((dir == U_ARABIC_NUMBER) ||
69+
(dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL)) {
6970
++*num_ltr;
7071
}
7172
}

0 commit comments

Comments
 (0)