summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-10-07 17:03:12 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-12-11 12:11:31 +0100
commite3275837d5738c5092b2e452829919e31ad553e5 (patch)
tree0b1ffed536e6887236c4e50cbb808808bbe2684e /source
parentc22e6a6dc2bf6acbac955bd5fbdd896329dfd725 (diff)
downloadmupdf-e3275837d5738c5092b2e452829919e31ad553e5.tar.xz
Rename structured text structs and functions to 'stext'.
Less risk of confusion with the text type used in the device interface.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/stext-device.c256
-rw-r--r--source/fitz/stext-output.c48
-rw-r--r--source/fitz/stext-paragraph.c84
-rw-r--r--source/fitz/stext-search.c50
-rw-r--r--source/fitz/util.c98
-rw-r--r--source/tools/mudraw.c22
6 files changed, 279 insertions, 279 deletions
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index dc375c71..4e14b298 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -18,17 +18,17 @@
#include FT_FREETYPE_H
#include FT_ADVANCES_H
-typedef struct fz_text_device_s fz_text_device;
+typedef struct fz_stext_device_s fz_stext_device;
typedef struct span_soup_s span_soup;
-struct fz_text_device_s
+struct fz_stext_device_s
{
fz_device super;
- fz_text_sheet *sheet;
- fz_text_page *page;
+ fz_stext_sheet *sheet;
+ fz_stext_page *page;
span_soup *spans;
- fz_text_span *cur_span;
+ fz_stext_span *cur_span;
int lastchar;
};
@@ -47,11 +47,11 @@ add_point_to_rect(fz_rect *a, const fz_point *p)
}
fz_rect *
-fz_text_char_bbox(fz_context *ctx, fz_rect *bbox, fz_text_span *span, int i)
+fz_stext_char_bbox(fz_context *ctx, fz_rect *bbox, fz_stext_span *span, int i)
{
fz_point a, d;
const fz_point *max;
- fz_text_char *ch;
+ fz_stext_char *ch;
if (!span || i >= span->len)
{
@@ -94,7 +94,7 @@ fz_text_char_bbox(fz_context *ctx, fz_rect *bbox, fz_text_span *span, int i)
}
static void
-add_bbox_to_span(fz_text_span *span)
+add_bbox_to_span(fz_stext_span *span)
{
fz_point a, d;
fz_rect *bbox = &span->bbox;
@@ -133,7 +133,7 @@ add_bbox_to_span(fz_text_span *span)
struct span_soup_s
{
int len, cap;
- fz_text_span **spans;
+ fz_stext_span **spans;
};
static span_soup *
@@ -162,7 +162,7 @@ free_span_soup(fz_context *ctx, span_soup *soup)
}
static void
-add_span_to_soup(fz_context *ctx, span_soup *soup, fz_text_span *span)
+add_span_to_soup(fz_context *ctx, span_soup *soup, fz_stext_span *span)
{
if (span == NULL)
return;
@@ -176,12 +176,12 @@ add_span_to_soup(fz_context *ctx, span_soup *soup, fz_text_span *span)
soup->spans[soup->len++] = span;
}
-static fz_text_line *
-push_span(fz_context *ctx, fz_text_device *tdev, fz_text_span *span, int new_line, float distance)
+static fz_stext_line *
+push_span(fz_context *ctx, fz_stext_device *tdev, fz_stext_span *span, int new_line, float distance)
{
- fz_text_line *line;
- fz_text_block *block;
- fz_text_page *page = tdev->page;
+ fz_stext_line *line;
+ fz_stext_block *block;
+ fz_stext_page *page = tdev->page;
int prev_not_text = 0;
if (page->len == 0 || page->blocks[page->len-1].type != FZ_PAGE_BLOCK_TEXT)
@@ -200,7 +200,7 @@ push_span(fz_context *ctx, fz_text_device *tdev, fz_text_span *span, int new_lin
page->blocks = fz_resize_array(ctx, page->blocks, newcap, sizeof(*page->blocks));
page->cap = newcap;
}
- block = fz_malloc_struct(ctx, fz_text_block);
+ block = fz_malloc_struct(ctx, fz_stext_block);
page->blocks[page->len].type = FZ_PAGE_BLOCK_TEXT;
page->blocks[page->len].u.text = block;
block->cap = 0;
@@ -250,7 +250,7 @@ push_span(fz_context *ctx, fz_text_device *tdev, fz_text_span *span, int new_lin
#if defined(DEBUG_SPANS) || defined(DEBUG_ALIGN) || defined(DEBUG_INDENTS)
static void
-dump_span(fz_text_span *s)
+dump_span(fz_stext_span *s)
{
int i;
for (i=0; i < s->len; i++)
@@ -262,12 +262,12 @@ dump_span(fz_text_span *s)
#ifdef DEBUG_ALIGN
static void
-dump_line(fz_text_line *line)
+dump_line(fz_stext_line *line)
{
int i;
for (i=0; i < line->len; i++)
{
- fz_text_span *s = line->spans[i];
+ fz_stext_span *s = line->spans[i];
if (s->spacing > 1)
printf(" ");
dump_span(s);
@@ -277,11 +277,11 @@ dump_line(fz_text_line *line)
#endif
static void
-strain_soup(fz_context *ctx, fz_text_device *tdev)
+strain_soup(fz_context *ctx, fz_stext_device *tdev)
{
span_soup *soup = tdev->spans;
- fz_text_line *last_line = NULL;
- fz_text_span *last_span = NULL;
+ fz_stext_line *last_line = NULL;
+ fz_stext_span *last_span = NULL;
int span_num;
if (soup == NULL)
@@ -290,7 +290,7 @@ strain_soup(fz_context *ctx, fz_text_device *tdev)
/* Really dumb implementation to match what we had before */
for (span_num=0; span_num < soup->len; span_num++)
{
- fz_text_span *span = soup->spans[span_num];
+ fz_stext_span *span = soup->spans[span_num];
int new_line = 1;
float distance = 0;
float spacing = 0;
@@ -379,19 +379,19 @@ strain_soup(fz_context *ctx, fz_text_device *tdev)
}
}
-fz_text_sheet *
-fz_new_text_sheet(fz_context *ctx)
+fz_stext_sheet *
+fz_new_stext_sheet(fz_context *ctx)
{
- fz_text_sheet *sheet = fz_malloc(ctx, sizeof *sheet);
+ fz_stext_sheet *sheet = fz_malloc(ctx, sizeof *sheet);
sheet->maxid = 0;
sheet->style = NULL;
return sheet;
}
void
-fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet)
+fz_drop_stext_sheet(fz_context *ctx, fz_stext_sheet *sheet)
{
- fz_text_style *style;
+ fz_stext_style *style;
if (sheet == NULL)
return;
@@ -399,7 +399,7 @@ fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet)
style = sheet->style;
while (style)
{
- fz_text_style *next = style->next;
+ fz_stext_style *next = style->next;
fz_drop_font(ctx, style->font);
fz_free(ctx, style);
style = next;
@@ -407,11 +407,11 @@ fz_drop_text_sheet(fz_context *ctx, fz_text_sheet *sheet)
fz_free(ctx, sheet);
}
-static fz_text_style *
-fz_lookup_text_style_imp(fz_context *ctx, fz_text_sheet *sheet,
+static fz_stext_style *
+fz_lookup_stext_style_imp(fz_context *ctx, fz_stext_sheet *sheet,
float size, fz_font *font, int wmode, int script)
{
- fz_text_style *style;
+ fz_stext_style *style;
for (style = sheet->style; style; style = style->next)
{
@@ -436,8 +436,8 @@ fz_lookup_text_style_imp(fz_context *ctx, fz_text_sheet *sheet,
return style;
}
-static fz_text_style *
-fz_lookup_text_style(fz_context *ctx, fz_text_sheet *sheet, fz_text *text, const fz_matrix *ctm,
+static fz_stext_style *
+fz_lookup_stext_style(fz_context *ctx, fz_stext_sheet *sheet, fz_text *text, const fz_matrix *ctm,
fz_colorspace *colorspace, float *color, float alpha, fz_stroke_state *stroke)
{
float size = 1.0f;
@@ -452,13 +452,13 @@ fz_lookup_text_style(fz_context *ctx, fz_text_sheet *sheet, fz_text *text, const
fz_concat(&trm, &tm, ctm);
size = fz_matrix_expansion(&trm);
}
- return fz_lookup_text_style_imp(ctx, sheet, size, font, wmode, 0);
+ return fz_lookup_stext_style_imp(ctx, sheet, size, font, wmode, 0);
}
-fz_text_page *
-fz_new_text_page(fz_context *ctx)
+fz_stext_page *
+fz_new_stext_page(fz_context *ctx)
{
- fz_text_page *page = fz_malloc(ctx, sizeof(*page));
+ fz_stext_page *page = fz_malloc(ctx, sizeof(*page));
page->mediabox = fz_empty_rect;
page->len = 0;
page->cap = 0;
@@ -468,9 +468,9 @@ fz_new_text_page(fz_context *ctx)
}
static void
-fz_drop_text_line_contents(fz_context *ctx, fz_text_line *line)
+fz_drop_stext_line_contents(fz_context *ctx, fz_stext_line *line)
{
- fz_text_span *span, *next;
+ fz_stext_span *span, *next;
for (span = line->first_span; span; span=next)
{
next = span->next;
@@ -480,13 +480,13 @@ fz_drop_text_line_contents(fz_context *ctx, fz_text_line *line)
}
static void
-fz_drop_text_block(fz_context *ctx, fz_text_block *block)
+fz_drop_stext_block(fz_context *ctx, fz_stext_block *block)
{
- fz_text_line *line;
+ fz_stext_line *line;
if (block == NULL)
return;
for (line = block->lines; line < block->lines + block->len; line++)
- fz_drop_text_line_contents(ctx, line);
+ fz_drop_stext_line_contents(ctx, line);
fz_free(ctx, block->lines);
fz_free(ctx, block);
}
@@ -502,7 +502,7 @@ fz_drop_image_block(fz_context *ctx, fz_image_block *block)
}
void
-fz_drop_text_page(fz_context *ctx, fz_text_page *page)
+fz_drop_stext_page(fz_context *ctx, fz_stext_page *page)
{
fz_page_block *block;
if (page == NULL)
@@ -512,7 +512,7 @@ fz_drop_text_page(fz_context *ctx, fz_text_page *page)
switch (block->type)
{
case FZ_PAGE_BLOCK_TEXT:
- fz_drop_text_block(ctx, block->u.text);
+ fz_drop_stext_block(ctx, block->u.text);
break;
case FZ_PAGE_BLOCK_IMAGE:
fz_drop_image_block(ctx, block->u.image);
@@ -523,10 +523,10 @@ fz_drop_text_page(fz_context *ctx, fz_text_page *page)
fz_free(ctx, page);
}
-static fz_text_span *
-fz_new_text_span(fz_context *ctx, const fz_point *p, int wmode, const fz_matrix *trm)
+static fz_stext_span *
+fz_new_stext_span(fz_context *ctx, const fz_point *p, int wmode, const fz_matrix *trm)
{
- fz_text_span *span = fz_malloc_struct(ctx, fz_text_span);
+ fz_stext_span *span = fz_malloc_struct(ctx, fz_stext_span);
span->ascender_max = 0;
span->descender_min = 0;
span->cap = 0;
@@ -546,12 +546,12 @@ fz_new_text_span(fz_context *ctx, const fz_point *p, int wmode, const fz_matrix
}
static void
-add_char_to_span(fz_context *ctx, fz_text_span *span, int c, fz_point *p, fz_point *max, fz_text_style *style)
+add_char_to_span(fz_context *ctx, fz_stext_span *span, int c, fz_point *p, fz_point *max, fz_stext_style *style)
{
if (span->len == span->cap)
{
int newcap = (span->cap ? span->cap * 2 : 16);
- span->text = fz_resize_array(ctx, span->text, newcap, sizeof(fz_text_char));
+ span->text = fz_resize_array(ctx, span->text, newcap, sizeof(fz_stext_char));
span->cap = newcap;
span->bbox = fz_empty_rect;
}
@@ -567,7 +567,7 @@ add_char_to_span(fz_context *ctx, fz_text_span *span, int c, fz_point *p, fz_poi
}
static void
-fz_add_text_char_imp(fz_context *ctx, fz_text_device *dev, fz_text_style *style, int c, fz_matrix *trm, float adv, int wmode)
+fz_add_stext_char_imp(fz_context *ctx, fz_stext_device *dev, fz_stext_style *style, int c, fz_matrix *trm, float adv, int wmode)
{
int can_append = 1;
int add_space = 0;
@@ -690,7 +690,7 @@ fz_add_text_char_imp(fz_context *ctx, fz_text_device *dev, fz_text_style *style,
/* Start a new span */
add_span_to_soup(ctx, dev->spans, dev->cur_span);
dev->cur_span = NULL;
- dev->cur_span = fz_new_text_span(ctx, &p, wmode, trm);
+ dev->cur_span = fz_new_stext_span(ctx, &p, wmode, trm);
dev->cur_span->spacing = 0;
}
if (add_space)
@@ -704,47 +704,47 @@ fz_add_text_char_imp(fz_context *ctx, fz_text_device *dev, fz_text_style *style,
}
static void
-fz_add_text_char(fz_context *ctx, fz_text_device *dev, fz_text_style *style, int c, fz_matrix *trm, float adv, int wmode)
+fz_add_stext_char(fz_context *ctx, fz_stext_device *dev, fz_stext_style *style, int c, fz_matrix *trm, float adv, int wmode)
{
switch (c)
{
case -1: /* ignore when one unicode character maps to multiple glyphs */
break;
case 0xFB00: /* ff */
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
break;
case 0xFB01: /* fi */
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'i', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'i', trm, adv/2, wmode);
break;
case 0xFB02: /* fl */
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'l', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'l', trm, adv/2, wmode);
break;
case 0xFB03: /* ffi */
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'i', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'i', trm, adv/3, wmode);
break;
case 0xFB04: /* ffl */
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
- fz_add_text_char_imp(ctx, dev, style, 'l', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'f', trm, adv/3, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 'l', trm, adv/3, wmode);
break;
case 0xFB05: /* long st */
case 0xFB06: /* st */
- fz_add_text_char_imp(ctx, dev, style, 's', trm, adv/2, wmode);
- fz_add_text_char_imp(ctx, dev, style, 't', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 's', trm, adv/2, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, 't', trm, adv/2, wmode);
break;
default:
- fz_add_text_char_imp(ctx, dev, style, c, trm, adv, wmode);
+ fz_add_stext_char_imp(ctx, dev, style, c, trm, adv, wmode);
break;
}
}
static void
-fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, const fz_matrix *ctm, fz_text_style *style)
+fz_stext_extract(fz_context *ctx, fz_stext_device *dev, fz_text *text, const fz_matrix *ctm, fz_stext_style *style)
{
fz_font *font = text->font;
FT_Face face = font->ft_face;
@@ -810,13 +810,13 @@ fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, const fz_ma
if (multi == 1)
{
- fz_add_text_char(ctx, dev, style, text->items[i].ucs, &trm, adv, text->wmode);
+ fz_add_stext_char(ctx, dev, style, text->items[i].ucs, &trm, adv, text->wmode);
}
else
{
for (j = 0; j < multi; j++)
{
- fz_add_text_char(ctx, dev, style, text->items[i + j].ucs, &trm, adv/multi, text->wmode);
+ fz_add_stext_char(ctx, dev, style, text->items[i + j].ucs, &trm, adv/multi, text->wmode);
}
i += j - 1;
}
@@ -826,58 +826,58 @@ fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, const fz_ma
}
static void
-fz_text_fill_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm,
+fz_stext_fill_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_style *style;
- style = fz_lookup_text_style(ctx, tdev->sheet, text, ctm, colorspace, color, alpha, NULL);
- fz_text_extract(ctx, tdev, text, ctm, style);
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_style *style;
+ style = fz_lookup_stext_style(ctx, tdev->sheet, text, ctm, colorspace, color, alpha, NULL);
+ fz_stext_extract(ctx, tdev, text, ctm, style);
}
static void
-fz_text_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm,
+fz_stext_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_style *style;
- style = fz_lookup_text_style(ctx, tdev->sheet, text, ctm, colorspace, color, alpha, stroke);
- fz_text_extract(ctx, tdev, text, ctm, style);
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_style *style;
+ style = fz_lookup_stext_style(ctx, tdev->sheet, text, ctm, colorspace, color, alpha, stroke);
+ fz_stext_extract(ctx, tdev, text, ctm, style);
}
static void
-fz_text_clip_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm, int accumulate)
+fz_stext_clip_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm, int accumulate)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_style *style;
- style = fz_lookup_text_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, NULL);
- fz_text_extract(ctx, tdev, text, ctm, style);
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_style *style;
+ style = fz_lookup_stext_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, NULL);
+ fz_stext_extract(ctx, tdev, text, ctm, style);
}
static void
-fz_text_clip_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm)
+fz_stext_clip_stroke_text(fz_context *ctx, fz_device *dev, fz_text *text, fz_stroke_state *stroke, const fz_matrix *ctm)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_style *style;
- style = fz_lookup_text_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, stroke);
- fz_text_extract(ctx, tdev, text, ctm, style);
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_style *style;
+ style = fz_lookup_stext_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, stroke);
+ fz_stext_extract(ctx, tdev, text, ctm, style);
}
static void
-fz_text_ignore_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm)
+fz_stext_ignore_text(fz_context *ctx, fz_device *dev, fz_text *text, const fz_matrix *ctm)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_style *style;
- style = fz_lookup_text_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, NULL);
- fz_text_extract(ctx, tdev, text, ctm, style);
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_style *style;
+ style = fz_lookup_stext_style(ctx, tdev->sheet, text, ctm, NULL, NULL, 0, NULL);
+ fz_stext_extract(ctx, tdev, text, ctm, style);
}
static void
-fz_text_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm,
+fz_stext_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm,
fz_colorspace *cspace, float *color, float alpha)
{
- fz_text_device *tdev = (fz_text_device*)dev;
- fz_text_page *page = tdev->page;
+ fz_stext_device *tdev = (fz_stext_device*)dev;
+ fz_stext_page *page = tdev->page;
fz_image_block *block;
/* If the alpha is less than 50% then it's probably a watermark or
@@ -909,9 +909,9 @@ fz_text_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, const fz
}
static void
-fz_text_fill_image(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm, float alpha)
+fz_stext_fill_image(fz_context *ctx, fz_device *dev, fz_image *img, const fz_matrix *ctm, float alpha)
{
- fz_text_fill_image_mask(ctx, dev, img, ctm, NULL, NULL, alpha);
+ fz_stext_fill_image_mask(ctx, dev, img, ctm, NULL, NULL, alpha);
}
static int
@@ -948,11 +948,11 @@ fz_bidi_direction(int bidiclass, int curdir)
}
static void
-fz_bidi_reorder_run(fz_text_span *span, int a, int b, int dir)
+fz_bidi_reorder_run(fz_stext_span *span, int a, int b, int dir)
{
if (a < b && dir == -1)
{
- fz_text_char c;
+ fz_stext_char c;
int m = a + (b - a) / 2;
while (a < m)
{
@@ -966,7 +966,7 @@ fz_bidi_reorder_run(fz_text_span *span, int a, int b, int dir)
}
static void
-fz_bidi_reorder_span(fz_text_span *span)
+fz_bidi_reorder_span(fz_stext_span *span)
{
int a, b, dir, curdir;
@@ -986,12 +986,12 @@ fz_bidi_reorder_span(fz_text_span *span)
}
static void
-fz_bidi_reorder_text_page(fz_context *ctx, fz_text_page *page)
+fz_bidi_reorder_stext_page(fz_context *ctx, fz_stext_page *page)
{
fz_page_block *pageblock;
- fz_text_block *block;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_span *span;
for (pageblock = page->blocks; pageblock < page->blocks + page->len; pageblock++)
if (pageblock->type == FZ_PAGE_BLOCK_TEXT)
@@ -1001,13 +1001,13 @@ fz_bidi_reorder_text_page(fz_context *ctx, fz_text_page *page)
}
static void
-fz_text_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *mediabox, const fz_matrix *ctm)
+fz_stext_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *mediabox, const fz_matrix *ctm)
{
- fz_text_device *tdev = (fz_text_device*)dev;
+ fz_stext_device *tdev = (fz_stext_device*)dev;
if (tdev->page->len)
{
- tdev->page->next = fz_new_text_page(ctx);
+ tdev->page->next = fz_new_stext_page(ctx);
tdev->page = tdev->page->next;
}
@@ -1016,9 +1016,9 @@ fz_text_begin_page(fz_context *ctx, fz_device *dev, const fz_rect *mediabox, con
}
static void
-fz_text_end_page(fz_context *ctx, fz_device *dev)
+fz_stext_end_page(fz_context *ctx, fz_device *dev)
{
- fz_text_device *tdev = (fz_text_device*)dev;
+ fz_stext_device *tdev = (fz_stext_device*)dev;
add_span_to_soup(ctx, tdev->spans, tdev->cur_span);
tdev->cur_span = NULL;
@@ -1030,33 +1030,33 @@ fz_text_end_page(fz_context *ctx, fz_device *dev)
/* TODO: smart sorting of blocks in reading order */
/* TODO: unicode NFC normalization */
- fz_bidi_reorder_text_page(ctx, tdev->page);
+ fz_bidi_reorder_stext_page(ctx, tdev->page);
}
static void
-fz_text_drop_imp(fz_context *ctx, fz_device *dev)
+fz_stext_drop_imp(fz_context *ctx, fz_device *dev)
{
- fz_text_device *tdev = (fz_text_device*)dev;
+ fz_stext_device *tdev = (fz_stext_device*)dev;
free_span_soup(ctx, tdev->spans);
}
fz_device *
-fz_new_text_device(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
+fz_new_stext_device(fz_context *ctx, fz_stext_sheet *sheet, fz_stext_page *page)
{
- fz_text_device *dev = fz_new_device(ctx, sizeof *dev);
+ fz_stext_device *dev = fz_new_device(ctx, sizeof *dev);
dev->super.hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
- dev->super.drop_imp = fz_text_drop_imp;
- dev->super.begin_page = fz_text_begin_page;
- dev->super.end_page = fz_text_end_page;
- dev->super.fill_text = fz_text_fill_text;
- dev->super.stroke_text = fz_text_stroke_text;
- dev->super.clip_text = fz_text_clip_text;
- dev->super.clip_stroke_text = fz_text_clip_stroke_text;
- dev->super.ignore_text = fz_text_ignore_text;
- dev->super.fill_image = fz_text_fill_image;
- dev->super.fill_image_mask = fz_text_fill_image_mask;
+ dev->super.drop_imp = fz_stext_drop_imp;
+ dev->super.begin_page = fz_stext_begin_page;
+ dev->super.end_page = fz_stext_end_page;
+ dev->super.fill_text = fz_stext_fill_text;
+ dev->super.stroke_text = fz_stext_stroke_text;
+ dev->super.clip_text = fz_stext_clip_text;
+ dev->super.clip_stroke_text = fz_stext_clip_stroke_text;
+ dev->super.ignore_text = fz_stext_ignore_text;
+ dev->super.fill_image = fz_stext_fill_image;
+ dev->super.fill_image_mask = fz_stext_fill_image_mask;
dev->sheet = sheet;
dev->page = page;
diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c
index f090020d..bd348af1 100644
--- a/source/fitz/stext-output.c
+++ b/source/fitz/stext-output.c
@@ -29,7 +29,7 @@ static int font_is_italic(fz_font *font)
}
static void
-fz_print_style_begin(fz_context *ctx, fz_output *out, fz_text_style *style)
+fz_print_style_begin(fz_context *ctx, fz_output *out, fz_stext_style *style)
{
int script = style->script;
fz_printf(ctx, out, "<span class=\"s%d\">", style->id);
@@ -40,7 +40,7 @@ fz_print_style_begin(fz_context *ctx, fz_output *out, fz_text_style *style)
}
static void
-fz_print_style_end(fz_context *ctx, fz_output *out, fz_text_style *style)
+fz_print_style_end(fz_context *ctx, fz_output *out, fz_stext_style *style)
{
int script = style->script;
while (script-- > 0)
@@ -51,7 +51,7 @@ fz_print_style_end(fz_context *ctx, fz_output *out, fz_text_style *style)
}
static void
-fz_print_style(fz_context *ctx, fz_output *out, fz_text_style *style)
+fz_print_style(fz_context *ctx, fz_output *out, fz_stext_style *style)
{
char *s = strchr(style->font->name, '+');
s = s ? s + 1 : style->font->name;
@@ -65,9 +65,9 @@ fz_print_style(fz_context *ctx, fz_output *out, fz_text_style *style)
}
void
-fz_print_text_sheet(fz_context *ctx, fz_output *out, fz_text_sheet *sheet)
+fz_print_stext_sheet(fz_context *ctx, fz_output *out, fz_stext_sheet *sheet)
{
- fz_text_style *style;
+ fz_stext_style *style;
for (style = sheet->style; style; style = style->next)
fz_print_style(ctx, out, style);
}
@@ -111,12 +111,12 @@ send_data_base64(fz_context *ctx, fz_output *out, fz_buffer *buffer)
}
void
-fz_print_text_page_html(fz_context *ctx, fz_output *out, fz_text_page *page)
+fz_print_stext_page_html(fz_context *ctx, fz_output *out, fz_stext_page *page)
{
int block_n, line_n, ch_n;
- fz_text_style *style = NULL;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_style *style = NULL;
+ fz_stext_line *line;
+ fz_stext_span *span;
void *last_region = NULL;
fz_printf(ctx, out, "<div class=\"page\">\n");
@@ -127,7 +127,7 @@ fz_print_text_page_html(fz_context *ctx, fz_output *out, fz_text_page *page)
{
case FZ_PAGE_BLOCK_TEXT:
{
- fz_text_block * block = page->blocks[block_n].u.text;
+ fz_stext_block * block = page->blocks[block_n].u.text;
fz_printf(ctx, out, "<div class=\"block\"><p>\n");
for (line_n = 0; line_n < block->len; line_n++)
{
@@ -169,7 +169,7 @@ fz_print_text_page_html(fz_context *ctx, fz_output *out, fz_text_page *page)
/* Now output the span to contain this entire column */
fz_printf(ctx, out, "<div class=\"cell\" style=\"");
{
- fz_text_span *sn;
+ fz_stext_span *sn;
for (sn = span->next; sn; sn = sn->next)
{
if (sn->column != lastcol)
@@ -197,7 +197,7 @@ fz_print_text_page_html(fz_context *ctx, fz_output *out, fz_text_page *page)
fz_printf(ctx, out, "<sup>");
for (ch_n = 0; ch_n < span->len; ch_n++)
{
- fz_text_char *ch = &span->text[ch_n];
+ fz_stext_char *ch = &span->text[ch_n];
if (style != ch->style)
{
if (style)
@@ -275,7 +275,7 @@ fz_print_text_page_html(fz_context *ctx, fz_output *out, fz_text_page *page)
}
void
-fz_print_text_page_xml(fz_context *ctx, fz_output *out, fz_text_page *page)
+fz_print_stext_page_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
{
int block_n;
@@ -289,24 +289,24 @@ fz_print_text_page_xml(fz_context *ctx, fz_output *out, fz_text_page *page)
{
case FZ_PAGE_BLOCK_TEXT:
{
- fz_text_block *block = page->blocks[block_n].u.text;
- fz_text_line *line;
+ fz_stext_block *block = page->blocks[block_n].u.text;
+ fz_stext_line *line;
char *s;
fz_printf(ctx, out, "<block bbox=\"%g %g %g %g\">\n",
block->bbox.x0, block->bbox.y0, block->bbox.x1, block->bbox.y1);
for (line = block->lines; line < block->lines + block->len; line++)
{
- fz_text_span *span;
+ fz_stext_span *span;
fz_printf(ctx, out, "<line bbox=\"%g %g %g %g\">\n",
line->bbox.x0, line->bbox.y0, line->bbox.x1, line->bbox.y1);
for (span = line->first_span; span; span = span->next)
{
- fz_text_style *style = NULL;
+ fz_stext_style *style = NULL;
int char_num;
for (char_num = 0; char_num < span->len; char_num++)
{
- fz_text_char *ch = &span->text[char_num];
+ fz_stext_char *ch = &span->text[char_num];
if (ch->style != style)
{
if (style)
@@ -322,7 +322,7 @@ fz_print_text_page_xml(fz_context *ctx, fz_output *out, fz_text_page *page)
}
{
fz_rect rect;
- fz_text_char_bbox(ctx, &rect, span, char_num);
+ fz_stext_char_bbox(ctx, &rect, span, char_num);
fz_printf(ctx, out, "<char bbox=\"%g %g %g %g\" x=\"%g\" y=\"%g\" c=\"",
rect.x0, rect.y0, rect.x1, rect.y1, ch->p.x, ch->p.y);
}
@@ -360,7 +360,7 @@ fz_print_text_page_xml(fz_context *ctx, fz_output *out, fz_text_page *page)
}
void
-fz_print_text_page(fz_context *ctx, fz_output *out, fz_text_page *page)
+fz_print_stext_page(fz_context *ctx, fz_output *out, fz_stext_page *page)
{
int block_n;
@@ -370,15 +370,15 @@ fz_print_text_page(fz_context *ctx, fz_output *out, fz_text_page *page)
{
case FZ_PAGE_BLOCK_TEXT:
{
- fz_text_block *block = page->blocks[block_n].u.text;
- fz_text_line *line;
- fz_text_char *ch;
+ fz_stext_block *block = page->blocks[block_n].u.text;
+ fz_stext_line *line;
+ fz_stext_char *ch;
char utf[10];
int i, n;
for (line = block->lines; line < block->lines + block->len; line++)
{
- fz_text_span *span;
+ fz_stext_span *span;
for (span = line->first_span; span; span = span->next)
{
for (ch = span->text; ch < span->text + span->len; ch++)
diff --git a/source/fitz/stext-paragraph.c b/source/fitz/stext-paragraph.c
index adab5623..cbf7c925 100644
--- a/source/fitz/stext-paragraph.c
+++ b/source/fitz/stext-paragraph.c
@@ -15,7 +15,7 @@ typedef struct line_height_s
{
float height;
int count;
- fz_text_style *style;
+ fz_stext_style *style;
} line_height;
typedef struct line_heights_s
@@ -44,7 +44,7 @@ free_line_heights(line_heights *lh)
}
static void
-insert_line_height(line_heights *lh, fz_text_style *style, float height)
+insert_line_height(line_heights *lh, fz_stext_style *style, float height)
{
int i;
@@ -88,13 +88,13 @@ cull_line_heights(line_heights *lh)
printf("Before culling:\n");
for (i = 0; i < lh->len; i++)
{
- fz_text_style *style = lh->lh[i].style;
+ fz_stext_style *style = lh->lh[i].style;
printf("style=%x height=%g count=%d\n", style, lh->lh[i].height, lh->lh[i].count);
}
#endif
for (i = 0; i < lh->len; i++)
{
- fz_text_style *style = lh->lh[i].style;
+ fz_stext_style *style = lh->lh[i].style;
int count = lh->lh[i].count;
int max = i;
@@ -127,14 +127,14 @@ cull_line_heights(line_heights *lh)
printf("After culling:\n");
for (i = 0; i < lh->len; i++)
{
- fz_text_style *style = lh->lh[i].style;
+ fz_stext_style *style = lh->lh[i].style;
printf("style=%x height=%g count=%d\n", style, lh->lh[i].height, lh->lh[i].count);
}
#endif
}
static float
-line_height_for_style(line_heights *lh, fz_text_style *style)
+line_height_for_style(line_heights *lh, fz_stext_style *style)
{
int i;
@@ -147,10 +147,10 @@ line_height_for_style(line_heights *lh, fz_text_style *style)
}
static void
-split_block(fz_context *ctx, fz_text_page *page, int block_num, int linenum)
+split_block(fz_context *ctx, fz_stext_page *page, int block_num, int linenum)
{
int split_len;
- fz_text_block *block, *block2;
+ fz_stext_block *block, *block2;
if (page->len == page->cap)
{
@@ -162,7 +162,7 @@ split_block(fz_context *ctx, fz_text_page *page, int block_num, int linenum)
memmove(page->blocks+block_num+1, page->blocks+block_num, (page->len - block_num)*sizeof(*page->blocks));
page->len++;
- block2 = fz_malloc_struct(ctx, fz_text_block);
+ block2 = fz_malloc_struct(ctx, fz_stext_block);
block = page->blocks[block_num].u.text;
page->blocks[block_num+1].type = FZ_PAGE_BLOCK_TEXT;
@@ -172,11 +172,11 @@ split_block(fz_context *ctx, fz_text_page *page, int block_num, int linenum)
block2->cap = 0;
block2->len = 0;
block2->lines = NULL;
- block2->lines = fz_malloc_array(ctx, split_len, sizeof(fz_text_line));
+ block2->lines = fz_malloc_array(ctx, split_len, sizeof(fz_stext_line));
block2->cap = block2->len;
block2->len = split_len;
block->len = linenum;
- memcpy(block2->lines, block->lines + linenum, split_len * sizeof(fz_text_line));
+ memcpy(block2->lines, block->lines + linenum, split_len * sizeof(fz_stext_line));
block2->lines[0].distance = 0;
}
@@ -252,10 +252,10 @@ is_roman(int c)
#endif
static int
-is_list_entry(fz_text_line *line, fz_text_span *span, int *char_num_ptr)
+is_list_entry(fz_stext_line *line, fz_stext_span *span, int *char_num_ptr)
{
int char_num;
- fz_text_char *chr;
+ fz_stext_char *chr;
/* First, skip over any whitespace */
for (char_num = 0; char_num < span->len; char_num++)
@@ -288,7 +288,7 @@ is_list_entry(fz_text_line *line, fz_text_span *span, int *char_num_ptr)
int met_char = is_latin_char(chr->c);
for (cn = char_num+1; cn < span->len; cn++)
{
- fz_text_char *chr2 = &span->text[cn];
+ fz_stext_char *chr2 = &span->text[cn];
if (is_latin_char(chr2->c) && !met_char)
{
@@ -315,7 +315,7 @@ is_list_entry(fz_text_line *line, fz_text_span *span, int *char_num_ptr)
int cn = char_num;
for (cn = char_num+1; cn < span->len; cn++)
{
- fz_text_char *chr2 = &span->text[cn];
+ fz_stext_char *chr2 = &span->text[cn];
if (!is_roman(chr2->c) && !is_unicode_wspace(chr2->c))
break;
@@ -622,7 +622,7 @@ static void region_mask_merge(region_mask *rm1, const region_mask *rm2, int newl
rm1->len = newlen;
}
-static region_mask *region_masks_match(const region_masks *rms, const region_mask *rm, fz_text_line *line, region_mask *prev_match)
+static region_mask *region_masks_match(const region_masks *rms, const region_mask *rm, fz_stext_line *line, region_mask *prev_match)
{
int i;
float best_score = 9999999;
@@ -969,7 +969,7 @@ is_unicode_hyphenatable(int c)
}
static void
-dehyphenate(fz_text_span *s1, fz_text_span *s2)
+dehyphenate(fz_stext_span *s1, fz_stext_span *s2)
{
int i;
@@ -992,14 +992,14 @@ dehyphenate(fz_text_span *s1, fz_text_span *s2)
#ifdef DEBUG_ALIGN
static void
-dump_span(fz_text_span *span)
+dump_span(fz_stext_span *span)
{
}
static void
-dump_line(fz_text_line *line)
+dump_line(fz_stext_line *line)
{
- fz_text_span *span;
+ fz_stext_span *span;
if (!line)
return;
@@ -1017,10 +1017,10 @@ dump_line(fz_text_line *line)
#endif
void
-fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
+fz_analyze_text(fz_context *ctx, fz_stext_sheet *sheet, fz_stext_page *page)
{
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_line *line;
+ fz_stext_span *span;
line_heights *lh;
region_masks *rms;
int block_num;
@@ -1034,7 +1034,7 @@ fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
lh = new_line_heights(ctx);
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
+ fz_stext_block *block;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1045,7 +1045,7 @@ fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
/* For every style in the line, add lineheight to the
* record for that style. FIXME: This is a nasty n^2
* algorithm at the moment. */
- fz_text_style *style = NULL;
+ fz_stext_style *style = NULL;
if (line->distance == 0)
continue;
@@ -1059,7 +1059,7 @@ fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
for (; char_num < span->len; char_num++)
{
- fz_text_char *chr = &span->text[char_num];
+ fz_stext_char *chr = &span->text[char_num];
/* Ignore any whitespace chars */
if (is_unicode_wspace(chr->c))
@@ -1069,13 +1069,13 @@ fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
{
/* Have we had this style before? */
int match = 0;
- fz_text_span *span2;
+ fz_stext_span *span2;
for (span2 = line->first_span; span2 != span; span2 = span2->next)
{
int char_num2;
for (char_num2 = 0; char_num2 < span2->len; char_num2++)
{
- fz_text_char *chr2 = &span2->text[char_num2];
+ fz_stext_char *chr2 = &span2->text[char_num2];
if (chr2->style == chr->style)
{
match = 1;
@@ -1085,11 +1085,11 @@ fz_analyze_text(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
}
if (char_num > 0 && match == 0)
{
- fz_text_span *span2 = span;
+ fz_stext_span *span2 = span;
int char_num2;
for (char_num2 = 0; char_num2 < char_num; char_num2++)
{
- fz_text_char *chr2 = &span2->text[char_num2];
+ fz_stext_char *chr2 = &span2->text[char_num2];
if (chr2->style == chr->style)
{
match = 1;
@@ -1116,7 +1116,7 @@ list_entry:
for (block_num = 0; block_num < page->len; block_num++)
{
int line_num;
- fz_text_block *block;
+ fz_stext_block *block;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1128,7 +1128,7 @@ list_entry:
* is correct for that style. FIXME: We check each style
* more than once, currently. */
int ok = 0; /* -1 = early exit, split now. 0 = split. 1 = don't split. */
- fz_text_style *style = NULL;
+ fz_stext_style *style = NULL;
line = &block->lines[line_num];
if (line->distance == 0)
@@ -1147,7 +1147,7 @@ list_entry:
/* Now we do the rest of the line */
for (; char_num < span->len; char_num++)
{
- fz_text_char *chr = &span->text[char_num];
+ fz_stext_char *chr = &span->text[char_num];
/* Ignore any whitespace chars */
if (is_unicode_wspace(chr->c))
@@ -1193,7 +1193,7 @@ force_paragraph:
* normalised baseline vectors. */
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
+ fz_stext_block *block;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1278,7 +1278,7 @@ force_paragraph:
region_mask *prev_match = NULL;
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
+ fz_stext_block *block;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1329,7 +1329,7 @@ force_paragraph:
{
fz_point *region_min = &span->min;
fz_point *region_max = &span->max;
- fz_text_span *sn;
+ fz_stext_span *sn;
int col, align;
float colw, left;
@@ -1374,7 +1374,7 @@ force_paragraph:
int line_num;
int prev_line_num;
- fz_text_block *block;
+ fz_stext_block *block;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -1383,7 +1383,7 @@ force_paragraph:
/* First merge lines. This may leave empty lines behind. */
for (prev_line_num = 0, line_num = 1; line_num < block->len; line_num++)
{
- fz_text_line *prev_line;
+ fz_stext_line *prev_line;
line = &block->lines[line_num];
if (!line->first_span)
continue;
@@ -1412,9 +1412,9 @@ force_paragraph:
/* Merge line into prev_line */
{
- fz_text_span **prev_line_span = &prev_line->first_span;
+ fz_stext_span **prev_line_span = &prev_line->first_span;
int try_dehyphen = -1;
- fz_text_span *prev_span = NULL;
+ fz_stext_span *prev_span = NULL;
span = line->first_span;
while (span && *prev_line_span)
{
@@ -1433,7 +1433,7 @@ force_paragraph:
else
{
/* We want to copy span into prev_line. */
- fz_text_span *next = (*prev_line_span)->next;
+ fz_stext_span *next = (*prev_line_span)->next;
if (prev_line_span == &prev_line->first_span)
prev_line->first_span = span;
@@ -1474,7 +1474,7 @@ force_paragraph:
/* Now try to spot indents */
for (line_num = 0; line_num < block->len; line_num++)
{
- fz_text_span *span_num, *sn;
+ fz_stext_span *span_num, *sn;
int col, count;
line = &block->lines[line_num];
diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c
index 475c0c8a..4afbe6b7 100644
--- a/source/fitz/stext-search.c
+++ b/source/fitz/stext-search.c
@@ -14,16 +14,16 @@ static inline int iswhite(int c)
return c == ' ' || c == '\r' || c == '\n' || c == '\t' || c == 0xA0 || c == 0x2028 || c == 0x2029;
}
-fz_char_and_box *fz_text_char_at(fz_context *ctx, fz_char_and_box *cab, fz_text_page *page, int idx)
+fz_char_and_box *fz_stext_char_at(fz_context *ctx, fz_char_and_box *cab, fz_stext_page *page, int idx)
{
int block_num;
int ofs = 0;
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_span *span;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -35,7 +35,7 @@ fz_char_and_box *fz_text_char_at(fz_context *ctx, fz_char_and_box *cab, fz_text_
if (idx < ofs + span->len)
{
cab->c = span->text[idx - ofs].c;
- fz_text_char_bbox(ctx, &cab->bbox, span, idx - ofs);
+ fz_stext_char_bbox(ctx, &cab->bbox, span, idx - ofs);
return cab;
}
ofs += span->len;
@@ -55,30 +55,30 @@ fz_char_and_box *fz_text_char_at(fz_context *ctx, fz_char_and_box *cab, fz_text_
return cab;
}
-static int charat(fz_context *ctx, fz_text_page *page, int idx)
+static int charat(fz_context *ctx, fz_stext_page *page, int idx)
{
fz_char_and_box cab;
- return fz_text_char_at(ctx, &cab, page, idx)->c;
+ return fz_stext_char_at(ctx, &cab, page, idx)->c;
}
-static fz_rect *bboxat(fz_context *ctx, fz_text_page *page, int idx, fz_rect *bbox)
+static fz_rect *bboxat(fz_context *ctx, fz_stext_page *page, int idx, fz_rect *bbox)
{
fz_char_and_box cab;
/* FIXME: Nasty extra copy */
- *bbox = fz_text_char_at(ctx, &cab, page, idx)->bbox;
+ *bbox = fz_stext_char_at(ctx, &cab, page, idx)->bbox;
return bbox;
}
-static int textlen(fz_context *ctx, fz_text_page *page)
+static int textlen(fz_context *ctx, fz_stext_page *page)
{
int len = 0;
int block_num;
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_span *span;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -95,7 +95,7 @@ static int textlen(fz_context *ctx, fz_text_page *page)
return len;
}
-static int match(fz_context *ctx, fz_text_page *page, const char *s, int n)
+static int match(fz_context *ctx, fz_stext_page *page, const char *s, int n)
{
int orig = n;
int c;
@@ -126,7 +126,7 @@ static int match(fz_context *ctx, fz_text_page *page, const char *s, int n)
}
int
-fz_search_text_page(fz_context *ctx, fz_text_page *text, const char *needle, fz_rect *hit_bbox, int hit_max)
+fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, fz_rect *hit_bbox, int hit_max)
{
int pos, len, i, n, hit_count;
@@ -168,12 +168,12 @@ fz_search_text_page(fz_context *ctx, fz_text_page *text, const char *needle, fz_
}
int
-fz_highlight_selection(fz_context *ctx, fz_text_page *page, fz_rect rect, fz_rect *hit_bbox, int hit_max)
+fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect, fz_rect *hit_bbox, int hit_max)
{
fz_rect linebox, charbox;
- fz_text_block *block;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_span *span;
int i, block_num, hit_count;
float x0 = rect.x0;
@@ -195,7 +195,7 @@ fz_highlight_selection(fz_context *ctx, fz_text_page *page, fz_rect rect, fz_rec
{
for (i = 0; i < span->len; i++)
{
- fz_text_char_bbox(ctx, &charbox, span, i);
+ fz_stext_char_bbox(ctx, &charbox, span, i);
if (charbox.x1 >= x0 && charbox.x0 <= x1 && charbox.y1 >= y0 && charbox.y0 <= y1)
{
if (charbox.y0 != linebox.y0 || fz_abs(charbox.x0 - linebox.x1) > 5)
@@ -220,7 +220,7 @@ fz_highlight_selection(fz_context *ctx, fz_text_page *page, fz_rect rect, fz_rec
}
char *
-fz_copy_selection(fz_context *ctx, fz_text_page *page, fz_rect rect)
+fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect)
{
fz_buffer *buffer;
fz_rect hitbox;
@@ -236,9 +236,9 @@ fz_copy_selection(fz_context *ctx, fz_text_page *page, fz_rect rect)
for (block_num = 0; block_num < page->len; block_num++)
{
- fz_text_block *block;
- fz_text_line *line;
- fz_text_span *span;
+ fz_stext_block *block;
+ fz_stext_line *line;
+ fz_stext_span *span;
if (page->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -256,7 +256,7 @@ fz_copy_selection(fz_context *ctx, fz_text_page *page, fz_rect rect)
for (i = 0; i < span->len; i++)
{
- fz_text_char_bbox(ctx, &hitbox, span, i);
+ fz_stext_char_bbox(ctx, &hitbox, span, i);
c = span->text[i].c;
if (c < 32)
c = '?';
diff --git a/source/fitz/util.c b/source/fitz/util.c
index 4d1f60bf..54e5754d 100644
--- a/source/fitz/util.c
+++ b/source/fitz/util.c
@@ -193,16 +193,16 @@ fz_new_pixmap_from_page_number(fz_context *ctx, fz_document *doc, int number, co
return pix;
}
-fz_text_page *
-fz_new_text_page_from_display_list(fz_context *ctx, fz_display_list *list, fz_text_sheet *sheet)
+fz_stext_page *
+fz_new_stext_page_from_display_list(fz_context *ctx, fz_display_list *list, fz_stext_sheet *sheet)
{
- fz_text_page *text;
+ fz_stext_page *text;
fz_device *dev;
- text = fz_new_text_page(ctx);
+ text = fz_new_stext_page(ctx);
fz_try(ctx)
{
- dev = fz_new_text_device(ctx, sheet, text);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_display_list(ctx, list, dev, &fz_identity, NULL, NULL);
}
fz_always(ctx)
@@ -211,23 +211,23 @@ fz_new_text_page_from_display_list(fz_context *ctx, fz_display_list *list, fz_te
}
fz_catch(ctx)
{
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
fz_rethrow(ctx);
}
return text;
}
-fz_text_page *
-fz_new_text_page_from_page(fz_context *ctx, fz_page *page, fz_text_sheet *sheet)
+fz_stext_page *
+fz_new_stext_page_from_page(fz_context *ctx, fz_page *page, fz_stext_sheet *sheet)
{
- fz_text_page *text;
+ fz_stext_page *text;
fz_device *dev;
- text = fz_new_text_page(ctx);
+ text = fz_new_stext_page(ctx);
fz_try(ctx)
{
- dev = fz_new_text_device(ctx, sheet, text);
+ dev = fz_new_stext_device(ctx, sheet, text);
fz_run_page(ctx, page, dev, &fz_identity, NULL);
}
fz_always(ctx)
@@ -236,22 +236,22 @@ fz_new_text_page_from_page(fz_context *ctx, fz_page *page, fz_text_sheet *sheet)
}
fz_catch(ctx)
{
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
fz_rethrow(ctx);
}
return text;
}
-fz_text_page *
-fz_new_text_page_from_page_number(fz_context *ctx, fz_document *doc, int number, fz_text_sheet *sheet)
+fz_stext_page *
+fz_new_stext_page_from_page_number(fz_context *ctx, fz_document *doc, int number, fz_stext_sheet *sheet)
{
fz_page *page;
- fz_text_page *text;
+ fz_stext_page *text;
page = fz_load_page(ctx, doc, number);
fz_try(ctx)
- text = fz_new_text_page_from_page(ctx, page, sheet);
+ text = fz_new_stext_page_from_page(ctx, page, sheet);
fz_always(ctx)
fz_drop_page(ctx, page);
fz_catch(ctx)
@@ -262,42 +262,42 @@ fz_new_text_page_from_page_number(fz_context *ctx, fz_document *doc, int number,
int
fz_search_display_list(fz_context *ctx, fz_display_list *list, const char *needle, fz_rect *hit_bbox, int hit_max)
{
- fz_text_sheet *sheet;
- fz_text_page *text;
+ fz_stext_sheet *sheet;
+ fz_stext_page *text;
int count;
- sheet = fz_new_text_sheet(ctx);
+ sheet = fz_new_stext_sheet(ctx);
fz_try(ctx)
{
- text = fz_new_text_page_from_display_list(ctx, list, sheet);
- count = fz_search_text_page(ctx, text, needle, hit_bbox, hit_max);
+ text = fz_new_stext_page_from_display_list(ctx, list, sheet);
+ count = fz_search_stext_page(ctx, text, needle, hit_bbox, hit_max);
}
fz_always(ctx)
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
fz_rethrow(ctx);
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
return count;
}
int
fz_search_page(fz_context *ctx, fz_page *page, const char *needle, fz_rect *hit_bbox, int hit_max)
{
- fz_text_sheet *sheet;
- fz_text_page *text;
+ fz_stext_sheet *sheet;
+ fz_stext_page *text;
int count;
- sheet = fz_new_text_sheet(ctx);
+ sheet = fz_new_stext_sheet(ctx);
fz_try(ctx)
{
- text = fz_new_text_page_from_page(ctx, page, sheet);
- count = fz_search_text_page(ctx, text, needle, hit_bbox, hit_max);
+ text = fz_new_stext_page_from_page(ctx, page, sheet);
+ count = fz_search_stext_page(ctx, text, needle, hit_bbox, hit_max);
}
fz_always(ctx)
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
fz_rethrow(ctx);
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
return count;
}
@@ -318,7 +318,7 @@ fz_search_page_number(fz_context *ctx, fz_document *doc, int number, const char
}
fz_buffer *
-fz_new_buffer_from_text_page(fz_context *ctx, fz_text_page *text, const fz_rect *sel, int crlf)
+fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *text, const fz_rect *sel, int crlf)
{
fz_buffer *buf;
fz_rect hitbox;
@@ -347,9 +347,9 @@ fz_new_buffer_from_text_page(fz_context *ctx, fz_text_page *text, const fz_rect
{
for (block_num = 0; block_num < text->len; block_num++)
{
- fz_text_line *line;
- fz_text_block *block;
- fz_text_span *span;
+ fz_stext_line *line;
+ fz_stext_block *block;
+ fz_stext_span *span;
if (text->blocks[block_num].type != FZ_PAGE_BLOCK_TEXT)
continue;
@@ -363,7 +363,7 @@ fz_new_buffer_from_text_page(fz_context *ctx, fz_text_page *text, const fz_rect
for (i = 0; i < span->len; i++)
{
int c;
- fz_text_char_bbox(ctx, &hitbox, span, i);
+ fz_stext_char_bbox(ctx, &hitbox, span, i);
c = span->text[i].c;
if (c < 32)
c = '?';
@@ -399,42 +399,42 @@ fz_new_buffer_from_text_page(fz_context *ctx, fz_text_page *text, const fz_rect
fz_buffer *
fz_new_buffer_from_display_list(fz_context *ctx, fz_display_list *list, const fz_rect *sel, int crlf)
{
- fz_text_sheet *sheet;
- fz_text_page *text;
+ fz_stext_sheet *sheet;
+ fz_stext_page *text;
fz_buffer *buf;
- sheet = fz_new_text_sheet(ctx);
+ sheet = fz_new_stext_sheet(ctx);
fz_try(ctx)
{
- text = fz_new_text_page_from_display_list(ctx, list, sheet);
- buf = fz_new_buffer_from_text_page(ctx, text, sel, crlf);
+ text = fz_new_stext_page_from_display_list(ctx, list, sheet);
+ buf = fz_new_buffer_from_stext_page(ctx, text, sel, crlf);
}
fz_always(ctx)
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
fz_rethrow(ctx);
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
return buf;
}
fz_buffer *
fz_new_buffer_from_page(fz_context *ctx, fz_page *page, const fz_rect *sel, int crlf)
{
- fz_text_sheet *sheet;
- fz_text_page *text;
+ fz_stext_sheet *sheet;
+ fz_stext_page *text;
fz_buffer *buf;
- sheet = fz_new_text_sheet(ctx);
+ sheet = fz_new_stext_sheet(ctx);
fz_try(ctx)
{
- text = fz_new_text_page_from_page(ctx, page, sheet);
- buf = fz_new_buffer_from_text_page(ctx, text, sel, crlf);
+ text = fz_new_stext_page_from_page(ctx, page, sheet);
+ buf = fz_new_buffer_from_stext_page(ctx, text, sel, crlf);
}
fz_always(ctx)
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_sheet(ctx, sheet);
fz_catch(ctx)
fz_rethrow(ctx);
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
return buf;
}
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 705cd6eb..b486171a 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -141,7 +141,7 @@ static int bandheight = 0;
static int errored = 0;
static int append = 0;
-static fz_text_sheet *sheet = NULL;
+static fz_stext_sheet *sheet = NULL;
static fz_colorspace *colorspace;
static char *filename;
static int files = 0;
@@ -331,14 +331,14 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
else if (output_format == OUT_TEXT || output_format == OUT_HTML || output_format == OUT_STEXT)
{
- fz_text_page *text = NULL;
+ fz_stext_page *text = NULL;
fz_var(text);
fz_try(ctx)
{
- text = fz_new_text_page(ctx);
- dev = fz_new_text_device(ctx, sheet, text);
+ text = fz_new_stext_page(ctx);
+ dev = fz_new_stext_device(ctx, sheet, text);
if (output_format == OUT_HTML)
fz_disable_device_hints(ctx, dev, FZ_IGNORE_IMAGE);
if (list)
@@ -349,16 +349,16 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
dev = NULL;
if (output_format == OUT_STEXT)
{
- fz_print_text_page_xml(ctx, out, text);
+ fz_print_stext_page_xml(ctx, out, text);
}
else if (output_format == OUT_HTML)
{
fz_analyze_text(ctx, sheet, text);
- fz_print_text_page_html(ctx, out, text);
+ fz_print_stext_page_html(ctx, out, text);
}
else if (output_format == OUT_TEXT)
{
- fz_print_text_page(ctx, out, text);
+ fz_print_stext_page(ctx, out, text);
fz_printf(ctx, out, "\f\n");
}
}
@@ -366,7 +366,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
{
fz_drop_device(ctx, dev);
dev = NULL;
- fz_drop_text_page(ctx, text);
+ fz_drop_stext_page(ctx, text);
}
fz_catch(ctx)
{
@@ -1046,7 +1046,7 @@ int mudraw_main(int argc, char **argv)
fz_printf(ctx, out, "<?xml version=\"1.0\"?>\n");
if (output_format == OUT_TEXT || output_format == OUT_HTML || output_format == OUT_STEXT)
- sheet = fz_new_text_sheet(ctx);
+ sheet = fz_new_stext_sheet(ctx);
if (output_format == OUT_HTML)
{
@@ -1140,11 +1140,11 @@ int mudraw_main(int argc, char **argv)
{
fz_printf(ctx, out, "</body>\n");
fz_printf(ctx, out, "<style>\n");
- fz_print_text_sheet(ctx, out, sheet);
+ fz_print_stext_sheet(ctx, out, sheet);
fz_printf(ctx, out, "</style>\n");
}
- fz_drop_text_sheet(ctx, sheet);
+ fz_drop_stext_sheet(ctx, sheet);
fz_drop_output(ctx, out);
out = NULL;