461 {
462 for (
int i = 0;
i < 4; ++
i) {
464
465 BLOB_CHOICE_IT choice_it;
466 choice_it.set_to_list(scores +
i);
467
468 float prev_score = -1;
469 int script_count = 0;
470 int prev_id = -1;
471 int prev_fontinfo_id = -1;
472 const char *prev_unichar = "";
473 const char *unichar = "";
474
475 for (choice_it.mark_cycle_pt(); !choice_it.cycled_list(); choice_it.forward()) {
476 BLOB_CHOICE *choice = choice_it.data();
477 int id = choice->script_id();
478 if (allowed_scripts_ != nullptr && !allowed_scripts_->empty()) {
479
480 size_t s = 0;
481 for (s = 0; s < allowed_scripts_->size(); ++s) {
482 if ((*allowed_scripts_)[s] == id) {
483 break;
484 }
485 }
486 if (s == allowed_scripts_->size()) {
487 continue;
488 }
489 }
490
491 if (done.at(id)) {
492 continue;
493 }
494 done[id] = true;
495
497
498 if (prev_score < 0) {
499 prev_score = -choice->certainty();
500 script_count = 1;
501 prev_id = id;
502 prev_unichar = unichar;
503 prev_fontinfo_id = choice->fontinfo_id();
505 ++script_count;
506 }
507
508 if (strlen(prev_unichar) == 1) {
509 if (unichar[0] >= '0' && unichar[0] <= '9') {
510 break;
511 }
512 }
513
514
515
516 if (script_count >= 2) {
517 break;
518 }
519 }
520
521 if (script_count == 1) {
522
524
525
526 if (prev_id == latin_id_) {
527 if (prev_fontinfo_id >= 0) {
529
530
531
532
536 }
537 }
538 }
539
540
541 if (prev_id == katakana_id_) {
543 }
544 if (prev_id == hiragana_id_) {
546 }
547 if (prev_id == hangul_id_) {
549 }
550 if (prev_id == han_id_) {
553 }
554 }
555 }
556}
const float kNonAmbiguousMargin
const int kMaxNumberOfScripts
const float kHanRatioInJapanese
const float kHanRatioInKorean
float scripts_na[4][kMaxNumberOfScripts]
const char * id_to_unichar(UNICHAR_ID id) const
UnicityTable< FontInfo > & get_fontinfo_table()