diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-28 07:59:42 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-28 07:59:42 -0700 |
commit | 97a58e96898a67b585419b73fa411fb4c12be54a (patch) | |
tree | f80141d4bb1b06aaf72440be2dddca293218774c | |
parent | 4d05bf23b82b7e36210aaa2e911ec4c79a1ed2d0 (diff) | |
download | servo-97a58e96898a67b585419b73fa411fb4c12be54a.tar.gz servo-97a58e96898a67b585419b73fa411fb4c12be54a.zip |
Don't assume the first glyph is part of the first char
Shaper::save_glyph_results incorrectly starts its loop by setting glyph_span
to a length of 1. This means that the `if glyph_span.len() == 0` test in the
inner loop will never succeed.
Instead the glyph span should start out empty, and a glyph should be added only
as the corresponding char is found. For comparison, see the Gecko code this
was ported from:
https://hg.mozilla.org/mozilla-central/file/ab0044bf/gfx/thebes/gfxHarfBuzzShaper.cpp#l1682
-rw-r--r-- | components/gfx/text/shaping/harfbuzz.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index ef472d8f4cc..72bf4158149 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -323,9 +323,8 @@ impl Shaper { // in cases with complex glyph-character associations, 2+ glyphs and 1+ chars can be // processed. while glyph_span.start < glyph_count { - // start by looking at just one glyph. - glyph_span.end += 1; debug!("Processing glyph at idx={}", glyph_span.start); + glyph_span.end = glyph_span.start; let char_byte_start = glyph_data.byte_offset_of_glyph(glyph_span.start) as usize; char_byte_span = char_byte_start..char_byte_start; |