diff options
author | Kristian Rietveld <kris@gtk.org> | 2010-03-06 19:06:36 +0100 |
---|---|---|
committer | Kristian Rietveld <kris@gtk.org> | 2011-04-14 12:30:03 +0200 |
commit | b5efdc928f392c2ec47c206af3cbeddb986553a0 (patch) | |
tree | 22059f819753c65f471b1b81820b8885c79a2e0a /pango/pangocairo-coretextfont.c | |
parent | 76124c029f4262831f0c8eaca802b45179c407da (diff) | |
download | pango-b5efdc928f392c2ec47c206af3cbeddb986553a0.tar.gz |
Handle oblique fonts; synthesize italic fonts when needed
Deduce from the given style name whether a font is oblique. If a font
family does not have an italic or oblique variant, then add synthetic
italic variants that are handled by Pango.
Diffstat (limited to 'pango/pangocairo-coretextfont.c')
-rw-r--r-- | pango/pangocairo-coretextfont.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pango/pangocairo-coretextfont.c b/pango/pangocairo-coretextfont.c index 81747ac3..0f0c4041 100644 --- a/pango/pangocairo-coretextfont.c +++ b/pango/pangocairo-coretextfont.c @@ -212,6 +212,7 @@ _pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap, const PangoFontDescription *desc) { const char *postscript_name; + gboolean synthesize_italic = FALSE; PangoCairoCoreTextFont *cafont; PangoCoreTextFont *cfont; CFStringRef cfstr; @@ -245,7 +246,9 @@ _pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap, font_ref = CTFontCreateWithName (cfstr, size, NULL); CFRelease (cfstr); - /* FIXME: Do we need the synthetic italic handling here? */ + if (_pango_core_text_face_get_synthetic_italic (face)) + synthesize_italic = TRUE; + font_id = CTFontCopyGraphicsFont (font_ref, NULL); if (!font_id) return NULL; @@ -265,7 +268,14 @@ _pango_cairo_core_text_font_new (PangoCairoCoreTextFontMap *cafontmap, cafont->size = size; - cairo_matrix_init_identity (&font_matrix); + if (synthesize_italic) + cairo_matrix_init (&font_matrix, + 1, 0, + -0.25, 1, + 0, 0); + else + cairo_matrix_init_identity (&font_matrix); + cairo_matrix_scale (&font_matrix, size, size); _pango_cairo_font_private_initialize (&cafont->cf_priv, |