diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2011-07-29 19:11:53 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2011-08-01 14:11:53 +0100 |
commit | 5a46065a0df691a79b75f5e61e34e344afd5349a (patch) | |
tree | 3a4f175c73fbb945a4df3d1abcd822a5571641b5 /draw | |
parent | 684cd3ebbbeaffbf416a09aad6af2cb160cec6bb (diff) | |
download | mupdf-5a46065a0df691a79b75f5e61e34e344afd5349a.tar.xz |
Add support for colored Type3 glyphs (ones that use d0).
Detect the d0 or d1 operators by writing a bit to the new device
flags word. This can then be checked by the Type3 code to create
the appropriate backing pixmap.
In order to know what the appropriate backing pixmap is, we pass
an additional colorspace into the glyph rendering code.
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw_device.c | 18 | ||||
-rw-r--r-- | draw/draw_glyph.c | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c index 52393081..22cdc720 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -426,12 +426,20 @@ fz_draw_fill_text(void *user, fz_text *text, fz_matrix ctm, trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX); trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX); - glyph = fz_render_glyph(dev->cache, text->font, gid, trm); + glyph = fz_render_glyph(dev->cache, text->font, gid, trm, model); if (glyph) { - draw_glyph(colorbv, dev->dest, glyph, x, y, dev->scissor); - if (dev->shape) - draw_glyph(&shapebv, dev->shape, glyph, x, y, dev->scissor); + if (glyph->n == 1) + { + draw_glyph(colorbv, dev->dest, glyph, x, y, dev->scissor); + if (dev->shape) + draw_glyph(&shapebv, dev->shape, glyph, x, y, dev->scissor); + } + else + { + fz_matrix ctm = {glyph->w, 0.0, 0.0, glyph->h, x, y}; + fz_paint_image(dev->dest, dev->scissor, dev->shape, glyph, ctm, alpha * 255); + } fz_drop_pixmap(glyph); } } @@ -570,7 +578,7 @@ fz_draw_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate) trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX); trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX); - glyph = fz_render_glyph(dev->cache, text->font, gid, trm); + glyph = fz_render_glyph(dev->cache, text->font, gid, trm, model); if (glyph) { draw_glyph(NULL, mask, glyph, x, y, bbox); diff --git a/draw/draw_glyph.c b/draw/draw_glyph.c index 383c0d68..95f3955d 100644 --- a/draw/draw_glyph.c +++ b/draw/draw_glyph.c @@ -68,11 +68,11 @@ fz_render_stroked_glyph(fz_glyph_cache *cache, fz_font *font, int gid, fz_matrix { if (font->ft_face) return fz_render_ft_stroked_glyph(font, gid, trm, ctm, stroke); - return fz_render_glyph(cache, font, gid, trm); + return fz_render_glyph(cache, font, gid, trm, NULL); } fz_pixmap * -fz_render_glyph(fz_glyph_cache *cache, fz_font *font, int gid, fz_matrix ctm) +fz_render_glyph(fz_glyph_cache *cache, fz_font *font, int gid, fz_matrix ctm, fz_colorspace *model) { fz_glyph_key key; fz_pixmap *val; @@ -108,7 +108,7 @@ fz_render_glyph(fz_glyph_cache *cache, fz_font *font, int gid, fz_matrix ctm) } else if (font->t3procs) { - val = fz_render_t3_glyph(font, gid, ctm); + val = fz_render_t3_glyph(font, gid, ctm, model); } else { |