diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 71b42fe2c9e..c602a3b73e5 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -465,19 +465,17 @@ impl<'a> GlyphStore { /// otherwise, this glyph represents multiple characters. pub fn add_glyph_for_char_index(&mut self, i: CharIndex, - character: Option, + character: char, data: &GlyphData) { - fn glyph_is_compressible(data: &GlyphData) -> bool { - is_simple_glyph_id(data.id) - && is_simple_advance(data.advance) + let glyph_is_compressible = is_simple_glyph_id(data.id) && + is_simple_advance(data.advance) && data.offset == Point2D::zero() - && data.cluster_start // others are stored in detail buffer - } + && data.cluster_start; // others are stored in detail buffer debug_assert!(data.ligature_start); // can't compress ligature continuation glyphs. debug_assert!(i < self.char_len()); - let mut entry = match (data.is_missing, glyph_is_compressible(data)) { + let mut entry = match (data.is_missing, glyph_is_compressible) { (true, _) => GlyphEntry::missing(1), (false, true) => GlyphEntry::simple(data.id, data.advance), (false, false) => { @@ -488,7 +486,7 @@ impl<'a> GlyphStore { } }; - if character == Some(' ') { + if character == ' ' { entry = entry.set_char_is_space() } diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 5a539358779..87397b46c28 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -456,7 +456,7 @@ impl Shaper { false, true, true); - glyphs.add_glyph_for_char_index(char_idx, Some(character), &data); + glyphs.add_glyph_for_char_index(char_idx, character, &data); } else { let shape = glyph_data.entry_for_glyph(glyph_span.begin(), &mut y_pos); let advance = self.advance_for_shaped_glyph(shape.advance, character, options); @@ -466,7 +466,7 @@ impl Shaper { false, true, true); - glyphs.add_glyph_for_char_index(char_idx, Some(character), &data); + glyphs.add_glyph_for_char_index(char_idx, character, &data); } } else { // collect all glyphs to be assigned to the first character.