kopt: honor TESSDATA_PREFIX environment variable

Don't override it by default, but honor it if present.
This commit is contained in:
Benoit Pierre
2024-06-01 00:25:59 +02:00
committed by Frans de Jonge
parent 14519bc076
commit 10e6f489d0
9 changed files with 5 additions and 23 deletions

View File

@@ -20,7 +20,10 @@ local util = require("util")
local KoptInterface = {
ocrengine = "ocrengine",
tessocr_data = DataStorage:getDataDir() .. "/data",
-- If `$TESSDATA_PREFIX` is set, don't override it: let libk2pdfopt honor it
-- (which includes checking for data in both `$TESSDATA_PREFIX/tessdata` and
-- in `$TESSDATA_PREFIX/` on more recent versions).
tessocr_data = not os.getenv('TESSDATA_PREFIX') and DataStorage:getDataDir().."/data" or nil,
ocr_lang = "eng",
ocr_type = 3, -- default 0, for more accuracy use 3
last_context_size = nil,