fix excessive correction of bounding

Commit 69984fb231 extended glyph bounding boxes in the wrong
(pre-scaled) coordinate system.
This commit is contained in:
Matthew Flatt 2014-04-15 14:40:13 -06:00
parent 69984fb231
commit 16dcc6f62a

View File

@ -1,21 +1,14 @@
diff -r -u old/cairo-1.12.16/src/cairo-quartz-font.c new/cairo-1.12.16/src/cairo-quartz-font.c
--- old/cairo-1.12.16/src/cairo-quartz-font.c 2014-04-15 11:04:35.000000000 -0600
+++ new/cairo-1.12.16/src/cairo-quartz-font.c 2014-04-15 11:05:43.000000000 -0600
@@ -461,10 +461,12 @@
bbox.size.width / emscale, bbox.size.height / emscale);
#endif
--- old/cairo-1.12.16/src/cairo-quartz-font.c 2014-04-15 13:39:14.000000000 -0600
+++ new/cairo-1.12.16/src/cairo-quartz-font.c 2014-04-15 14:39:00.000000000 -0600
@@ -440,7 +440,9 @@
bbox.size.height / emscale);
- xmin = CGRectGetMinX(bbox);
- ymin = CGRectGetMinY(bbox);
- xmax = CGRectGetMaxX(bbox);
- ymax = CGRectGetMaxY(bbox);
+ /* add 1 to bounds to avoid round-off error that happens somewhere
+ in the path of rendering text (e.g., "-" vs. "-d" with 12-point Menlo) */
+ xmin = CGRectGetMinX(bbox)-1;
+ ymin = CGRectGetMinY(bbox)-1;
+ xmax = CGRectGetMaxX(bbox)+1;
+ ymax = CGRectGetMaxY(bbox)+1;
extents.x_bearing = xmin;
extents.y_bearing = - ymax;
/* Should we want to always integer-align glyph extents, we can do so in this way */
-#if 0
+ /* Do so to avoid round-off error that happens somewhere in the path of rendering
+ text (e.g., "-" vs. "-d" with 12-point Menlo) */
+#if 1
{
CGAffineTransform textMatrix;
textMatrix = CGAffineTransformMake (font->base.scale.xx,