Render tab character (\t) as four spaces
This commit is contained in:
parent
fd3444473f
commit
cbe6faa83b
1 changed files with 8 additions and 1 deletions
|
@ -107,13 +107,20 @@ impl FontImpl {
|
||||||
if glyph.id().0 == 0 {
|
if glyph.id().0 == 0 {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let glyph_info = allocate_glyph(
|
let mut glyph_info = allocate_glyph(
|
||||||
&mut self.atlas.lock(),
|
&mut self.atlas.lock(),
|
||||||
glyph,
|
glyph,
|
||||||
self.scale_in_pixels,
|
self.scale_in_pixels,
|
||||||
self.y_offset,
|
self.y_offset,
|
||||||
self.pixels_per_point,
|
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);
|
self.glyph_info_cache.write().insert(c, glyph_info);
|
||||||
Some(glyph_info)
|
Some(glyph_info)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue