diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-03-14 14:09:45 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-03-14 14:09:45 +0100 |
commit | 621e33bdb921bdc3ccd9068101acd3858c9c14c8 (patch) | |
tree | 01dbd18769aa8bf727d3c686d210e549bf472d15 /fitz | |
parent | 660c9c737f51a189d96eb3ed51e73bb4f038079f (diff) | |
download | mupdf-621e33bdb921bdc3ccd9068101acd3858c9c14c8.tar.xz |
Some fixes to the new text device, courtesy of Zeniko.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/dev_text.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fitz/dev_text.c b/fitz/dev_text.c index 4f27dd4f..edf45fe2 100644 --- a/fitz/dev_text.c +++ b/fitz/dev_text.c @@ -319,6 +319,11 @@ fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, fz_matrix c descender = (float)face->descender / face->units_per_EM; fz_unlock(ctx, FZ_LOCK_FREETYPE); } + else if (font->t3procs && !fz_is_empty_rect(font->bbox)) + { + ascender = font->bbox.y1; + descender = font->bbox.y0; + } rect = fz_empty_rect; @@ -374,9 +379,9 @@ fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, fz_matrix c { fz_rect spacerect; spacerect.x0 = -0.2f; - spacerect.y0 = 0; + spacerect.y0 = descender; spacerect.x1 = 0; - spacerect.y1 = 1; + spacerect.y1 = ascender; spacerect = fz_transform_rect(trm, spacerect); fz_add_text_char(ctx, dev, style, ' ', spacerect); dev->lastchar = ' '; @@ -433,8 +438,9 @@ fz_text_extract(fz_context *ctx, fz_text_device *dev, fz_text *text, fz_matrix c for (j = 0; j < multi; j++) { fz_rect part = fz_split_bbox(rect, j, multi); - fz_add_text_char(ctx, dev, style, text->items[i].ucs, part); + fz_add_text_char(ctx, dev, style, text->items[i + j].ucs, part); } + i += j - 1; } dev->lastchar = text->items[i].ucs; @@ -653,7 +659,8 @@ fz_print_text_page_html(fz_context *ctx, FILE *out, fz_text_page *page) fprintf(out, "&#x%x;", ch->c); } } - fz_print_style_end(out, style); + if (style != NULL) + fz_print_style_end(out, style); fprintf(out, "</p>\n"); } fprintf(out, "</div>\n"); |