Closed anlumo closed 2 years ago
It is deliberate that the built in layout will drop spaces between lines, otherwise the space would cause words to bump out of the align bound in some cases and it would look wrong.
So just including the trailing space in a word would be wrong, but maybe the current method could be improved / made more standard. Can you provide some more detailed examples of how other layout engines handle this?
I should have mentioned that this is not an automatic line break, that's a manual one. I'm not limiting the bounds on either axis.
Ah yes that's an interesting distinction that isn't considered by the logic at the moment.
So I think if other layout engines handle right-aligned Foo \nbar
with the space jutting the "Foo" out then glyph-brush probably should too.
Wordpad:
Affinity Designer:
Froala (aka a Chrome contenteditable):
Autodesk Fusion 360:
So, so far it's 1/4 on the text layouting engines I have access to right now…
Thanks for investigating. So there's some inconsistency here it seems.
I'll also add that GIMP will ignore spaces when bound-wrapping Foo bar
in the same way as glyph-brush, but will respect the space in Foo \nbar
My current thinking is that as long as it only affects explicit hard breaks it probably won't be any harm for glyph-brush to act this way too (assuming it won't be horrible to implement).
GIMP's method seem to be it'll ignore 1 space and 1 space only.
Foo<sp>bar
Foo<sp><sp>bar
Foo<sp><sp><sp>bar
LibreOffice does show the extra spaces:
It's really wild that there's such a difference between text layout engines. I have no idea which one is “correct”…
I've talked to our product owner, and he told me that he's fine with either way.
I've implemented one take to handle Foo bar
& Foo \nbar
differently (#131). I'm just not 100% convinced that's actually correct.
Merging it would at least make the behaviour of spaces on the right when using right alignment consistent with how spaces on the left side work when text is left aligned, wouldn't it? So I'd say it's an improvement in consistency.
Merging it would at least make the behaviour of spaces on the right when using right alignment consistent with how spaces on the left side work when text is left aligned, wouldn't it? So I'd say it's an improvement in consistency.
Yeah yours is the first opinion on this for a while. I'm leaning toward merging this too, I don't think they'll be too many drawbacks or places where people were relying on the current behaviour.
This is addressed in _glyph_brushlayout 0.2.3
.
I imagine they'll be new edge cases to handle, please raise new issues for them :)
When layouting text in right-aligned paragraphs, space characters on the right do not change the layout in any way.
It works with spaces on the left in left-aligned paragraphs.
Green text is:
Blue text is:
With
<sp>
being ASCII space (0x20).