From: YAMAMOTO Mitsuharu Date: Mon, 11 Jul 2016 04:35:57 +0000 (+0900) Subject: * src/macfont.m (mac_font_shape): Make sure that total_advance is increasing. X-Git-Tag: emacs-26.0.90~1840^2~81 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bfeda891a51178dd0032800ea4aef013c62bbe10;p=emacs.git * src/macfont.m (mac_font_shape): Make sure that total_advance is increasing. --- diff --git a/src/macfont.m b/src/macfont.m index 4e4daba0707..c799100c855 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -3767,6 +3767,7 @@ mac_font_shape (CTFontRef font, CFStringRef string, { struct mac_glyph_layout *gl; CGPoint position; + CGFloat max_x; if (!RIGHT_TO_LEFT_P) gl = glbuf + range.location; @@ -3788,12 +3789,13 @@ mac_font_shape (CTFontRef font, CFStringRef string, CTRunGetGlyphs (ctrun, range, &gl->glyph_id); CTRunGetPositions (ctrun, range, &position); + max_x = position.x + CTRunGetTypographicBounds (ctrun, range, + NULL, NULL, NULL); + max_x = max (max_x, total_advance); gl->advance_delta = position.x - total_advance; gl->baseline_delta = position.y; - gl->advance = (gl->advance_delta - + CTRunGetTypographicBounds (ctrun, range, - NULL, NULL, NULL)); - total_advance += gl->advance; + gl->advance = max_x - total_advance; + total_advance = max_x; } if (RIGHT_TO_LEFT_P)