[cairo-commit] src/cairo-type3-glyph-surface.c test/bitmap-font-pdf-argb32-ref.png test/Makefile.am
Adrian Johnson
ajohnson at kemper.freedesktop.org
Fri Sep 26 04:23:06 PDT 2008
dev/null |binary
src/cairo-type3-glyph-surface.c | 10 +++-------
test/Makefile.am | 1 -
3 files changed, 3 insertions(+), 8 deletions(-)
New commits:
commit 907f550a1b13b0a388f9ff22663911d4aabbe2d8
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Fri Sep 26 20:26:55 2008 +0930
Fix bitmap-font XFAIL
Images in PDF are scaled to a unit square. In PS we set the
ImageMatrix to do the same. When the image is painted we scale the
graphics state to paint the image at the right size. In the case of
Type 3 fonts consisting of bitmap images we want to paint the images
at their original size so we scale the graphics state by the image
width and height.
The bug was that we were scaling by the width/height in the glyph
metrics. For non rotated fonts this worked. However for rotated fonts
the width/height of the glyph images may be larger than the
width/height in the glyph metrics. This resulted in a Type 3 font
where the glyph images were scaled slightly smaller than they should
have been.
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index 2124400..1382743 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -345,7 +345,7 @@ _cairo_type3_glyph_surface_emit_fallback_image (cairo_type3_glyph_surface_t *sur
cairo_status_t status;
cairo_image_surface_t *image;
cairo_matrix_t mat;
- double width, height, x, y;
+ double x, y;
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
@@ -361,14 +361,10 @@ _cairo_type3_glyph_surface_emit_fallback_image (cairo_type3_glyph_surface_t *sur
x = _cairo_fixed_to_double (scaled_glyph->bbox.p1.x);
y = _cairo_fixed_to_double (scaled_glyph->bbox.p2.y);
- width = _cairo_fixed_to_double (scaled_glyph->bbox.p2.x) -
- _cairo_fixed_to_double (scaled_glyph->bbox.p1.x);
- height = _cairo_fixed_to_double (scaled_glyph->bbox.p2.y) -
- _cairo_fixed_to_double (scaled_glyph->bbox.p1.y);
- mat.xx = width;
+ mat.xx = image->width;
mat.xy = 0;
mat.yx = 0;
- mat.yy = height;
+ mat.yy = image->height;
mat.x0 = x;
mat.y0 = y;
cairo_matrix_multiply (&mat, &mat, &surface->scaled_font->scale_inverse);
diff --git a/test/Makefile.am b/test/Makefile.am
index a0247fe..1081bb0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -789,7 +789,6 @@ XFAIL_TESTS = \
alpha-similar$(EXEEXT) \
big-line$(EXEEXT) \
big-trap$(EXEEXT) \
-bitmap-font$(EXEEXT) \
degenerate-path$(EXEEXT) \
device-offset-scale$(EXEEXT) \
extend-pad$(EXEEXT) \
diff --git a/test/bitmap-font-pdf-argb32-ref.png b/test/bitmap-font-pdf-argb32-ref.png
deleted file mode 100644
index 925fe07..0000000
Binary files a/test/bitmap-font-pdf-argb32-ref.png and /dev/null differ
More information about the cairo-commit
mailing list