From 15af7e09d1a72384b309ffef0da1fc08383e702f Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Tue, 11 Mar 2008 18:05:43 +0000 Subject: [PATCH] Adapt the shear matrix for synthesized italic to work with cairo 1.5.13+, 2008-03-11 Richard Hult * pango/pangocairo-atsuifont.c (_pango_cairo_atsui_font_new): Adapt the shear matrix for synthesized italic to work with cairo 1.5.13+, where the quartz surface has been fixed for transformed text. svn path=/trunk/; revision=2583 --- ChangeLog | 7 +++++++ pango/pangocairo-atsuifont.c | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 362a440..57ccf98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-11 Richard Hult + + * pango/pangocairo-atsuifont.c (_pango_cairo_atsui_font_new): + Adapt the shear matrix for synthesized italic to work with cairo + 1.5.13+, where the quartz surface has been fixed for transformed + text. + 2008-03-10 Behdad Esfahbod * === Released 1.20.0 === diff --git a/pango/pangocairo-atsuifont.c b/pango/pangocairo-atsuifont.c index ef7a4b4..2328202 100644 --- a/pango/pangocairo-atsuifont.c +++ b/pango/pangocairo-atsuifont.c @@ -210,6 +210,7 @@ _pango_cairo_atsui_font_new (PangoCairoATSUIFontMap *cafontmap, ATSUFontID font_id; double size; double dpi; + double m; cairo_matrix_t font_matrix; postscript_name = _pango_atsui_face_get_postscript_name (face); @@ -281,11 +282,19 @@ _pango_cairo_atsui_font_new (PangoCairoATSUIFontMap *cafontmap, cafont->size = size; - /* If necessary, apply a shear matrix, matching what Cocoa does. */ + /* When synthesizing italics, apply a shear matrix matching what Cocoa + * does. Cairo quartz had transformed text wrong before 1.5.13, stay + * backwards compatible until pango requires a new enough cairo. + */ + if (cairo_version () >= CAIRO_VERSION_ENCODE(1,5,13)) + m = -0.25; + else + m = 0.25; + if (synthesize_italic) cairo_matrix_init (&font_matrix, 1, 0, - 0.25, 1, + m, 1, 0, 0); else cairo_matrix_init_identity (&font_matrix); -- 2.7.4