From e310747e00e9146d7ca36e5af9d168438c72d280 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 8 Mar 2017 14:13:07 +0100 Subject: svgwrite: Fix pen advance for ligatures. harfbuzz puts all ligature component characters at the same coordinate as the glyph. --- source/fitz/svg-device.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'source/fitz') diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index 9d42bbdf..3cae86fe 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -363,9 +363,20 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const it = &span->items[i]; if (it->ucs >= 0) { - p.x = it->x; - p.y = it->y; - fz_transform_point(&p, &inv_tm); + if (it->gid >= 0) + { + p.x = it->x; + p.y = it->y; + fz_transform_point(&p, &inv_tm); + } + else + { + /* we have no glyph (such as in a ligature) -- advance a bit */ + if (span->wmode == 0) + p.x += font_size * 0.3f; + else + p.y += font_size; + } fz_printf(ctx, out, " %g", span->wmode == 0 ? p.x : p.y); } } -- cgit v1.2.3