summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2016-08-29 20:48:06 +0100
committerAlan Third <alan@idiocy.org>2016-09-04 23:06:14 +0100
commit62e4dc4660cb3b29cfffcad0639e51c7f382ced8 (patch)
tree545a6445ec5561c32b56f5ed5815768df71a6e9f
parentca47390727c55a40a54d0dea3b15bd094ea9cde2 (diff)
Fix synthetic bold on macOS retina displays
* src/macfont.m (macfont_draw): Multiply the synthetic bold scaling factor by the OS window backing scale factor.
-rw-r--r--src/macfont.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macfont.m b/src/macfont.m
index c799100c85..d9bad034fe 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2878,7 +2878,19 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y,
if (macfont_info->synthetic_bold_p && ! no_antialias_p)
{
CGContextSetTextDrawingMode (context, kCGTextFillStroke);
+
+ /* Stroke line width for text drawing is not correctly
+ scaled on Retina display/HiDPI mode when drawn to screen
+ (whereas it is correctly scaled when drawn to bitmaps),
+ and synthetic bold looks thinner on such environments.
+ Apple says there are no plans to address this issue
+ (rdar://11644870) currently. So we add a workaround. */
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ CGContextSetLineWidth (context, synthetic_bold_factor * font_size
+ * [[FRAME_NS_VIEW(f) window] backingScaleFactor]);
+#else
CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
+#endif
CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f);
}
if (no_antialias_p)