diff options
author | Grigori Goronzy <greg@blackbox> | 2013-03-03 23:45:26 +0100 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2013-03-03 23:45:26 +0100 |
commit | 256df617e227af2ed7274f4281756ec38ad30a70 (patch) | |
tree | 433aa1181f64790745c4e2742e080cf1786e4ae9 /libass/ass_shaper.c | |
parent | 1ae86d2390b3e64b5f6574fa1628461bc403ae14 (diff) | |
download | libass-256df617e227af2ed7274f4281756ec38ad30a70.tar.bz2 libass-256df617e227af2ed7274f4281756ec38ad30a70.tar.xz |
shaper: correctly handle @font advance
The code was confusing glyph index and unicode codepoint index.
Fixes issue 94.
Diffstat (limited to 'libass/ass_shaper.c')
-rw-r--r-- | libass/ass_shaper.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c index 9434f432..6ffc083a 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; } |