Skip to content

Commit

Permalink
Render tab character (\t) as four spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 23, 2021
1 parent fd34444 commit cbe6faa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion epaint/src/text/font.rs
Expand Up @@ -107,13 +107,20 @@ impl FontImpl {
if glyph.id().0 == 0 {
None
} else {
let glyph_info = allocate_glyph(
let mut glyph_info = allocate_glyph(
&mut self.atlas.lock(),
glyph,
self.scale_in_pixels,
self.y_offset,
self.pixels_per_point,
);

if c == '\t' {
if let Some(space) = self.glyph_info(' ') {
glyph_info.advance_width = 4.0 * space.advance_width;
}
}

self.glyph_info_cache.write().insert(c, glyph_info);
Some(glyph_info)
}
Expand Down

0 comments on commit cbe6faa

Please sign in to comment.