From: Grigori Goronzy Date: Sun, 3 Mar 2013 22:45:26 +0000 (+0100) Subject: shaper: correctly handle @font advance X-Git-Tag: 0.10.2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=256df617e227af2ed7274f4281756ec38ad30a70;p=libass shaper: correctly handle @font advance The code was confusing glyph index and unicode codepoint index. Fixes issue 94. --- 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; }