diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-12-25 01:29:41 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-12-25 01:29:41 -0500 |
commit | f4c81e18f85c6a68d682301abfd75e7c208c1e1a (patch) | |
tree | 73630d6cab05265a39c65dfc79d728836f78e367 /src/cairo-font-face-twin.c | |
parent | af91fc1974ce2dfbaab187e22769cdfb9e6279d9 (diff) |
[twin] Disable pen hinting if hinting is off
Diffstat (limited to 'src/cairo-font-face-twin.c')
-rw-r--r-- | src/cairo-font-face-twin.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/cairo-font-face-twin.c b/src/cairo-font-face-twin.c index 796561f4..60ed81e5 100644 --- a/src/cairo-font-face-twin.c +++ b/src/cairo-font-face-twin.c @@ -304,14 +304,19 @@ typedef struct { } twin_snap_info_t; static void -_twin_compute_snap (cairo_t *cr, - twin_snap_info_t *info, - const signed char *b) +_twin_compute_snap (cairo_t *cr, + cairo_scaled_font_t *scaled_font, + twin_snap_info_t *info, + const signed char *b) { int s, n; const signed char *snap; double x, y; + info->snap = scaled_font->options.hint_style != CAIRO_HINT_STYLE_NONE; + if (!info->snap) + return; + x = 1; y = 0; cairo_user_to_device_distance (cr, &x, &y); info->x_scale = sqrt (x*x + y*y); @@ -343,12 +348,20 @@ _twin_compute_snap (cairo_t *cr, } static void -_twin_compute_pen (cairo_t *cr, +_twin_compute_pen (cairo_t *cr, + cairo_scaled_font_t *scaled_font, double width, double *penx, double *peny) { double x, y; double scale, inv; + cairo_bool_t hint; + + hint = scaled_font->options.hint_style != CAIRO_HINT_STYLE_NONE; + if (!hint) { + *penx = *peny = width; + return; + } x = 1; y = 0; cairo_user_to_device_distance (cr, &x, &y); @@ -401,7 +414,7 @@ twin_scaled_font_render_glyph (cairo_scaled_font_t *scaled_font, cairo_scale (cr, stretch, 1); /* lock pen matrix */ - _twin_compute_pen (cr, weight, &penx, &peny); + _twin_compute_pen (cr, scaled_font, weight, &penx, &peny); cairo_save (cr); /* left margin + pen width, pen width */ @@ -431,9 +444,7 @@ twin_scaled_font_render_glyph (cairo_scaled_font_t *scaled_font, gw = monow; } - info.snap = scaled_font->options.hint_style != CAIRO_HINT_STYLE_NONE; - if (info.snap) - _twin_compute_snap (cr, &info, b); + _twin_compute_snap (cr, scaled_font, &info, b); /* advance width */ metrics->x_advance = gw + penx * 3; /* pen width + margin */ |