mupdf
Loading...
Searching...
No Matches
structured-text.h
Go to the documentation of this file.
1// Copyright (C) 2004-2026 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef MUPDF_FITZ_STRUCTURED_TEXT_H
24#define MUPDF_FITZ_STRUCTURED_TEXT_H
25
26#include "mupdf/fitz/system.h"
27#include "mupdf/fitz/types.h"
28#include "mupdf/fitz/context.h"
29#include "mupdf/fitz/geometry.h"
30#include "mupdf/fitz/font.h"
31#include "mupdf/fitz/image.h"
32#include "mupdf/fitz/output.h"
33#include "mupdf/fitz/device.h"
34#include "mupdf/fitz/pool.h"
35
39typedef struct fz_layout_char
40{
41 float x, advance;
42 const char *p; /* location in source text of character */
45
46typedef struct fz_layout_line
47{
48 float x, y, font_size;
49 const char *p; /* location in source text of start of line */
53
62
68
75
79void fz_add_layout_line(fz_context *ctx, fz_layout_block *block, float x, float y, float h, const char *p);
80
84void fz_add_layout_char(fz_context *ctx, fz_layout_block *block, float x, float w, const char *p);
85
91
97
194enum
195{
218
219 /* An old, deprecated option. */
221};
222
327
328typedef struct
329{
332 int page;
334
343typedef struct
344{
345 int refs;
349
350 /* The following fields are only of use to the routines that
351 * build an fz_stext_page. They change during page construction
352 * and their meaning is subject to change. These values should
353 * not be used by anything outside of the stext device. */
356
357 /* An array of fz_stext_page_details */
360
365
370
371enum
372{
378};
379
380enum
381{
387};
388
389enum
390{
391 /* Indicates that this vector came from a stroked
392 * path. */
394
395 /* Indicates that this vector came from a rectangular
396 * (axis-aligned) path (or path segment). */
398
399 /* Indicates that this vector came from a path
400 * segment, and more segments from this same path are
401 * still to come. */
403
404 /* Indicates that this was detected as being
405 * part of an underline/strikeout/highlight. */
409};
410
411enum
412{
413 /* Indicates that cell contents cross the right hand edge. */
415 /* Indicates that cell contents cross the bottom edge. */
417 /* Indicates that the cell has a border on the left hand edge. */
419 /* Indicates that the cell has a border on the top edge. */
421 /* Indicates that the cell has content (which may be a space!) */
423};
424
425/* This structure is experimental, and subject to change. */
426typedef struct
427{
428 /* A 2x2 table, will be represented as a 3x3 set of
429 * cells. The rightmost column and bottommost row
430 * exist just to give information about borders on
431 * the edges. For such a table w=h=3.
432 */
433 int w;
434 int h;
435 /* Followed by w*h entries. */
436 struct {
437 unsigned int flags;
440
446{
447 int type;
448 int id;
450 union {
453 struct { fz_stext_struct *down; int index; } s;
454 struct { uint32_t flags; uint32_t argb; } v;
456 } u;
458};
459
464
469{
470 uint8_t wmode; /* 0 for horizontal, 1 for vertical */
471 uint8_t flags;
472 fz_point dir; /* normalized direction of baseline */
476};
477
483{
484 int c; /* unicode character value */
485 uint16_t bidi; /* even for LTR, odd for RTL - probably only needs 8 bits? */
486 uint16_t flags;
487 uint32_t argb; /* sRGB hex color (alpha in top 8 bits, then r, then g, then b in low bits) */
490 float size;
493};
494
495enum
496{
500 FZ_STEXT_BOLD = 8, /* Either real or 'fake' bold */
508};
509
521{
522 /* up points to the block that contains this fz_stext_struct. */
524 /* parent points to the struct that has up as one of its children.
525 * parent is useful for doing depth first traversal without having
526 * to store the entire chain of structs in the iterator. */
528
529 /* first_block points to the first child of this node (or NULL
530 * if there are none). */
532 /* last_block points to the last child of this node (or NULL
533 * if there are none). */
535
536 /* We have a set of 'standard' structure types. Every structure
537 * element should correspond to one of these. */
539 /* Documents can use their own non-standard structure types, which
540 * are held as 'raw' strings. */
542};
543
544/* An example to show how fz_stext_blocks and fz_stext_structs interact:
545 *
546 * [fz_stext_page]
547 * |
548 * first_block|
549 * |
550 * \|/
551 * [fz_stext_block:TEXT]<->[fz_stext_block:STRUCT]<->[fz_stext_block:IMG]
552 * u.s.down| /|\
553 * | |
554 * \|/ |up
555 * [fz_stext_struct]<---------.
556 * | | |
557 * first_block| |last_block |
558 * _______________________| | |
559 * | | |
560 * | | |
561 * \|/ \|/ |
562 * [fz_stext_block:...]<->...<->[fz_stext_block:STRUCT] |
563 * | /|\ |
564 * u.s.down| |up |
565 * \|/ | parent|
566 * [fz_stext_struct]--------'
567 * | |
568 * first_block| |last_block
569 * : :
570 */
571
572 typedef struct
573 {
575 float pos;
576 float min;
577 float max;
580
587
588FZ_DATA extern const char *fz_stext_options_usage;
589
600
607
614
619
629
634
635
640
645
656int fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max);
657
666typedef int (fz_search_callback_fn)(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox);
667
676typedef int (fz_match_callback_fn)(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox, int chapter, int page);
677
691int fz_search_stext_page_cb(fz_context *ctx, fz_stext_page *text, const char *needle, fz_search_callback_fn *cb, void *opaque);
692
697int fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_point a, fz_point b, fz_quad *quads, int max_quads);
698
699enum
700{
704};
705
707
715char *fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_point a, fz_point b, int crlf);
716
724char *fz_copy_rectangle(fz_context *ctx, fz_stext_page *page, fz_rect area, int crlf);
725
733
734enum {
735 /* Never collapse the contents of bordered cells vertically. */
737
738 /* Always collapse the contents of bordered cells vertically. */
740};
741
743
751
757
758
769
771
779
785
802
828
833
839
845
863
885
897int
899
900
917
950fz_device *
951fz_new_stext_device_for_page(fz_context *ctx, fz_stext_page *stext_page, const fz_stext_options *opts, int chapter_num, int page_num, fz_rect mediabox);
952
953
996fz_device *fz_new_ocr_device(fz_context *ctx, fz_device *target, fz_matrix ctm, fz_rect mediabox, int with_list, const char *language,
997 const char *datadir, int (*progress)(fz_context *, void *, int), void *progress_arg);
998
999fz_device *fz_new_ocr_device_with_options(fz_context *ctx, fz_device *target, fz_matrix ctm, fz_rect mediabox, int with_list, const char *language,
1000 const char *datadir, int (*progress)(fz_context *, void *, int), void *progress_arg, fz_options *options);
1001
1003
1008
1013
1018
1019typedef struct fz_search fz_search;
1020
1031
1032FZ_DATA extern const char *fz_search_options_usage;
1033
1035
1037
1039
1045fz_search *fz_new_search(fz_context *ctx, const char *needle, fz_search_options options);
1046
1047typedef enum
1048{
1049 /* Ran out of stext to search. Please feed me some more. */
1051
1052 /* We have a match. match structure has been populated. */
1054
1055 /* Search complete */
1058
1059typedef struct
1060{
1061 int seq;
1064
1073
1081
1085typedef struct
1086{
1088 union
1089 {
1092 } u;
1094
1107
1121
1147void fz_feed_search(fz_context *ctx, fz_search *search, fz_stext_page *page, int seq);
1148
1153
1164int fz_match_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options);
1165
1179int fz_match_stext_page_cb(fz_context *ctx, fz_stext_page *page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options);
1180
1181/*
1182 Allocator function to make a new STRUCT stext block to be used in
1183 a given page (and it's 'down' structure, initially empty). Not
1184 linked in to the overall page structure yet.
1185*/
1186fz_stext_block *fz_new_stext_struct(fz_context *ctx, fz_stext_page *page, fz_structure standard, const char *raw, int index);
1187
1188/* Iterators for walking over stext pages */
1189
1190/*
1191 Iterator definition. The parts of this are subject to change.
1192*/
1200
1201/*
1202 Create a new iterator, initialised to point at the first block on the page.
1203*/
1205
1206/*
1207 Create a new iterator, initialised to point at the given point on the page.
1208*/
1210
1211/*
1212 Create a new iterator, initialised to point at the first non-struct block on the page
1213 in depth first search order.
1214*/
1216
1217/*
1218 Create a new iterator, initialised to point at the first non-struct block on the page
1219 in depth first search order after the given point. The start point is recorded so that
1220 the DFS search will 'eod' at the end of the level that block is in.
1221*/
1223
1224/*
1225 Create a new iterator, initialised to point at the first non-struct block on the page
1226 in reverse depth first search order.
1227*/
1229
1230/*
1231 Create a new iterator, initialised to point at the first non-struct block on the page
1232 in reverse depth first search order after the given point. The start point is recorded so that
1233 the DFS search will 'eod' at the start of the level that block is in.
1234*/
1236
1237/*
1238 Move to the next block (never moving upwards).
1239
1240 If there is no next block, iterator.block is returned as NULL.
1241*/
1243
1244/*
1245 On a structure block, this moves the iterator down to the first child of
1246 that block.
1247
1248 On any other block, this does nothing.
1249*/
1251
1252/*
1253 Move up to the parent of the current block.
1254
1255 If there is no parent, iterator.block is return as NULL.
1256*/
1258
1259/*
1260 Move to the next block (in a depth first traversal style).
1261
1262 The iterator never stops on struct blocks, and instead steps into them.
1263 At the end of a set of child blocks, it will move back to the parent and
1264 continue from there. It will never move past the parent given to begin_from,
1265 if used.
1266*/
1268
1269/*
1270 Move to the next block (in a reverse depth first traversal style).
1271
1272 The iterator never stops on struct blocks, and instead steps into them.
1273 At the end of a set of child blocks, it will move back to the parent and
1274 continue from there. It will never most past the parent given to begin_from,
1275 if used.
1276*/
1278
1279/*
1280 Return true if the iterator is at the end of a list of blocks.
1281 (No attempt is made to account for whether there is more data after a
1282 parent block).
1283*/
1285
1286/*
1287 Return true if the iterator is at the end of a depth first traversal
1288 of the stext page. The depth first traversal endpoint will be the
1289 end of the page, or (if begin_from was used) the end of the level
1290 given at init time.
1291*/
1293
1294/*
1295 Return true if the iterator is at the end of a reverse depth first
1296 traversal of the stext page. The reverse depth first traversal endpoint
1297 will be the start of the page, or (if begin_from was used) the start
1298 of the level given at init time.
1299*/
1301
1302/*
1303 Update a given stext page so that the contents within it that fall
1304 within the given rectangle are contained within a structure tag of the
1305 given classification.
1306
1307 The code tries not to change the ordering of content as seen from
1308 a depth first traversal as it does this.
1309
1310 This is an experimental interface. It may be updated or removed in
1311 future with no warning!
1312*/
1313void
1315
1316/*
1317 Remove any prefix of large white rectangular vectors that (almost)
1318 fills the page from the stext.
1319
1320 This is an experimental interface. It may be updated or removed in
1321 future with no warning!
1322*/
1323int
1325
1326typedef struct
1327{
1328 /* The maximum width or height that should be considered for rafting. */
1330 /* If non-zero, make a combined image, rather than just the bbox. */
1333
1334void
1336
1337/*
1338 Flotilla/Raft handling
1339
1340 We call any 2-dimensional area that's covered by (some type of) content
1341 a raft. i.e. it's made up of several distinct objects ("planks") lashed
1342 together into something that covers a large flat area (a "raft").
1343
1344 The set of all such non-overlapping rafts on a page can be called a
1345 "flotilla".
1346
1347 For instance, the borders and/or backgrounds from a table would form a
1348 raft behind the text content. And the boundaries of that raft might
1349 help us distinguish that table from an adjacent table on a different
1350 raft.
1351
1352 While we could theoretically make rafts from anything, images and
1353 vectors seem like the best bet. We could make rafts from mixed images
1354 and vectors, but to start with, I think we'll get best results from
1355 images and vectors separately.
1356*/
1358
1359/*
1360 Construct a flotilla from all the (rectangular) vectors on a page.
1361*/
1364
1365/*
1366 Drop the flotilla.
1367*/
1368void
1370
1371/*
1372 How many rafts in this flotilla?
1373*/
1374int
1376
1377/*
1378 Return the bounds of the ith raft in the flotilla.
1379*/
1380fz_rect
1382
1383/*
1384 Internal debugging function to verify the soundness
1385 of an stext page.
1386
1387 title: optional string to be printed.
1388*/
1389void fz_verify_stext_page(fz_context *ctx, fz_stext_page *page, const char *title);
1390
1391#endif
fz_structure
Definition device.h:194
#define FZ_DATA
Definition export.h:49
void HEAP_TYPE_NAME HEAP_CONTAINER_TYPE v
Definition heap-imp.h:51
struct fz_pool_array fz_pool_array
Definition pool.h:83
struct fz_pool fz_pool
Definition pool.h:34
Definition context.h:886
Definition device.h:290
Definition document.h:1080
Definition font.h:776
Definition structured-text.h:1327
int combine_image
Definition structured-text.h:1331
int max_size
Definition structured-text.h:1329
Definition image.h:351
Definition structured-text.h:55
fz_matrix inv_matrix
Definition structured-text.h:58
fz_layout_line * head
Definition structured-text.h:59
fz_matrix matrix
Definition structured-text.h:57
fz_pool * pool
Definition structured-text.h:56
fz_layout_char ** text_tailp
Definition structured-text.h:60
fz_layout_line ** tailp
Definition structured-text.h:59
Definition structured-text.h:40
float advance
Definition structured-text.h:41
float x
Definition structured-text.h:41
const char * p
Definition structured-text.h:42
struct fz_layout_char * next
Definition structured-text.h:43
Definition structured-text.h:47
fz_layout_char * text
Definition structured-text.h:50
struct fz_layout_line * next
Definition structured-text.h:51
float y
Definition structured-text.h:48
const char * p
Definition structured-text.h:49
float x
Definition structured-text.h:48
float font_size
Definition structured-text.h:48
Definition geometry.h:388
Definition options.h:207
Definition output.h:111
Definition geometry.h:187
Definition geometry.h:782
Definition geometry.h:231
Definition structured-text.h:1075
int end_seq
Definition structured-text.h:1079
fz_stext_position end
Definition structured-text.h:1078
fz_search_quad * quads
Definition structured-text.h:1077
int num_quads
Definition structured-text.h:1076
fz_stext_position begin
Definition structured-text.h:1078
int begin_seq
Definition structured-text.h:1079
Definition structured-text.h:1060
fz_quad quad
Definition structured-text.h:1062
int seq
Definition structured-text.h:1061
Definition structured-text.h:1086
fz_search_reason reason
Definition structured-text.h:1087
fz_search_match * match
Definition structured-text.h:1091
int seq_needed
Definition structured-text.h:1090
Definition structured-text.h:446
fz_stext_grid_positions * ys
Definition structured-text.h:455
fz_stext_line * first_line
Definition structured-text.h:451
fz_rect bbox
Definition structured-text.h:449
int index
Definition structured-text.h:453
fz_stext_struct * down
Definition structured-text.h:453
union fz_stext_block::@077362170310250171051263324125052311301222304301 u
int type
Definition structured-text.h:447
struct fz_stext_block::@077362170310250171051263324125052311301222304301::@021205265155363355073277254035272225221124241246 t
fz_image * image
Definition structured-text.h:452
uint32_t argb
Definition structured-text.h:454
fz_stext_line * last_line
Definition structured-text.h:451
int flags
Definition structured-text.h:451
fz_stext_block * next
Definition structured-text.h:457
struct fz_stext_block::@077362170310250171051263324125052311301222304301::@327344140155077055150246014234231037205130331223 s
int id
Definition structured-text.h:448
struct fz_stext_block::@077362170310250171051263324125052311301222304301::@111221327166006002060050002366241076201217174261 i
fz_stext_grid_positions * xs
Definition structured-text.h:455
fz_stext_block * prev
Definition structured-text.h:457
fz_stext_grid_info * info
Definition structured-text.h:455
fz_matrix transform
Definition structured-text.h:452
struct fz_stext_block::@077362170310250171051263324125052311301222304301::@026234261360145277267111044143002132007263106067 b
Definition structured-text.h:483
fz_stext_char * next
Definition structured-text.h:492
fz_quad quad
Definition structured-text.h:489
uint32_t argb
Definition structured-text.h:487
fz_font * font
Definition structured-text.h:491
int c
Definition structured-text.h:484
float size
Definition structured-text.h:490
fz_point origin
Definition structured-text.h:488
uint16_t flags
Definition structured-text.h:486
uint16_t bidi
Definition structured-text.h:485
Definition structured-text.h:573
float max
Definition structured-text.h:577
int uncertainty
Definition structured-text.h:578
float pos
Definition structured-text.h:575
float min
Definition structured-text.h:576
int reinforcement
Definition structured-text.h:574
Definition structured-text.h:427
unsigned int flags
Definition structured-text.h:437
int h
Definition structured-text.h:434
int w
Definition structured-text.h:433
Definition structured-text.h:582
int len
Definition structured-text.h:583
int max_uncertainty
Definition structured-text.h:584
fz_stext_grid_divider list[FZ_FLEXIBLE_ARRAY]
Definition structured-text.h:585
Definition structured-text.h:469
fz_stext_line * next
Definition structured-text.h:475
fz_stext_char * first_char
Definition structured-text.h:474
uint8_t flags
Definition structured-text.h:471
fz_stext_char * last_char
Definition structured-text.h:474
uint8_t wmode
Definition structured-text.h:470
fz_rect bbox
Definition structured-text.h:473
fz_point dir
Definition structured-text.h:472
fz_stext_line * prev
Definition structured-text.h:475
Definition structured-text.h:763
float scale
Definition structured-text.h:765
fz_rect clip
Definition structured-text.h:766
int flags
Definition structured-text.h:764
fz_table_hunt_options table_hunt_options
Definition structured-text.h:767
Definition structured-text.h:1194
fz_stext_struct * parent
Definition structured-text.h:1196
fz_stext_struct * top
Definition structured-text.h:1198
fz_stext_block * block
Definition structured-text.h:1197
fz_stext_page * page
Definition structured-text.h:1195
Definition structured-text.h:329
int page
Definition structured-text.h:332
fz_rect mediabox
Definition structured-text.h:330
int chapter
Definition structured-text.h:331
Definition structured-text.h:344
fz_stext_block * first_block
Definition structured-text.h:348
fz_pool_array * id_list
Definition structured-text.h:358
fz_pool * pool
Definition structured-text.h:346
int refs
Definition structured-text.h:345
fz_rect mediabox
Definition structured-text.h:347
fz_stext_block * last_block
Definition structured-text.h:354
fz_stext_struct * last_struct
Definition structured-text.h:355
Definition structured-text.h:1066
fz_stext_line * line
Definition structured-text.h:1070
fz_stext_block * block
Definition structured-text.h:1069
fz_stext_struct * parent
Definition structured-text.h:1068
fz_stext_char * ch
Definition structured-text.h:1071
fz_stext_page * page
Definition structured-text.h:1067
Definition structured-text.h:521
fz_stext_block * up
Definition structured-text.h:523
fz_stext_struct * parent
Definition structured-text.h:527
fz_structure standard
Definition structured-text.h:538
fz_stext_block * first_block
Definition structured-text.h:531
char raw[FZ_FLEXIBLE_ARRAY]
Definition structured-text.h:541
fz_stext_block * last_block
Definition structured-text.h:534
Definition structured-text.h:730
int vertically_collapse_bordered_cells
Definition structured-text.h:731
fz_search_options
Definition structured-text.h:1022
@ FZ_SEARCH_EXACT
Definition structured-text.h:1023
@ FZ_SEARCH_IGNORE_CASE
Definition structured-text.h:1024
@ FZ_SEARCH_REGEXP
Definition structured-text.h:1026
@ FZ_SEARCH_KEEP_PARAGRAPHS
Definition structured-text.h:1028
@ FZ_SEARCH_KEEP_HYPHENS
Definition structured-text.h:1029
@ FZ_SEARCH_KEEP_LINES
Definition structured-text.h:1027
@ FZ_SEARCH_IGNORE_DIACRITICS
Definition structured-text.h:1025
fz_stext_options * fz_parse_stext_options(fz_context *ctx, fz_stext_options *opts, const char *string)
struct fz_flotilla fz_flotilla
Definition structured-text.h:1357
void fz_init_search_options(fz_context *ctx, fz_search_options *options)
fz_document * fz_open_reflowed_document(fz_context *ctx, fz_document *underdoc, const fz_stext_options *opts)
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin_from_rdfs(fz_stext_page *page, fz_stext_block *block, fz_stext_struct *top)
int fz_is_unicode_hyphen(int c)
FZ_DATA const char * fz_search_options_usage
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin_from(fz_stext_page *page, fz_stext_block *block, fz_stext_struct *top)
@ FZ_STEXT_VECTOR_IS_STROKED
Definition structured-text.h:393
@ FZ_STEXT_VECTOR_IS_HIGHLIGHT
Definition structured-text.h:406
@ FZ_STEXT_VECTOR_IS_STRIKEOUT
Definition structured-text.h:408
@ FZ_STEXT_VECTOR_IS_UNDERLINE
Definition structured-text.h:407
@ FZ_STEXT_VECTOR_CONTINUES
Definition structured-text.h:402
@ FZ_STEXT_VECTOR_IS_RECTANGLE
Definition structured-text.h:397
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin_from_dfs(fz_stext_page *page, fz_stext_block *block, fz_stext_struct *top)
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin(fz_stext_page *page)
void fz_print_stext_header_as_html(fz_context *ctx, fz_output *out)
fz_stext_line_flags
Definition structured-text.h:461
@ FZ_STEXT_LINE_FLAGS_JOINED
Definition structured-text.h:462
@ FZ_STEXT_STRIKEOUT
Definition structured-text.h:497
@ FZ_STEXT_CLIPPED
Definition structured-text.h:503
@ FZ_STEXT_FILLED
Definition structured-text.h:501
@ FZ_STEXT_UNICODE_IS_CID
Definition structured-text.h:504
@ FZ_STEXT_SYNTHETIC_LARGE
Definition structured-text.h:506
@ FZ_STEXT_STROKED
Definition structured-text.h:502
@ FZ_STEXT_UNDERLINE
Definition structured-text.h:498
@ FZ_STEXT_UNICODE_IS_GID
Definition structured-text.h:505
@ FZ_STEXT_BOLD
Definition structured-text.h:500
@ FZ_STEXT_SYNTHETIC
Definition structured-text.h:499
@ FZ_STEXT_HIGHLIGHT
Definition structured-text.h:507
fz_stext_page_block_iterator fz_stext_page_block_iterator_up(fz_stext_page_block_iterator pos)
void fz_print_stext_header_as_xhtml(fz_context *ctx, fz_output *out)
void fz_print_stext_page_as_xml(fz_context *ctx, fz_output *out, fz_stext_page *page, int id)
int fz_stext_page_block_iterator_eod_dfs(fz_stext_page_block_iterator pos)
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin_dfs(fz_stext_page *page)
fz_stext_page_block_iterator fz_stext_page_block_iterator_next_rdfs(fz_stext_page_block_iterator pos)
int fz_match_callback_fn(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox, int chapter, int page)
Definition structured-text.h:676
fz_stext_page * fz_keep_stext_page(fz_context *ctx, fz_stext_page *page)
void fz_drop_layout(fz_context *ctx, fz_layout_block *block)
fz_stext_xml_flags
Definition structured-text.h:624
@ FZ_STEXT_XML_FLAGS_CHARS
Definition structured-text.h:625
@ FZ_STEXT_XML_FLAGS_POINTERS
Definition structured-text.h:626
int fz_stext_remove_page_fill(fz_context *ctx, fz_stext_page *page)
fz_stext_page * fz_new_stext_page(fz_context *ctx, fz_rect mediabox)
int fz_segment_stext_rect(fz_context *ctx, fz_stext_page *page, fz_rect rect)
fz_stext_block * fz_find_table_within_bounds(fz_context *ctx, fz_stext_page *page, fz_rect bounds, const fz_table_hunt_options *opts)
void fz_init_stext_options(fz_context *ctx, fz_stext_options *opts)
void fz_init_table_hunt_options(fz_context *ctx, fz_table_hunt_options *opts)
fz_search * fz_new_search(fz_context *ctx, const char *needle, fz_search_options options)
fz_stext_page_block_iterator fz_stext_page_block_iterator_next_dfs(fz_stext_page_block_iterator pos)
fz_stext_page_block_iterator fz_stext_page_block_iterator_down(fz_stext_page_block_iterator pos)
fz_search_options * fz_parse_search_options(fz_context *ctx, fz_search_options *options, const char *args)
fz_quad fz_snap_selection(fz_context *ctx, fz_stext_page *page, fz_point *ap, fz_point *bp, int mode)
void fz_drop_search(fz_context *ctx, fz_search *search)
void fz_print_stext_trailer_as_html(fz_context *ctx, fz_output *out)
int fz_segment_stext_page(fz_context *ctx, fz_stext_page *page)
void fz_print_stext_page_as_html(fz_context *ctx, fz_output *out, fz_stext_page *page, int id)
fz_rect fz_flotilla_raft_area(fz_context *ctx, fz_flotilla *flot, int i)
fz_search_reason
Definition structured-text.h:1048
@ FZ_SEARCH_MORE_INPUT
Definition structured-text.h:1050
@ FZ_SEARCH_COMPLETE
Definition structured-text.h:1056
@ FZ_SEARCH_MATCH
Definition structured-text.h:1053
void fz_verify_stext_page(fz_context *ctx, fz_stext_page *page, const char *title)
int fz_flotilla_size(fz_context *ctx, fz_flotilla *flot)
int fz_is_unicode_space_equivalent(int c)
fz_search_result fz_search_forwards(fz_context *ctx, fz_search *search)
int fz_propose_table_within_bounds(fz_context *ctx, fz_stext_page *page, fz_rect bounds, fz_stext_grid_positions **xposp, fz_stext_grid_positions **yposp, const fz_table_hunt_options *opts)
void fz_drop_stext_page(fz_context *ctx, fz_stext_page *page)
void fz_paragraph_break(fz_context *ctx, fz_stext_page *page)
void fz_table_hunt_within_bounds(fz_context *ctx, fz_stext_page *page, fz_rect bounds, const fz_table_hunt_options *opts)
void fz_drop_flotilla(fz_context *ctx, fz_flotilla *f)
fz_stext_block * fz_new_stext_struct(fz_context *ctx, fz_stext_page *page, fz_structure standard, const char *raw, int index)
char * fz_copy_rectangle(fz_context *ctx, fz_stext_page *page, fz_rect area, int crlf)
@ FZ_TABLE_HUNT_VERTICAL_COLLAPSE_YES
Definition structured-text.h:739
@ FZ_TABLE_HUNT_VERTICAL_COLLAPSE_NO
Definition structured-text.h:736
int fz_search_callback_fn(fz_context *ctx, void *opaque, int num_quads, fz_quad *hit_bbox)
Definition structured-text.h:666
fz_layout_block * fz_new_layout(fz_context *ctx)
fz_stext_page_details * fz_stext_page_details_for_block(fz_context *ctx, fz_stext_page *page, fz_stext_block *block)
fz_stext_page_block_iterator fz_stext_page_block_iterator_begin_rdfs(fz_stext_page *page)
int fz_stext_page_block_iterator_eod_rdfs(fz_stext_page_block_iterator pos)
void fz_apply_stext_options(fz_context *ctx, fz_stext_options *opts, fz_options *options)
fz_device * fz_new_ocr_device(fz_context *ctx, fz_device *target, fz_matrix ctm, fz_rect mediabox, int with_list, const char *language, const char *datadir, int(*progress)(fz_context *, void *, int), void *progress_arg)
@ FZ_SELECT_WORDS
Definition structured-text.h:702
@ FZ_SELECT_LINES
Definition structured-text.h:703
@ FZ_SELECT_CHARS
Definition structured-text.h:701
int fz_search_stext_page_cb(fz_context *ctx, fz_stext_page *text, const char *needle, fz_search_callback_fn *cb, void *opaque)
fz_table_hunt_options * fz_parse_table_hunt_options(fz_context *ctx, fz_table_hunt_options *opts, const char *args)
void fz_print_stext_page_as_json(fz_context *ctx, fz_output *out, fz_stext_page *page, float scale)
fz_flotilla * fz_new_flotilla_from_stext_page_vectors(fz_context *ctx, fz_stext_page *page)
int fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max)
fz_device * fz_new_stext_device(fz_context *ctx, fz_stext_page *page, const fz_stext_options *options)
void fz_print_stext_page_as_text(fz_context *ctx, fz_output *out, fz_stext_page *page)
void fz_add_layout_line(fz_context *ctx, fz_layout_block *block, float x, float y, float h, const char *p)
FZ_DATA const char * fz_stext_options_usage
void fz_classify_stext_rect(fz_context *ctx, fz_stext_page *page, fz_structure classification, fz_rect rect)
fz_stext_block * fz_find_table_within_grid(fz_context *ctx, fz_stext_page *page, fz_stext_grid_positions *xpos, fz_stext_grid_positions *ypos, float limit, const fz_table_hunt_options *opts)
int fz_match_stext_page_cb(fz_context *ctx, fz_stext_page *page, const char *needle, fz_match_callback_fn *cb, void *opaque, fz_search_options options)
void fz_print_stext_page_as_xml_with_flags(fz_context *ctx, fz_output *out, fz_stext_page *page, int id, fz_stext_xml_flags flags)
void fz_apply_search_options(fz_context *ctx, fz_search_options *options, fz_options *opts)
int fz_match_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, int *hit_mark, fz_quad *hit_bbox, int hit_max, fz_search_options options)
void fz_debug_stext_page(fz_context *ctx, fz_stext_page *page, int id)
@ FZ_STEXT_BLOCK_GRID
Definition structured-text.h:377
@ FZ_STEXT_BLOCK_TEXT
Definition structured-text.h:373
@ FZ_STEXT_BLOCK_IMAGE
Definition structured-text.h:374
@ FZ_STEXT_BLOCK_VECTOR
Definition structured-text.h:376
@ FZ_STEXT_BLOCK_STRUCT
Definition structured-text.h:375
struct fz_search fz_search
Definition structured-text.h:1019
fz_search_result fz_search_backwards(fz_context *ctx, fz_search *search)
fz_device * fz_new_stext_device_for_page(fz_context *ctx, fz_stext_page *stext_page, const fz_stext_options *opts, int chapter_num, int page_num, fz_rect mediabox)
void fz_stext_raft_images(fz_context *ctx, fz_stext_page *stext, fz_image_raft_options *options)
void fz_feed_search(fz_context *ctx, fz_search *search, fz_stext_page *page, int seq)
void fz_apply_table_hunt_options(fz_context *ctx, fz_table_hunt_options *opts, fz_options *options)
char * fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_point a, fz_point b, int crlf)
int fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_point a, fz_point b, fz_quad *quads, int max_quads)
@ FZ_STEXT_FUZZY_VECTORS
Definition structured-text.h:217
@ FZ_STEXT_CLIP_RECT
Definition structured-text.h:213
@ FZ_STEXT_INHIBIT_SPACES
Definition structured-text.h:199
@ FZ_STEXT_COLLECT_VECTORS
Definition structured-text.h:206
@ FZ_STEXT_TABLE_HUNT
Definition structured-text.h:210
@ FZ_STEXT_COLLECT_STYLES
Definition structured-text.h:211
@ FZ_STEXT_ACCURATE_BBOXES
Definition structured-text.h:205
@ FZ_STEXT_IGNORE_ACTUALTEXT
Definition structured-text.h:207
@ FZ_STEXT_ACCURATE_ASCENDERS
Definition structured-text.h:214
@ FZ_STEXT_PRESERVE_SPANS
Definition structured-text.h:201
@ FZ_STEXT_PRESERVE_WHITESPACE
Definition structured-text.h:197
@ FZ_STEXT_MEDIABOX_CLIP
Definition structured-text.h:220
@ FZ_STEXT_DEHYPHENATE
Definition structured-text.h:200
@ FZ_STEXT_SEGMENT
Definition structured-text.h:208
@ FZ_STEXT_CLIP
Definition structured-text.h:202
@ FZ_STEXT_USE_CID_FOR_UNKNOWN_UNICODE
Definition structured-text.h:203
@ FZ_STEXT_LAZY_VECTORS
Definition structured-text.h:216
@ FZ_STEXT_PRESERVE_LIGATURES
Definition structured-text.h:196
@ FZ_STEXT_USE_GID_FOR_UNKNOWN_UNICODE
Definition structured-text.h:212
@ FZ_STEXT_PARAGRAPH_BREAK
Definition structured-text.h:209
@ FZ_STEXT_COLLECT_STRUCTURE
Definition structured-text.h:204
@ FZ_STEXT_PRESERVE_IMAGES
Definition structured-text.h:198
@ FZ_STEXT_ACCURATE_SIDE_BEARINGS
Definition structured-text.h:215
int fz_is_unicode_whitespace(int c)
void fz_table_hunt(fz_context *ctx, fz_stext_page *page, const fz_table_hunt_options *opts)
void fz_print_stext_page_as_xhtml(fz_context *ctx, fz_output *out, fz_stext_page *page, int id)
void fz_print_stext_trailer_as_xhtml(fz_context *ctx, fz_output *out)
fz_device * fz_new_ocr_device_with_options(fz_context *ctx, fz_device *target, fz_matrix ctm, fz_rect mediabox, int with_list, const char *language, const char *datadir, int(*progress)(fz_context *, void *, int), void *progress_arg, fz_options *options)
fz_stext_page_block_iterator fz_stext_page_block_iterator_next(fz_stext_page_block_iterator pos)
@ FZ_STEXT_TEXT_JUSTIFY_RIGHT
Definition structured-text.h:385
@ FZ_STEXT_TEXT_JUSTIFY_UNKNOWN
Definition structured-text.h:382
@ FZ_STEXT_TEXT_JUSTIFY_LEFT
Definition structured-text.h:383
@ FZ_STEXT_TEXT_JUSTIFY_CENTER
Definition structured-text.h:384
@ FZ_STEXT_TEXT_JUSTIFY_FULL
Definition structured-text.h:386
@ FZ_STEXT_GRID_V_CROSSED
Definition structured-text.h:416
@ FZ_STEXT_GRID_H_CROSSED
Definition structured-text.h:414
@ FZ_STEXT_GRID_T_BORDER
Definition structured-text.h:420
@ FZ_STEXT_GRID_L_BORDER
Definition structured-text.h:418
@ FZ_STEXT_GRID_FULL
Definition structured-text.h:422
void fz_add_layout_char(fz_context *ctx, fz_layout_block *block, float x, float w, const char *p)
int fz_stext_page_block_iterator_eod(fz_stext_page_block_iterator pos)
#define FZ_FLEXIBLE_ARRAY
Definition system.h:46