summaryrefslogtreecommitdiff
path: root/fitz/dev_text.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-05-25 21:37:41 +0200
committerTor Andersson <tor@ghostscript.com>2010-05-25 21:37:41 +0200
commitfb5e03a705ab0214459e6ddf6dfdb9acf1adf83c (patch)
treefb4c8effc24bef48a38369d69c5a9986922bb79c /fitz/dev_text.c
parentd2c97a9a5b13536a993dc6b3c271cbebf50032d0 (diff)
downloadmupdf-fb5e03a705ab0214459e6ddf6dfdb9acf1adf83c.tar.xz
Support one-to-many glyph/character mappings.
Diffstat (limited to 'fitz/dev_text.c')
-rw-r--r--fitz/dev_text.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fitz/dev_text.c b/fitz/dev_text.c
index 0753fe31..91b259b4 100644
--- a/fitz/dev_text.c
+++ b/fitz/dev_text.c
@@ -103,6 +103,8 @@ fz_addtextchar(fz_textspan **last, fz_font *font, float size, int c, fz_bbox bbo
switch (c)
{
+ case -1: /* ignore when one unicode character maps to multiple glyphs */
+ break;
case 0xFB00: /* ff */
fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 2));
fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 1, 2));
@@ -233,8 +235,17 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
fz_warn("freetype set character size: %s", ft_errorstring(fterr));
}
+ rect = fz_emptyrect;
+
for (i = 0; i < text->len; i++)
{
+ if (text->els[i].gid < 0)
+ {
+ /* TODO: split rect for one-to-many mapped chars */
+ fz_addtextchar(last, font, size, text->els[i].ucs, fz_roundrect(rect));
+ continue;
+ }
+
/* Get point in user space to perform heuristic space and newspan tests */
p.x = text->els[i].x;
p.y = text->els[i].y;