1 ///////////////////////////////////////////////////////////////////////
2 // File:        capi.h
3 // Description: C-API TessBaseAPI
4 //
5 // (C) Copyright 2012, Google Inc.
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 ///////////////////////////////////////////////////////////////////////
17 
18 #ifndef API_CAPI_H_
19 #define API_CAPI_H_
20 
21 #ifdef TESS_CAPI_INCLUDE_BASEAPI
22 #   include "baseapi.h"
23 #   include "pageiterator.h"
24 #   include "resultiterator.h"
25 #   include "renderer.h"
26 #else
27 #   include "platform.h"
28 #   include <stdio.h>
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef TESS_CALL
36 #   if defined(WIN32)
37 #       define TESS_CALL __cdecl
38 #   else
39 #       define TESS_CALL
40 #   endif
41 #endif
42 
43 #ifndef BOOL
44 #   define BOOL int
45 #   define TRUE 1
46 #   define FALSE 0
47 #endif
48 
49 #ifdef TESS_CAPI_INCLUDE_BASEAPI
50 typedef tesseract::TessResultRenderer TessResultRenderer;
51 typedef tesseract::TessTextRenderer TessTextRenderer;
52 typedef tesseract::TessHOcrRenderer TessHOcrRenderer;
53 typedef tesseract::TessPDFRenderer TessPDFRenderer;
54 typedef tesseract::TessUnlvRenderer TessUnlvRenderer;
55 typedef tesseract::TessBoxTextRenderer TessBoxTextRenderer;
56 typedef tesseract::TessBaseAPI TessBaseAPI;
57 typedef tesseract::PageIterator TessPageIterator;
58 typedef tesseract::ResultIterator TessResultIterator;
59 typedef tesseract::MutableIterator TessMutableIterator;
60 typedef tesseract::ChoiceIterator TessChoiceIterator;
61 typedef tesseract::OcrEngineMode TessOcrEngineMode;
62 typedef tesseract::PageSegMode TessPageSegMode;
63 typedef tesseract::ImageThresholder TessImageThresholder;
64 typedef tesseract::PageIteratorLevel TessPageIteratorLevel;
65 typedef tesseract::DictFunc TessDictFunc;
66 typedef tesseract::ProbabilityInContextFunc TessProbabilityInContextFunc;
67 // typedef tesseract::ParamsModelClassifyFunc TessParamsModelClassifyFunc;
68 typedef tesseract::FillLatticeFunc TessFillLatticeFunc;
69 typedef tesseract::Dawg TessDawg;
70 typedef tesseract::TruthCallback TessTruthCallback;
71 typedef tesseract::Orientation TessOrientation;
72 typedef tesseract::ParagraphJustification TessParagraphJustification;
73 typedef tesseract::WritingDirection TessWritingDirection;
74 typedef tesseract::TextlineOrder TessTextlineOrder;
75 typedef PolyBlockType TessPolyBlockType;
76 #else
77 typedef struct TessResultRenderer TessResultRenderer;
78 typedef struct TessTextRenderer TessTextRenderer;
79 typedef struct TessHOcrRenderer TessHOcrRenderer;
80 typedef struct TessPDFRenderer TessPDFRenderer;
81 typedef struct TessUnlvRenderer TessUnlvRenderer;
82 typedef struct TessBoxTextRenderer TessBoxTextRenderer;
83 typedef struct TessBaseAPI TessBaseAPI;
84 typedef struct TessPageIterator TessPageIterator;
85 typedef struct TessResultIterator TessResultIterator;
86 typedef struct TessMutableIterator TessMutableIterator;
87 typedef struct TessChoiceIterator TessChoiceIterator;
88 typedef enum TessOcrEngineMode     { OEM_TESSERACT_ONLY, OEM_LSTM_ONLY, OEM_TESSERACT_LSTM_COMBINED, OEM_DEFAULT } TessOcrEngineMode;
89 typedef enum TessPageSegMode       { PSM_OSD_ONLY, PSM_AUTO_OSD, PSM_AUTO_ONLY, PSM_AUTO, PSM_SINGLE_COLUMN, PSM_SINGLE_BLOCK_VERT_TEXT,
90                                      PSM_SINGLE_BLOCK, PSM_SINGLE_LINE, PSM_SINGLE_WORD, PSM_CIRCLE_WORD, PSM_SINGLE_CHAR, PSM_SPARSE_TEXT,
91                                      PSM_SPARSE_TEXT_OSD, PSM_COUNT } TessPageSegMode;
92 typedef enum TessPageIteratorLevel { RIL_BLOCK, RIL_PARA, RIL_TEXTLINE, RIL_WORD, RIL_SYMBOL} TessPageIteratorLevel;
93 typedef enum TessPolyBlockType     { PT_UNKNOWN, PT_FLOWING_TEXT, PT_HEADING_TEXT, PT_PULLOUT_TEXT, PT_EQUATION, PT_INLINE_EQUATION,
94                                      PT_TABLE, PT_VERTICAL_TEXT, PT_CAPTION_TEXT, PT_FLOWING_IMAGE, PT_HEADING_IMAGE,
95                                      PT_PULLOUT_IMAGE, PT_HORZ_LINE, PT_VERT_LINE, PT_NOISE, PT_COUNT } TessPolyBlockType;
96 typedef enum TessOrientation       { ORIENTATION_PAGE_UP, ORIENTATION_PAGE_RIGHT, ORIENTATION_PAGE_DOWN, ORIENTATION_PAGE_LEFT } TessOrientation;
97 typedef enum TessParagraphJustification { JUSTIFICATION_UNKNOWN, JUSTIFICATION_LEFT, JUSTIFICATION_CENTER, JUSTIFICATION_RIGHT } TessParagraphJustification;
98 typedef enum TessWritingDirection  { WRITING_DIRECTION_LEFT_TO_RIGHT, WRITING_DIRECTION_RIGHT_TO_LEFT, WRITING_DIRECTION_TOP_TO_BOTTOM } TessWritingDirection;
99 typedef enum TessTextlineOrder     { TEXTLINE_ORDER_LEFT_TO_RIGHT, TEXTLINE_ORDER_RIGHT_TO_LEFT, TEXTLINE_ORDER_TOP_TO_BOTTOM } TessTextlineOrder;
100 typedef struct ETEXT_DESC ETEXT_DESC;
101 #endif
102 
103 struct Pix;
104 struct Boxa;
105 struct Pixa;
106 
107 /* General free functions */
108 
109 TESS_API const char*
110                TESS_CALL TessVersion();
111 TESS_API void  TESS_CALL TessDeleteText(char* text);
112 TESS_API void  TESS_CALL TessDeleteTextArray(char** arr);
113 TESS_API void  TESS_CALL TessDeleteIntArray(int* arr);
114 #ifdef TESS_CAPI_INCLUDE_BASEAPI
115 TESS_API void  TESS_CALL TessDeleteBlockList(BLOCK_LIST* block_list);
116 #endif
117 
118 /* Renderer API */
119 TESS_API TessResultRenderer* TESS_CALL TessTextRendererCreate(const char* outputbase);
120 TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate(const char* outputbase);
121 TESS_API TessResultRenderer* TESS_CALL TessHOcrRendererCreate2(const char* outputbase, BOOL font_info);
122 TESS_API TessResultRenderer* TESS_CALL TessPDFRendererCreate(const char* outputbase, const char* datadir);
123 TESS_API TessResultRenderer* TESS_CALL TessUnlvRendererCreate(const char* outputbase);
124 TESS_API TessResultRenderer* TESS_CALL TessBoxTextRendererCreate(const char* outputbase);
125 
126 TESS_API void TESS_CALL TessDeleteResultRenderer(TessResultRenderer* renderer);
127 TESS_API void TESS_CALL TessResultRendererInsert(TessResultRenderer* renderer, TessResultRenderer* next);
128 TESS_API TessResultRenderer*
129               TESS_CALL TessResultRendererNext(TessResultRenderer* renderer);
130 TESS_API BOOL TESS_CALL TessResultRendererBeginDocument(TessResultRenderer* renderer, const char* title);
131 TESS_API BOOL TESS_CALL TessResultRendererAddImage(TessResultRenderer* renderer, TessBaseAPI* api);
132 TESS_API BOOL TESS_CALL TessResultRendererEndDocument(TessResultRenderer* renderer);
133 
134 TESS_API const char* TESS_CALL TessResultRendererExtention(TessResultRenderer* renderer);
135 TESS_API const char* TESS_CALL TessResultRendererTitle(TessResultRenderer* renderer);
136 TESS_API int TESS_CALL TessResultRendererImageNum(TessResultRenderer* renderer);
137 
138 /* Base API */
139 
140 TESS_API TessBaseAPI*
141                TESS_CALL TessBaseAPICreate();
142 TESS_API void  TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);
143 
144 TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle, void **device);
145 
146 TESS_API void  TESS_CALL TessBaseAPISetInputName( TessBaseAPI* handle, const char* name);
147 TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);
148 
149 TESS_API void  TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle, struct Pix* pix);
150 TESS_API struct Pix*  TESS_CALL TessBaseAPIGetInputImage(TessBaseAPI* handle);
151 
152 TESS_API int   TESS_CALL TessBaseAPIGetSourceYResolution(TessBaseAPI* handle);
153 TESS_API const char* TESS_CALL TessBaseAPIGetDatapath(TessBaseAPI* handle);
154 
155 TESS_API void  TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle, const char* name);
156 
157 TESS_API BOOL  TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value);
158 TESS_API BOOL  TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle, const char* name, const char* value);
159 
160 TESS_API BOOL  TESS_CALL TessBaseAPIGetIntVariable(   const TessBaseAPI* handle, const char* name, int* value);
161 TESS_API BOOL  TESS_CALL TessBaseAPIGetBoolVariable(  const TessBaseAPI* handle, const char* name, BOOL* value);
162 TESS_API BOOL  TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle, const char* name, double* value);
163 TESS_API const char*
164                TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name);
165 
166 TESS_API void  TESS_CALL TessBaseAPIPrintVariables(      const TessBaseAPI* handle, FILE* fp);
167 TESS_API BOOL  TESS_CALL TessBaseAPIPrintVariablesToFile(const TessBaseAPI* handle, const char* filename);
168 #ifdef TESS_CAPI_INCLUDE_BASEAPI
169 TESS_API BOOL  TESS_CALL TessBaseAPIGetVariableAsString(TessBaseAPI* handle, const char* name, STRING* val);
170 #endif
171 
172 #ifdef TESS_CAPI_INCLUDE_BASEAPI
173 TESS_API int   TESS_CALL TessBaseAPIInit(TessBaseAPI* handle, const char* datapath, const char* language,
174                                          TessOcrEngineMode mode, char** configs, int configs_size,
175                                          const STRING* vars_vec, size_t vars_vec_size,
176                                          const STRING* vars_values, size_t vars_values_size, BOOL set_only_init_params);
177 #endif
178 TESS_API int   TESS_CALL TessBaseAPIInit1(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem,
179                                           char** configs, int configs_size);
180 TESS_API int   TESS_CALL TessBaseAPIInit2(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode oem);
181 TESS_API int   TESS_CALL TessBaseAPIInit3(TessBaseAPI* handle, const char* datapath, const char* language);
182 
183 TESS_API int TESS_CALL TessBaseAPIInit4(TessBaseAPI* handle, const char* datapath, const char* language, TessOcrEngineMode mode,
184     char** configs, int configs_size,
185     char** vars_vec, char** vars_values, size_t vars_vec_size,
186     BOOL set_only_non_debug_params);
187 
188 TESS_API const char*
189                TESS_CALL TessBaseAPIGetInitLanguagesAsString(const TessBaseAPI* handle);
190 TESS_API char**
191                TESS_CALL TessBaseAPIGetLoadedLanguagesAsVector(const TessBaseAPI* handle);
192 TESS_API char**
193                TESS_CALL TessBaseAPIGetAvailableLanguagesAsVector(const TessBaseAPI* handle);
194 
195 TESS_API int   TESS_CALL TessBaseAPIInitLangMod(TessBaseAPI* handle, const char* datapath, const char* language);
196 TESS_API void  TESS_CALL TessBaseAPIInitForAnalysePage(TessBaseAPI* handle);
197 
198 TESS_API void  TESS_CALL TessBaseAPIReadConfigFile(TessBaseAPI* handle, const char* filename);
199 TESS_API void  TESS_CALL TessBaseAPIReadDebugConfigFile(TessBaseAPI* handle, const char* filename);
200 
201 TESS_API void  TESS_CALL TessBaseAPISetPageSegMode(TessBaseAPI* handle, TessPageSegMode mode);
202 TESS_API TessPageSegMode
203                TESS_CALL TessBaseAPIGetPageSegMode(const TessBaseAPI* handle);
204 
205 TESS_API char* TESS_CALL TessBaseAPIRect(TessBaseAPI* handle, const unsigned char* imagedata,
206                                          int bytes_per_pixel, int bytes_per_line,
207                                          int left, int top, int width, int height);
208 
209 TESS_API void  TESS_CALL TessBaseAPIClearAdaptiveClassifier(TessBaseAPI* handle);
210 
211 TESS_API void  TESS_CALL TessBaseAPISetImage(TessBaseAPI* handle, const unsigned char* imagedata, int width, int height,
212                                              int bytes_per_pixel, int bytes_per_line);
213 TESS_API void  TESS_CALL TessBaseAPISetImage2(TessBaseAPI* handle, struct Pix* pix);
214 
215 TESS_API void TESS_CALL TessBaseAPISetSourceResolution(TessBaseAPI* handle, int ppi);
216 
217 TESS_API void  TESS_CALL TessBaseAPISetRectangle(TessBaseAPI* handle, int left, int top, int width, int height);
218 
219 #ifdef TESS_CAPI_INCLUDE_BASEAPI
220 TESS_API void  TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImageThresholder* thresholder);
221 #endif
222 
223 TESS_API struct Pix*
224                TESS_CALL TessBaseAPIGetThresholdedImage(   TessBaseAPI* handle);
225 TESS_API struct Boxa*
226                TESS_CALL TessBaseAPIGetRegions(            TessBaseAPI* handle, struct Pixa** pixa);
227 TESS_API struct Boxa*
228                TESS_CALL TessBaseAPIGetTextlines(          TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
229 TESS_API struct Boxa*
230                TESS_CALL TessBaseAPIGetTextlines1(         TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
231                                                                                 struct Pixa** pixa, int** blockids, int** paraids);
232 TESS_API struct Boxa*
233                TESS_CALL TessBaseAPIGetStrips(             TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
234 TESS_API struct Boxa*
235                TESS_CALL TessBaseAPIGetWords(              TessBaseAPI* handle, struct Pixa** pixa);
236 TESS_API struct Boxa*
237                TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
238 TESS_API struct Boxa*
239                TESS_CALL TessBaseAPIGetComponentImages(    TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
240                                                            struct Pixa** pixa, int** blockids);
241 TESS_API struct Boxa*
242                TESS_CALL TessBaseAPIGetComponentImages1(   TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
243                                                            const BOOL raw_image, const int raw_padding,
244                                                            struct Pixa** pixa, int** blockids, int** paraids);
245 
246 TESS_API int   TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle);
247 
248 TESS_API void  TESS_CALL TessBaseAPIDumpPGM(TessBaseAPI* handle, const char* filename);
249 
250 TESS_API TessPageIterator*
251                TESS_CALL TessBaseAPIAnalyseLayout(TessBaseAPI* handle);
252 
253 TESS_API int   TESS_CALL TessBaseAPIRecognize(TessBaseAPI* handle, ETEXT_DESC* monitor);
254 TESS_API int   TESS_CALL TessBaseAPIRecognizeForChopTest(TessBaseAPI* handle, ETEXT_DESC* monitor);
255 TESS_API BOOL  TESS_CALL TessBaseAPIProcessPages(TessBaseAPI* handle,  const char* filename, const char* retry_config,
256                                                  int timeout_millisec, TessResultRenderer* renderer);
257 TESS_API BOOL  TESS_CALL TessBaseAPIProcessPage(TessBaseAPI* handle, struct Pix* pix, int page_index, const char* filename,
258                                                const char* retry_config, int timeout_millisec, TessResultRenderer* renderer);
259 
260 TESS_API TessResultIterator*
261                TESS_CALL TessBaseAPIGetIterator(TessBaseAPI* handle);
262 TESS_API TessMutableIterator*
263                TESS_CALL TessBaseAPIGetMutableIterator(TessBaseAPI* handle);
264 
265 TESS_API char* TESS_CALL TessBaseAPIGetUTF8Text(TessBaseAPI* handle);
266 TESS_API char* TESS_CALL TessBaseAPIGetHOCRText(TessBaseAPI* handle, int page_number);
267 TESS_API char* TESS_CALL TessBaseAPIGetBoxText(TessBaseAPI* handle, int page_number);
268 TESS_API char* TESS_CALL TessBaseAPIGetUNLVText(TessBaseAPI* handle);
269 TESS_API int   TESS_CALL TessBaseAPIMeanTextConf(TessBaseAPI* handle);
270 TESS_API int*  TESS_CALL TessBaseAPIAllWordConfidences(TessBaseAPI* handle);
271 TESS_API BOOL  TESS_CALL TessBaseAPIAdaptToWordStr(TessBaseAPI* handle, TessPageSegMode mode, const char* wordstr);
272 
273 TESS_API void  TESS_CALL TessBaseAPIClear(TessBaseAPI* handle);
274 TESS_API void  TESS_CALL TessBaseAPIEnd(TessBaseAPI* handle);
275 
276 TESS_API int   TESS_CALL TessBaseAPIIsValidWord(TessBaseAPI* handle, const char* word);
277 TESS_API BOOL  TESS_CALL TessBaseAPIGetTextDirection(TessBaseAPI* handle, int* out_offset, float* out_slope);
278 
279 #ifdef TESS_CAPI_INCLUDE_BASEAPI
280 TESS_API void  TESS_CALL TessBaseAPISetDictFunc(TessBaseAPI* handle, TessDictFunc f);
281 TESS_API void  TESS_CALL TessBaseAPIClearPersistentCache(TessBaseAPI* handle);
282 TESS_API void  TESS_CALL TessBaseAPISetProbabilityInContextFunc(TessBaseAPI* handle, TessProbabilityInContextFunc f);
283 
284 TESS_API void  TESS_CALL TessBaseAPISetFillLatticeFunc(TessBaseAPI* handle, TessFillLatticeFunc f);
285 
286 // Call TessDeleteText(*best_script_name) to free memory allocated by this function
287 TESS_API BOOL  TESS_CALL TessBaseAPIDetectOrientationScript(TessBaseAPI* handle,
288                                                             int* orient_deg, float* orient_conf, const char **script_name, float* script_conf);
289 
290 TESS_API void  TESS_CALL TessBaseAPIGetFeaturesForBlob(TessBaseAPI* handle, TBLOB* blob, INT_FEATURE_STRUCT* int_features,
291                                                        int* num_features, int* FeatureOutlineIndex);
292 
293 TESS_API ROW*  TESS_CALL TessFindRowForBox(BLOCK_LIST* blocks, int left, int top, int right, int bottom);
294 TESS_API void  TESS_CALL TessBaseAPIRunAdaptiveClassifier(TessBaseAPI* handle, TBLOB* blob, int num_max_matches,
295                                                           int* unichar_ids, float* ratings, int* num_matches_returned);
296 #endif
297 
298 TESS_API const char*
299                TESS_CALL TessBaseAPIGetUnichar(TessBaseAPI* handle, int unichar_id);
300 
301 #ifdef TESS_CAPI_INCLUDE_BASEAPI
302 TESS_API const TessDawg*
303                TESS_CALL TessBaseAPIGetDawg(const TessBaseAPI* handle, int i);
304 TESS_API int   TESS_CALL TessBaseAPINumDawgs(const TessBaseAPI* handle);
305 #endif
306 
307 #ifdef TESS_CAPI_INCLUDE_BASEAPI
308 TESS_API ROW*  TESS_CALL TessMakeTessOCRRow(float baseline, float xheight, float descender, float ascender);
309 TESS_API TBLOB*
310                TESS_CALL TessMakeTBLOB(Pix* pix);
311 TESS_API void  TESS_CALL TessNormalizeTBLOB(TBLOB* tblob, ROW* row, BOOL numeric_mode);
312 
313 TESS_API TessOcrEngineMode
314                TESS_CALL TessBaseAPIOem(const TessBaseAPI* handle);
315 TESS_API void  TESS_CALL TessBaseAPIInitTruthCallback(TessBaseAPI* handle, TessTruthCallback* cb);
316 #endif
317 
318 TESS_API void  TESS_CALL TessBaseAPISetMinOrientationMargin(TessBaseAPI* handle, double margin);
319 #ifdef TESS_CAPI_INCLUDE_BASEAPI
320 TESS_API void  TESS_CALL TessBaseGetBlockTextOrientations(TessBaseAPI* handle, int** block_orientation, BOOL** vertical_writing);
321 
322 TESS_API BLOCK_LIST*
323                TESS_CALL TessBaseAPIFindLinesCreateBlockList(TessBaseAPI* handle);
324 #endif
325 
326 /* Page iterator */
327 
328 TESS_API void  TESS_CALL TessPageIteratorDelete(TessPageIterator* handle);
329 TESS_API TessPageIterator*
330                TESS_CALL TessPageIteratorCopy(const TessPageIterator* handle);
331 
332 TESS_API void  TESS_CALL TessPageIteratorBegin(TessPageIterator* handle);
333 TESS_API BOOL  TESS_CALL TessPageIteratorNext(TessPageIterator* handle, TessPageIteratorLevel level);
334 TESS_API BOOL  TESS_CALL TessPageIteratorIsAtBeginningOf(const TessPageIterator* handle, TessPageIteratorLevel level);
335 TESS_API BOOL  TESS_CALL TessPageIteratorIsAtFinalElement(const TessPageIterator* handle, TessPageIteratorLevel level,
336                                                           TessPageIteratorLevel element);
337 
338 TESS_API BOOL  TESS_CALL TessPageIteratorBoundingBox(const TessPageIterator* handle, TessPageIteratorLevel level,
339                                                      int* left, int* top, int* right, int* bottom);
340 TESS_API TessPolyBlockType
341                TESS_CALL TessPageIteratorBlockType(const TessPageIterator* handle);
342 
343 TESS_API struct Pix*
344                TESS_CALL TessPageIteratorGetBinaryImage(const TessPageIterator* handle, TessPageIteratorLevel level);
345 TESS_API struct Pix*
346                TESS_CALL TessPageIteratorGetImage(const TessPageIterator* handle, TessPageIteratorLevel level, int padding,
347                                                   struct Pix* original_image, int* left, int* top);
348 
349 TESS_API BOOL  TESS_CALL TessPageIteratorBaseline(const TessPageIterator* handle, TessPageIteratorLevel level,
350                                                   int* x1, int* y1, int* x2, int* y2);
351 
352 TESS_API void  TESS_CALL TessPageIteratorOrientation(TessPageIterator* handle, TessOrientation* orientation,
353                                                      TessWritingDirection* writing_direction, TessTextlineOrder* textline_order,
354                                                      float* deskew_angle);
355 
356 TESS_API void  TESS_CALL TessPageIteratorParagraphInfo(TessPageIterator* handle, TessParagraphJustification* justification,
357                                                        BOOL *is_list_item, BOOL *is_crown, int *first_line_indent);
358 
359 /* Result iterator */
360 
361 TESS_API void  TESS_CALL TessResultIteratorDelete(TessResultIterator* handle);
362 TESS_API TessResultIterator*
363                TESS_CALL TessResultIteratorCopy(const TessResultIterator* handle);
364 TESS_API TessPageIterator*
365                TESS_CALL TessResultIteratorGetPageIterator(TessResultIterator* handle);
366 TESS_API const TessPageIterator*
367                TESS_CALL TessResultIteratorGetPageIteratorConst(const TessResultIterator* handle);
368 TESS_API TessChoiceIterator*
369                TESS_CALL TessResultIteratorGetChoiceIterator(const TessResultIterator* handle);
370 
371 TESS_API BOOL  TESS_CALL TessResultIteratorNext(TessResultIterator* handle, TessPageIteratorLevel level);
372 TESS_API char* TESS_CALL TessResultIteratorGetUTF8Text(const TessResultIterator* handle, TessPageIteratorLevel level);
373 TESS_API float TESS_CALL TessResultIteratorConfidence(const TessResultIterator* handle, TessPageIteratorLevel level);
374 TESS_API const char*
375                TESS_CALL TessResultIteratorWordRecognitionLanguage(const TessResultIterator* handle);
376 TESS_API const char*
377                TESS_CALL TessResultIteratorWordFontAttributes(const TessResultIterator* handle, BOOL* is_bold, BOOL* is_italic,
378                                                               BOOL* is_underlined, BOOL* is_monospace, BOOL* is_serif,
379                                                               BOOL* is_smallcaps, int* pointsize, int* font_id);
380 
381 TESS_API BOOL  TESS_CALL TessResultIteratorWordIsFromDictionary(const TessResultIterator* handle);
382 TESS_API BOOL  TESS_CALL TessResultIteratorWordIsNumeric(const TessResultIterator* handle);
383 TESS_API BOOL  TESS_CALL TessResultIteratorSymbolIsSuperscript(const TessResultIterator* handle);
384 TESS_API BOOL  TESS_CALL TessResultIteratorSymbolIsSubscript(const TessResultIterator* handle);
385 TESS_API BOOL  TESS_CALL TessResultIteratorSymbolIsDropcap(const TessResultIterator* handle);
386 
387 TESS_API void  TESS_CALL TessChoiceIteratorDelete(TessChoiceIterator* handle);
388 TESS_API BOOL  TESS_CALL TessChoiceIteratorNext(TessChoiceIterator* handle);
389 TESS_API const char* TESS_CALL TessChoiceIteratorGetUTF8Text(const TessChoiceIterator* handle);
390 TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator* handle);
391 
392 #ifdef __cplusplus
393 }
394 #endif
395 
396 #endif  // API_CAPI_H_
397