macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

add `draw_multiline_text` and `draw_multiline_text_ex`

Open cyrgani opened this issue 1 year ago • 1 comments

This PR adds two functions for drawing multiline text that breaks on newlines. The new draw_multiline_text and draw_multiline_text_ex functions mirror the existing signatures of the draw_text and draw_text_ex functions.

A different option would be to add a field pub is_multiline: bool to TextParams, which would avoid having two new functions, but that would be a breaking change and would have to wait for 0.5.

cyrgani avatar Jun 30 '24 20:06 cyrgani

I do not know enough about fonts to properly comment on this, but, apparently, there are some hints made by font designers for multiline rendering, for example this field looks relevant? https://docs.rs/fontdue/latest/fontdue/struct.LineMetrics.html#structfield.line_gap

not-fl3 avatar Jul 01 '24 17:07 not-fl3

I updated the code to use this fields values if a custom font is given, the font specifies such a distance and the caller doesn't set a line distance manually.

cyrgani avatar Jul 07 '24 19:07 cyrgani

Thanks for PR!

not-fl3 avatar Jul 13 '24 16:07 not-fl3