aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2016-07-11 13:35:57 +0900
committerYAMAMOTO Mitsuharu2016-07-11 13:35:57 +0900
commitbfeda891a51178dd0032800ea4aef013c62bbe10 (patch)
tree0e558b6dc8862eb5d7fd54838181d3ffa287380c /src
parent8dc4626a0bd13b8d256a9d0c44e321d2c3d702d7 (diff)
downloademacs-bfeda891a51178dd0032800ea4aef013c62bbe10.tar.gz
emacs-bfeda891a51178dd0032800ea4aef013c62bbe10.zip
* src/macfont.m (mac_font_shape): Make sure that total_advance is increasing.
Diffstat (limited to 'src')
-rw-r--r--src/macfont.m10
1 files changed, 6 insertions, 4 deletions
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,
3767 { 3767 {
3768 struct mac_glyph_layout *gl; 3768 struct mac_glyph_layout *gl;
3769 CGPoint position; 3769 CGPoint position;
3770 CGFloat max_x;
3770 3771
3771 if (!RIGHT_TO_LEFT_P) 3772 if (!RIGHT_TO_LEFT_P)
3772 gl = glbuf + range.location; 3773 gl = glbuf + range.location;
@@ -3788,12 +3789,13 @@ mac_font_shape (CTFontRef font, CFStringRef string,
3788 CTRunGetGlyphs (ctrun, range, &gl->glyph_id); 3789 CTRunGetGlyphs (ctrun, range, &gl->glyph_id);
3789 3790
3790 CTRunGetPositions (ctrun, range, &position); 3791 CTRunGetPositions (ctrun, range, &position);
3792 max_x = position.x + CTRunGetTypographicBounds (ctrun, range,
3793 NULL, NULL, NULL);
3794 max_x = max (max_x, total_advance);
3791 gl->advance_delta = position.x - total_advance; 3795 gl->advance_delta = position.x - total_advance;
3792 gl->baseline_delta = position.y; 3796 gl->baseline_delta = position.y;
3793 gl->advance = (gl->advance_delta 3797 gl->advance = max_x - total_advance;
3794 + CTRunGetTypographicBounds (ctrun, range, 3798 total_advance = max_x;
3795 NULL, NULL, NULL));
3796 total_advance += gl->advance;
3797 } 3799 }
3798 3800
3799 if (RIGHT_TO_LEFT_P) 3801 if (RIGHT_TO_LEFT_P)