* 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.
This commit is contained in:
Jan Djärv 2013-01-13 15:29:22 +01:00
parent a89c8ef024
commit b826986f36
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2013-01-13 Jan Djärv <jan.h.d@swipnet.se>
* 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 <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
* gtkutil.c (xg_initialize): Backport from trunk.

View file

@ -44,6 +44,7 @@
#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 @@ is false when (FROM > 0 || TO < S->nchars). */
else
CGContextSetShouldAntialias (gcontext, 1);
CGContextSetShouldSmoothFonts (gcontext, NO);
CGContextSetTextMatrix (gcontext, fliptf);
if (bgCol != nil)
@ -1401,11 +1401,12 @@ is false when (FROM > 0 || TO < S->nchars). */
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); */