Open anlumo opened 3 years ago
Yes I think it would be nice to support this.
Perhaps having configurable tracking & line-height adjustment values per "section".
pub struct SectionText<'a> {
pub text: &'a str,
pub scale: PxScale,
pub font_id: FontId,
pub tracking_adjust: f32, // new
pub line_height_adjust: f32, // new
}
Would something like that work?
Yes, that would be great!
Ideally, line_height_adjust
would be a scaling factor to the regular line height of the chosen font. So, 1 would be the default, 2 would be double line height, etc.
I'd like them to behave as least surprisingly as possible. GIMP calls these "letter spacing" & "line spacing", they both seem to be floating point pixel values. So line-spacing 1.5 means +1.5px
. They might be better/more intuitive names too, I'm not sure.
pub letter_spacing: f32,
pub line_spacing: f32,
Is there any update on this? I was looking for line spacing adjustment in bevy which uses this library I believe.
I believe the next step here would be a concrete PR proposal.
Is there a chance that the layouting could allow adjusting the tracking (changing glyph spacing after kerning) and line height?
I guess I can try adjusting those by scaling X/Y of the glyph positions after layouting, but I'm afraid that it might break the layout in some way (for example if there are some glyphs that should stick together, like combining characters).