mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #11032 - mbrubeck:no-whitespace, r=pcwalton
Filter out whitespace glyphs from display list Fixes #10244. r? @glennw <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11032) <!-- Reviewable:end -->
This commit is contained in:
commit
df8008cfe6
3 changed files with 26 additions and 18 deletions
|
@ -394,14 +394,16 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
|||
for slice in item.text_run.natural_word_slices_in_visual_order(&item.range) {
|
||||
for glyph in slice.glyphs.iter_glyphs_for_byte_range(&slice.range) {
|
||||
let glyph_advance = glyph.advance();
|
||||
let glyph_offset = glyph.offset().unwrap_or(Point2D::zero());
|
||||
let glyph = webrender_traits::GlyphInstance {
|
||||
index: glyph.id(),
|
||||
x: (origin.x + glyph_offset.x).to_f32_px(),
|
||||
y: (origin.y + glyph_offset.y).to_f32_px(),
|
||||
};
|
||||
origin = Point2D::new(origin.x + glyph_advance, origin.y);
|
||||
glyphs.push(glyph);
|
||||
if !slice.glyphs.is_whitespace() {
|
||||
let glyph_offset = glyph.offset().unwrap_or(Point2D::zero());
|
||||
let glyph = webrender_traits::GlyphInstance {
|
||||
index: glyph.id(),
|
||||
x: (origin.x + glyph_offset.x).to_f32_px(),
|
||||
y: (origin.y + glyph_offset.y).to_f32_px(),
|
||||
};
|
||||
glyphs.push(glyph);
|
||||
}
|
||||
origin.x = origin.x + glyph_advance;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue