Set monospace width on text buffers
Make use of the addition to cosmic-text that allows matching the widths of fallback Monospace fonts to the default one. Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
parent
cea7dd0974
commit
f5cf7e0040
1 changed files with 6 additions and 2 deletions
|
|
@ -203,7 +203,9 @@ impl Terminal {
|
||||||
// Use size of space to determine cell size
|
// Use size of space to determine cell size
|
||||||
buffer.set_text(&mut font_system, " ", default_attrs, Shaping::Advanced);
|
buffer.set_text(&mut font_system, " ", default_attrs, Shaping::Advanced);
|
||||||
let layout = buffer.line_layout(&mut font_system, 0).unwrap();
|
let layout = buffer.line_layout(&mut font_system, 0).unwrap();
|
||||||
(layout[0].w, metrics.line_height)
|
let w = layout[0].w;
|
||||||
|
buffer.set_monospace_width(font_system, Some(w));
|
||||||
|
(w, metrics.line_height)
|
||||||
};
|
};
|
||||||
|
|
||||||
let size = Size {
|
let size = Size {
|
||||||
|
|
@ -546,7 +548,9 @@ impl Terminal {
|
||||||
// Use size of space to determine cell size
|
// Use size of space to determine cell size
|
||||||
buffer.set_text(font_system.raw(), " ", default_attrs, Shaping::Advanced);
|
buffer.set_text(font_system.raw(), " ", default_attrs, Shaping::Advanced);
|
||||||
let layout = buffer.line_layout(font_system.raw(), 0).unwrap();
|
let layout = buffer.line_layout(font_system.raw(), 0).unwrap();
|
||||||
(layout[0].w, buffer.metrics().line_height)
|
let w = layout[0].w;
|
||||||
|
buffer.set_monospace_width(font_system.raw(), Some(w));
|
||||||
|
(w, buffer.metrics().line_height)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue