From 256df617e227af2ed7274f4281756ec38ad30a70 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sun, 3 Mar 2013 23:45:26 +0100 Subject: shaper: correctly handle @font advance The code was confusing glyph index and unicode codepoint index. Fixes issue 94. --- libass/ass_shaper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c index 9434f43..6ffc083 100644 --- a/libass/ass_shaper.c +++ b/libass/ass_shaper.c @@ -203,6 +203,12 @@ get_cached_metrics(struct ass_shaper_metrics_data *metrics, FT_Face face, return NULL; memcpy(&new_val.metrics, &face->glyph->metrics, sizeof(FT_Glyph_Metrics)); + + // if @font rendering is enabled and the glyph should be rotated, + // make cached_h_advance pick up the right advance later + if (metrics->vertical && glyph >= VERTICAL_LOWER_BOUND) + new_val.metrics.horiAdvance = new_val.metrics.vertAdvance; + val = ass_cache_put(metrics->metrics_cache, &metrics->hash_key, &new_val); } @@ -234,9 +240,6 @@ cached_h_advance(hb_font_t *font, void *font_data, hb_codepoint_t glyph, if (!metrics) return 0; - if (metrics_priv->vertical && glyph > VERTICAL_LOWER_BOUND) - return metrics->metrics.vertAdvance; - return metrics->metrics.horiAdvance; } -- cgit v1.2.3