mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 11:09:06 +08:00
Merge pull request #2270 from Shreeshrii/U_ARABIC_NUMBER
Treat U_ARABIC_NUMBER as LTR
This commit is contained in:
commit
d7ddc4c5b7
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user