Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glyph_brush_layout: Options for Text Tracking and Line Height #132

Open
anlumo opened this issue Feb 18, 2021 · 5 comments
Open

glyph_brush_layout: Options for Text Tracking and Line Height #132

anlumo opened this issue Feb 18, 2021 · 5 comments

Comments

@anlumo
Copy link

anlumo commented Feb 18, 2021

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).

@alexheretic
Copy link
Owner

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?

@anlumo
Copy link
Author

anlumo commented Feb 18, 2021

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.

@alexheretic
Copy link
Owner

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,

@mattzque
Copy link

mattzque commented Jun 7, 2023

Is there any update on this? I was looking for line spacing adjustment in bevy which uses this library I believe.

@alexheretic
Copy link
Owner

I believe the next step here would be a concrete PR proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants