From 4c06213c78a78b7346da3130ba3f660e6b715f54 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Sun, 29 Dec 2013 22:43:15 +0000 Subject: [PATCH] * Source/cairo/CairoGState.m (-GSSetFont:), * Source/cairo/CairoFaceInfo.m (-drawGlyphs:...): Use scaled font directly. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@37523 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/cairo/CairoFontInfo.m | 34 ++++------------------------------ Source/cairo/CairoGState.m | 9 +-------- 3 files changed, 10 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 526296e..d0bc3f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-12-29 Fred Kiefer + + * Source/cairo/CairoGState.m (-GSSetFont:), + * Source/cairo/CairoFaceInfo.m (-drawGlyphs:...): Use scaled font directly. + 2013-12-26 Fred Kiefer * Source/xlib/GSXftFontInfo.m diff --git a/Source/cairo/CairoFontInfo.m b/Source/cairo/CairoFontInfo.m index 0be4a4c..4ca98c5 100644 --- a/Source/cairo/CairoFontInfo.m +++ b/Source/cairo/CairoFontInfo.m @@ -348,7 +348,8 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph, // Set font options from the scaled font // FIXME: Instead of setting the matrix, setting the face, and setting - // the options, we should be using cairo_set_scaled_font + // the options, we should be using cairo_set_scaled_font(). + // But we have to deal with the flipped matrix here. { cairo_font_options_t *options = cairo_font_options_create(); cairo_scaled_font_get_font_options(_scaled, options); @@ -413,7 +414,6 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph, length: (int)length on: (cairo_t*)ct { - cairo_matrix_t font_matrix; unichar ustr[length+1]; char str[3*length+1]; unsigned char *b; @@ -435,36 +435,10 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph, return; } - cairo_matrix_init(&font_matrix, matrix[0], matrix[1], -matrix[2], - matrix[3], matrix[4], matrix[5]); - cairo_set_font_matrix(ct, &font_matrix); + cairo_set_scaled_font(ct, _scaled); if (cairo_status(ct) != CAIRO_STATUS_SUCCESS) { - NSLog(@"Error while setting font matrix: %s", - cairo_status_to_string(cairo_status(ct))); - return; - } - - cairo_set_font_face(ct, [_faceInfo fontFace]); - if (cairo_status(ct) != CAIRO_STATUS_SUCCESS) - { - NSLog(@"Error while setting font face: %s", - cairo_status_to_string(cairo_status(ct))); - return; - } - - // Set font options from the scaled font - // FIXME: Instead of setting the matrix, setting the face, and setting - // the options, we should be using cairo_set_scaled_font - { - cairo_font_options_t *options = cairo_font_options_create(); - cairo_scaled_font_get_font_options(_scaled, options); - cairo_set_font_options(ct, options); - cairo_font_options_destroy(options); - } - if (cairo_status(ct) != CAIRO_STATUS_SUCCESS) - { - NSLog(@"Error while setting font options: %s", + NSLog(@"Error while setting scaled font: %s", cairo_status_to_string(cairo_status(ct))); return; } diff --git a/Source/cairo/CairoGState.m b/Source/cairo/CairoGState.m index 7ad3ffe..b0ce9b2 100644 --- a/Source/cairo/CairoGState.m +++ b/Source/cairo/CairoGState.m @@ -401,18 +401,11 @@ static inline CGFloat floatToUserSpace(NSAffineTransform *ctm, double d) - (void) GSSetFont: (GSFontInfo *)fontref { - cairo_matrix_t font_matrix; - const CGFloat *matrix; - [super GSSetFont: fontref]; if (_ct) { - matrix = [font matrix]; - cairo_set_font_face(_ct, [((CairoFontInfo *)font)->_faceInfo fontFace]); - cairo_matrix_init(&font_matrix, matrix[0], matrix[1], matrix[2], - matrix[3], matrix[4], matrix[5]); - cairo_set_font_matrix(_ct, &font_matrix); + cairo_set_scaled_font(_ct, ((CairoFontInfo *)font)->_scaled); } }