Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rust/lib_ccxr/src/common/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pub struct Options {
/// The name of the language stream for DVB
pub dvblang: Option<Language>,
/// The name of the .traineddata file to be loaded with tesseract
pub ocrlang: PathBuf,
pub ocrlang: Option<Language>,
/// The Tesseract OEM mode, could be 0 (default), 1 or 2
pub ocr_oem: i8,
/// The Tesseract PSM mode, could be between 0 and 13. 3 is tesseract default
Expand Down
4 changes: 2 additions & 2 deletions src/rust/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ pub unsafe fn copy_from_rust(ccx_s_options: *mut ccx_s_options, options: Options
if let Some(dvblang) = options.dvblang {
(*ccx_s_options).dvblang = string_to_c_char(dvblang.to_ctype().as_str());
}
if options.ocrlang.try_exists().unwrap_or_default() {
(*ccx_s_options).ocrlang = string_to_c_char(options.ocrlang.to_str().unwrap());
if let Some(ocrlang) = options.ocrlang {
(*ccx_s_options).ocrlang = string_to_c_char(ocrlang.to_ctype().as_str());
}
(*ccx_s_options).ocr_oem = options.ocr_oem as _;
(*ccx_s_options).ocr_quantmode = options.ocr_quantmode as _;
Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ impl OptionsExt for Options {
}

if let Some(ref ocrlang) = args.ocrlang {
self.ocrlang = PathBuf::from_str(ocrlang.as_str()).unwrap_or_default();
self.ocrlang = Some(Language::from_str(ocrlang.as_str()).unwrap());
}

if let Some(ref quant) = args.quant {
Expand Down
Loading