summaryrefslogtreecommitdiff
path: root/src/cairo-scaled-font.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-scaled-font.c')
-rw-r--r--src/cairo-scaled-font.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index b40e4d4..2702877 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2071,6 +2071,7 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
cairo_box_t box = { { INT_MAX, INT_MAX }, { INT_MIN, INT_MIN }};
cairo_scaled_glyph_t *glyph_cache[64];
cairo_bool_t overlap = overlap_out ? FALSE : TRUE;
+ cairo_round_glyph_positions_t round_glyph_positions = _cairo_font_options_get_round_glyph_positions (&scaled_font->options);
int i;
if (unlikely (scaled_font->status))
@@ -2099,11 +2100,17 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
glyph_cache[cache_index] = scaled_glyph;
}
- x = _cairo_fixed_from_double (glyphs[i].x);
+ if (round_glyph_positions == CAIRO_ROUND_GLYPH_POS_ON)
+ x = _cairo_fixed_from_double (_cairo_lround (glyphs[i].x));
+ else
+ x = _cairo_fixed_from_double (glyphs[i].x);
x1 = x + scaled_glyph->bbox.p1.x;
x2 = x + scaled_glyph->bbox.p2.x;
- y = _cairo_fixed_from_double (glyphs[i].y);
+ if (round_glyph_positions == CAIRO_ROUND_GLYPH_POS_ON)
+ y = _cairo_fixed_from_double (_cairo_lround (glyphs[i].y));
+ else
+ y = _cairo_fixed_from_double (glyphs[i].y);
y1 = y + scaled_glyph->bbox.p1.y;
y2 = y + scaled_glyph->bbox.p2.y;
@@ -2487,7 +2494,7 @@ _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
&scaled_glyph);
if (status == CAIRO_STATUS_SUCCESS) {
status = _cairo_path_fixed_append (path,
- scaled_glyph->path, CAIRO_DIRECTION_FORWARD,
+ scaled_glyph->path,
_cairo_fixed_from_double (glyphs[i].x),
_cairo_fixed_from_double (glyphs[i].y));
@@ -2786,6 +2793,8 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
if (unlikely (scaled_font->status))
return scaled_font->status;
+ assert (CAIRO_MUTEX_IS_LOCKED(scaled_font->mutex));
+
if (CAIRO_INJECT_FAULT ())
return _cairo_error (CAIRO_STATUS_NO_MEMORY);