Round x_advance to nearest monospace width when requested, fixes #237
This commit is contained in:
parent
40fee41332
commit
8a7bc790e5
1 changed files with 5 additions and 1 deletions
|
|
@ -1616,7 +1616,7 @@ impl ShapeLine {
|
||||||
_ => font_size,
|
_ => font_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
let x_advance = glyph_font_size.mul_add(
|
let mut x_advance = glyph_font_size.mul_add(
|
||||||
glyph.x_advance,
|
glyph.x_advance,
|
||||||
if word.blank {
|
if word.blank {
|
||||||
justification_expansion
|
justification_expansion
|
||||||
|
|
@ -1624,6 +1624,10 @@ impl ShapeLine {
|
||||||
0.0
|
0.0
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if let Some(match_em_width) = match_mono_em_width {
|
||||||
|
// Round to nearest monospace width
|
||||||
|
x_advance = ((x_advance / match_em_width).round()) * match_em_width;
|
||||||
|
}
|
||||||
if self.rtl {
|
if self.rtl {
|
||||||
x -= x_advance;
|
x -= x_advance;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue