summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2016-07-11 13:35:57 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2016-07-11 13:35:57 +0900
commitbfeda891a51178dd0032800ea4aef013c62bbe10 (patch)
tree0e558b6dc8862eb5d7fd54838181d3ffa287380c
parent8dc4626a0bd13b8d256a9d0c44e321d2c3d702d7 (diff)
* src/macfont.m (mac_font_shape): Make sure that total_advance is increasing.
-rw-r--r--src/macfont.m10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/macfont.m b/src/macfont.m
index 4e4daba070..c799100c85 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)