summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/stext-device.c7
-rw-r--r--source/fitz/stext-output.c4
-rw-r--r--source/fitz/stext-search.c17
-rw-r--r--source/fitz/util.c4
4 files changed, 9 insertions, 23 deletions
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index d4d502b1..2d8a0b29 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -34,13 +34,6 @@ const char *fz_stext_options_usage =
"\tpreserve-images: keep images in output\n"
"\n";
-fz_rect *
-fz_stext_char_bbox(fz_context *ctx, fz_rect *bbox, fz_stext_line *line, fz_stext_char *ch)
-{
- *bbox = ch->bbox;
- return bbox;
-}
-
fz_stext_page *
fz_new_stext_page(fz_context *ctx, const fz_rect *mediabox)
{
diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c
index 0fe6be4f..63cd3c17 100644
--- a/source/fitz/stext-output.c
+++ b/source/fitz/stext-output.c
@@ -349,7 +349,6 @@ fz_print_stext_page_as_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
fz_font *font = NULL;
float size = 0;
const char *name = NULL;
- fz_rect rect;
fz_write_printf(ctx, out, "<line bbox=\"%g %g %g %g\" wmode=\"%d\" dir=\"%g %g\">\n",
line->bbox.x0, line->bbox.y0, line->bbox.x1, line->bbox.y1,
@@ -367,9 +366,8 @@ fz_print_stext_page_as_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
name = font_full_name(ctx, font);
fz_write_printf(ctx, out, "<font name=\"%s\" size=\"%g\">\n", name, size);
}
- fz_stext_char_bbox(ctx, &rect, line, ch);
fz_write_printf(ctx, out, "<char bbox=\"%g %g %g %g\" x=\"%g\" y=\"%g\" c=\"",
- rect.x0, rect.y0, rect.x1, rect.y1, ch->origin.x, ch->origin.y);
+ ch->bbox.x0, ch->bbox.y0, ch->bbox.x1, ch->bbox.y1, ch->origin.x, ch->origin.y);
switch (ch->c)
{
case '<': fz_write_string(ctx, out, "&lt;"); break;
diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c
index 79071684..4bf2882a 100644
--- a/source/fitz/stext-search.c
+++ b/source/fitz/stext-search.c
@@ -34,7 +34,7 @@ fz_char_and_box *fz_stext_char_at(fz_context *ctx, fz_char_and_box *cab, fz_stex
if (ofs == idx)
{
cab->c = ch->c;
- fz_stext_char_bbox(ctx, &cab->bbox, line, ch);
+ cab->bbox = ch->bbox;
return cab;
}
++ofs;
@@ -172,7 +172,7 @@ fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, f
int
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_rect linebox;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
@@ -194,18 +194,17 @@ fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect, fz_re
linebox = fz_empty_rect;
for (ch = line->first_char; ch; ch = ch->next)
{
- fz_stext_char_bbox(ctx, &charbox, line, ch);
- if (charbox.x1 >= x0 && charbox.x0 <= x1 && charbox.y1 >= y0 && charbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
- if (charbox.y0 != linebox.y0 || fz_abs(charbox.x0 - linebox.x1) > 5)
+ if (ch->bbox.y0 != linebox.y0 || fz_abs(ch->bbox.x0 - linebox.x1) > 5)
{
if (!fz_is_empty_rect(&linebox) && hit_count < hit_max)
hit_bbox[hit_count++] = linebox;
- linebox = charbox;
+ linebox = ch->bbox;
}
else
{
- fz_union_rect(&linebox, &charbox);
+ fz_union_rect(&linebox, &ch->bbox);
}
}
}
@@ -221,7 +220,6 @@ char *
fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect)
{
fz_buffer *buffer;
- fz_rect hitbox;
int c, seen = 0;
unsigned char *s;
fz_stext_block *block;
@@ -250,11 +248,10 @@ fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect)
for (ch = line->first_char; ch; ch = ch->next)
{
- fz_stext_char_bbox(ctx, &hitbox, line, ch);
c = ch->c;
if (c < 32)
c = FZ_REPLACEMENT_CHARACTER;
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
fz_append_rune(ctx, buffer, c);
seen = 1;
diff --git a/source/fitz/util.c b/source/fitz/util.c
index d22c6a7b..5d75aaad 100644
--- a/source/fitz/util.c
+++ b/source/fitz/util.c
@@ -394,7 +394,6 @@ fz_buffer *
fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *page, const fz_rect *sel, int crlf)
{
fz_buffer *buf;
- fz_rect hitbox;
float x0, y0, x1, y1;
fz_stext_block *block;
fz_stext_line *line;
@@ -430,10 +429,9 @@ fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *page, const fz_rec
for (ch = line->first_char; ch; ch = ch->next)
{
int c = ch->c;
- fz_stext_char_bbox(ctx, &hitbox, line, ch);
if (c < 32)
c = FZ_REPLACEMENT_CHARACTER;
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
saw_text = 1;
if (need_newline)