mooman219 / fontdue

The fastest font renderer in the world, written in pure rust.
Apache License 2.0
1.44k stars 72 forks source link

First-line indentation #40

Open emilk opened 4 years ago

emilk commented 4 years ago

First-line indentation is very common in typesetting, and looks like this:

   The first line starts
further to the right than
the subsequent lines of
text.

It would be wonderful if fontdue could support it, e.g. with a simple first_line_indentation: f32 in LayoutSettings, especially if this is simple to implement. Of course the setting only makes sense for HorizontalAlign::Left.

I am writing an immediate mode GUI and this would enable me to seemlessly mix text with others widgets (in a row-based fashion). Basically I would use first_line_indentation to indicate that I've already used up the first few pixels of the first line (maybe there is a button there or some other text using a different font).

mooman219 commented 4 years ago

I see your goal but I don't like this idea specifically. A compromise would be the ability to define a TextStyle with a minimum size such that you can insert blank sections of any size anywhere. Is that sufficient?

emilk commented 4 years ago

That sounds like more than sufficient to me! And it's not at all a compromise, but a cleaner and more general solution to the problem I want to solve - good call!