britzl / defold-richtext

Defold-RichText is a system to create styled text based on an HTML inspired markup language
MIT License
75 stars 12 forks source link

Combine words causes wrong metrics #35

Closed dapetcu21 closed 5 years ago

dapetcu21 commented 5 years ago

The spacing between words that rich-text applies is not always consistent with the one that Defold applies. This causes lines of text to be more compact than the reported metrics and stuff like this happens, where a lot of extra space is being unused and the line is not well center-aligned:

Screenshot 2019-08-23 at 15 27 42

I think the correct approach for combine_words would be to attempt to combine the words during layout (preferably between getting word metrics and actually creating the node) and measure the whole combined string, not just words individually.

I can try to write a PR for that, as I would really want to have more accurate word spacing in Interrogation, both for improving readability and improving text density.