From 907f550a1b13b0a388f9ff22663911d4aabbe2d8 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 26 Sep 2008 20:26:55 +0930 Subject: [PATCH] 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. --- src/cairo-type3-glyph-surface.c | 10 +++------- test/Makefile.am | 1 - test/bitmap-font-pdf-argb32-ref.png | Bin 1064 -> 0 bytes 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 test/bitmap-font-pdf-argb32-ref.png diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c index 2124400cc..138274325 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 a0247fec3..1081bb0a2 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 925fe07e222ef78a808419dab915bac330f858ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1064 zcmV+@1lRkCP)5`C4xTS#^>KDSPB(p!z1?3aw(yr)+RbR)(TNvK(rvk7;Z(tuDfcT|COI11A0_yRWsvX~i)Aj{vQ7Gg z4U|S+&$+s+OURRkG_k7}n+}|ACz|7Psu{z)NC;{zGh)#w=UB3uTr6T%ie$PCs_;~o zF~Z6nTcag!o-=|zeNK6c=SDF23Q6fVFY8wXT-0Xh%D=ilUQEw5M9U8~4{;wq6SEtS z!!7;+;)@#(sNe)yujFwG|AdRq7_*$wlm2jKef2DZGn4Kl>tMn|;+2cZ)-@h--;{GI zFbfc7naE%Vlx1P8h3`>!HwvA7)_Q|O^I#`vy*x&}dlKcJ{xGj}o^Ve0-E5zn}0Is`@Jk@*Y4dCW2Nh zI81TY@n4mB$j>EF4DuwI$6DuZ2Y*#sS9(Z3r1bgVc*4f;>U%7~zV={M|GlkE>R3`xNtd6>_4^nIZL9t+Y-&;abK7 zzRJuo9?klRF$X)l+ref7T?cP({p9`pfVJ@THEBb4JjY|tqha%x2dz5FyP!O?seaHqqm&Mo_kWF19$#9@;;dmTG!}G)W z?6KRa7UcUoG!1Q$BUr;6l$rS*i{{MFXTecHkfFuv9Qi0tfIl>@2;zFBAzK2s+kF5hRY>Ut-89i>(YshM8owe3H#DEBVG@OzGx}> zw#4OoUO~w|Z(w-41*bZaJM*$B3`1@ z>NTdX)B&Jv!CGhqbdtGBf(ULU^(qaA!?^;_})0000