solarus icon indicating copy to clipboard operation
solarus copied to clipboard

Text surfaces with text of varying size do not align properly

Open llamaizing opened this issue 6 years ago • 0 comments

Current vertical alignment options for a text_surface are "top", "middle" and "bottom". I would propose a new "baseline" option to get text of varying size to align properly.

This image shows what text looks like using bottom alignment, top alignment and the proposed baseline alignment: text_alignment

A new text_surface method would also be needed to determine how many pixels are above or below the baseline for layout planning purposes. Perhaps something like text_surface:get_baseline_height(). In the image above, the baseline is 6 pixels from the bottom for the small text and 9 pixels from the bottom for the large text.

These proposed changes would not be applicable for bitmap fonts.

llamaizing avatar Mar 10 '18 09:03 llamaizing