From fe187681d8f59dea89a09dd9ee48f757a3ded3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Fri, 18 Jul 2014 15:56:00 +0200 Subject: allow to extract text for uncacheable glyphs Certain glyphs such as found in nested Type 3 font can't be cached. Currently, the text extraction device doesn't see these as they're sent only as drawing operations. Sending them also as invisible text fixes potentially missing letters. --- source/pdf/pdf-op-run.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index da881b2e..22e6a4be 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -1142,18 +1142,18 @@ pdf_show_char(pdf_csi *csi, pdf_run_state *pr, int cid) fz_matrix composed; fz_concat(&composed, &trm, &gstate->ctm); fz_render_t3_glyph_direct(ctx, pr->dev, fontdesc->font, gid, &composed, gstate, pr->nested_depth); + /* Render text invisibly so that it can still be extracted. */ + pr->text_mode = 3; } - else - { - fz_union_rect(&pr->text_bbox, &bbox); - /* add glyph to textobject */ - fz_add_text(ctx, pr->text, gid, ucsbuf[0], trm.e, trm.f); + fz_union_rect(&pr->text_bbox, &bbox); - /* add filler glyphs for one-to-many unicode mapping */ - for (i = 1; i < ucslen; i++) - fz_add_text(ctx, pr->text, -1, ucsbuf[i], trm.e, trm.f); - } + /* add glyph to textobject */ + fz_add_text(ctx, pr->text, gid, ucsbuf[0], trm.e, trm.f); + + /* add filler glyphs for one-to-many unicode mapping */ + for (i = 1; i < ucslen; i++) + fz_add_text(ctx, pr->text, -1, ucsbuf[i], trm.e, trm.f); if (fontdesc->wmode == 0) { -- cgit v1.2.3