* Source/cairo/CairoFontInfo.m (-setupAttributes):

We must not leave the hinting settings as their defaults,
because if we did, that would mean using the surface defaults
which might or might not use hinting (xlib does by default.)

Since we make measurements outside of the context of a surface
(-advancementForGlyph:), we need to ensure that the same
hinting settings are used there as when we draw. For now,
just force hinting to be off.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@34612 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2012-01-23 22:40:29 +00:00
parent 8199abe52f
commit 50b1296149
2 changed files with 58 additions and 0 deletions

View file

@ -1,3 +1,15 @@
2012-01-23 Eric Wasylishen <ewasylishen@gmail.com>
* Source/cairo/CairoFontInfo.m (-setupAttributes):
We must not leave the hinting settings as their defaults,
because if we did, that would mean using the surface defaults
which might or might not use hinting (xlib does by default.)
Since we make measurements outside of the context of a surface
(-advancementForGlyph:), we need to ensure that the same
hinting settings are used there as when we draw. For now,
just force hinting to be off.
2012-01-19 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/x11/XGServerWindow.m (-orderwindow:::): Introduce new

View file

@ -111,6 +111,17 @@
return NO;
}
// We must not leave the hinting settings as their defaults,
// because if we did, that would mean using the surface defaults
// which might or might not use hinting (xlib does by default.)
//
// Since we make measurements outside of the context of a surface
// (-advancementForGlyph:), we need to ensure that the same
// hinting settings are used there as when we draw. For now,
// just force hinting to be off.
cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_OFF);
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
_scaled = cairo_scaled_font_create(face, &font_matrix, &ctm, options);
cairo_font_options_destroy(options);
if (cairo_scaled_font_status(_scaled) != CAIRO_STATUS_SUCCESS)
@ -394,6 +405,25 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
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",
cairo_status_to_string(cairo_status(ct)));
cairo_destroy(ct);
cairo_surface_destroy(isurface);
free(cdata);
return;
}
if ([path elementCount] > 0)
{
NSPoint p;
@ -482,6 +512,22 @@ BOOL _cairo_extents_for_NSGlyph(cairo_scaled_font_t *scaled_font, NSGlyph glyph,
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",
cairo_status_to_string(cairo_status(ct)));
return;
}
cairo_show_text(ct, str);
if (cairo_status(ct) != CAIRO_STATUS_SUCCESS)
{