Skip to content

Commit

Permalink
fix excessive correction of bounding
Browse files Browse the repository at this point in the history
Commit 69984fb extended glyph bounding boxes in the wrong
(pre-scaled) coordinate system.
  • Loading branch information
mflatt committed Apr 15, 2014
1 parent 69984fb commit 16dcc6f
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions racket/src/native-libs/patches/cairo-coretext.patch
@@ -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,

0 comments on commit 16dcc6f

Please sign in to comment.