From: Jan Djärv Date: Sun, 13 Jan 2013 14:29:22 +0000 (+0100) Subject: * nsfont.m (LCD_SMOOTHING_MARGIN): New define. X-Git-Tag: emacs-24.2.93~56 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b826986f36c63534c0705b99e3604193518c080b;p=emacs.git * nsfont.m (LCD_SMOOTHING_MARGIN): New define. (nsfont_draw): Remove disabling of LCD smoothing. (ns_glyph_metrics): Add LCD_SMOOTHING_MARGIN to bearings to fix Bug#11484 with LCD smooting on. --- diff --git a/src/ChangeLog b/src/ChangeLog index dbba6322423..18eb69c9f69 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-01-13 Jan Djärv + + * nsfont.m (LCD_SMOOTHING_MARGIN): New define. + (nsfont_draw): Remove disabling of LCD smoothing. + (ns_glyph_metrics): Add LCD_SMOOTHING_MARGIN to bearings to fix + Bug#11484 with LCD smooting on. + 2013-01-11 Rainer Orth (tiny change) * gtkutil.c (xg_initialize): Backport from trunk. diff --git a/src/nsfont.m b/src/nsfont.m index 9dd80b28b9f..207b6a40483 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -44,6 +44,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu) #endif #define NSFONT_TRACE 0 +#define LCD_SMOOTHING_MARGIN 2 extern Lisp_Object Qns; extern Lisp_Object Qnormal, Qbold, Qitalic, Qcondensed, Qexpanded; @@ -1235,7 +1236,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, else CGContextSetShouldAntialias (gcontext, 1); - CGContextSetShouldSmoothFonts (gcontext, NO); CGContextSetTextMatrix (gcontext, fliptf); if (bgCol != nil) @@ -1401,11 +1401,12 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) lb = r.origin.x; rb = r.size.width - w; + // Add to bearing for LCD smoothing. We don't know if it is there. if (lb < 0) - metrics->lbearing = round (lb); + metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN); if (font_info->ital) rb += 0.22 * font_info->height; - metrics->rbearing = lrint (w + rb); + metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN); metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; /*lrint (hshrink * [sfont ascender] + expand * hd/2); */