ElyDoc, ElyTable, ElyShow (LibreOfficeKit), ElyPDF (MuPDF), ElyTree (Git), ElyMark (Milkdown and CodeMirror in CEF). ElyMail and ElyAgent follow.
30 lines
906 B
Diff
30 lines
906 B
Diff
OCR fails when a requested language does not load.
|
|
|
|
Tesseract initialises with the languages it can load and drops the
|
|
rest; a page asked for in eng+chi_sim was read in English alone and
|
|
reported as a success (Ely OCR).
|
|
|
|
--- a/source/fitz/tessocr.cpp 2026-10-06 16:20:56
|
|
+++ b/source/fitz/tessocr.cpp 2026-10-06 16:20:56
|
|
@@ -144,6 +144,20 @@
|
|
delete api;
|
|
fz_clear_leptonica_mem(ctx);
|
|
fz_throw(ctx, FZ_ERROR_LIBRARY, "Tesseract language initialisation failed");
|
|
+ }
|
|
+
|
|
+ {
|
|
+ std::vector<std::string> loaded;
|
|
+ int wanted = 1;
|
|
+ for (const char *s = language; *s; s++)
|
|
+ wanted += *s == '+';
|
|
+ api->GetLoadedLanguagesAsVector(&loaded);
|
|
+ if ((int)loaded.size() < wanted)
|
|
+ {
|
|
+ delete api;
|
|
+ fz_clear_leptonica_mem(ctx);
|
|
+ fz_throw(ctx, FZ_ERROR_LIBRARY, "Tesseract loaded %d of %d languages in %s", (int)loaded.size(), wanted, language);
|
|
+ }
|
|
}
|
|
|
|
n = fz_count_options(ctx, options);
|