comparison mupdf-source/thirdparty/tesseract/src/training/unicharset/unicharset_training_utils.h @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 ///////////////////////////////////////////////////////////////////////
2 // File: unicharset_training_utils.h
3 // Description: Training utilities for UNICHARSET.
4 // Author: Ray Smith
5 //
6 // (C) Copyright 2014, Google Inc.
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 ///////////////////////////////////////////////////////////////////////
18
19 #ifndef TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_
20 #define TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_
21
22 #include "export.h"
23
24 #include <tesseract/export.h>
25
26 #include <string>
27
28 namespace tesseract {
29
30 class UNICHARSET;
31
32 // Helper sets the character attribute properties and sets up the script table.
33 // Does not set tops and bottoms.
34 TESS_UNICHARSET_TRAINING_API
35 void SetupBasicProperties(bool report_errors, bool decompose, UNICHARSET *unicharset);
36 // Default behavior is to compose, until it is proven that decomposed benefits
37 // at least one language.
38 inline void SetupBasicProperties(bool report_errors, UNICHARSET *unicharset) {
39 SetupBasicProperties(report_errors, false, unicharset);
40 }
41 // Helper sets the properties from universal script unicharsets, if found.
42 TESS_UNICHARSET_TRAINING_API
43 void SetScriptProperties(const std::string &script_dir, UNICHARSET *unicharset);
44 // Helper gets the combined x-heights string.
45 std::string GetXheightString(const std::string &script_dir, const UNICHARSET &unicharset);
46
47 // Helper to set the properties for an input unicharset file, writes to the
48 // output file. If an appropriate script unicharset can be found in the
49 // script_dir directory, then the tops and bottoms are expanded using the
50 // script unicharset.
51 // If non-empty, xheight data for the fonts are written to the xheights_file.
52 TESS_UNICHARSET_TRAINING_API
53 void SetPropertiesForInputFile(const std::string &script_dir,
54 const std::string &input_unicharset_file,
55 const std::string &output_unicharset_file,
56 const std::string &output_xheights_file);
57
58 } // namespace tesseract.
59
60 #endif // TESSERACT_TRAINING_UNICHARSET_TRAINING_UTILS_H_