-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong wrapping with contain width and text too long #268
Comments
Just to clarify - is |
|
Yes it's expected. L2 has a wrap-word option in the advanced text renderer which will break a single too-long word, but it has a cost. |
In this case should this issue be treated as invalid or maybe we want to implement the wrap-word functionality in it's scope? |
We wouldn't want this to be a new So whatever the behavior of those two contain modes will need to remain. "width" allows for unlimited lines. "both" truncates the text so it doesn't cross the specified height on the node. |
In my opinion it is wrong to wrap with spaces but if we want we can add a separate parameter that we call wordWrap and if it is true it truncates the word and not the last space |
Hi @wouterlucas |
We should provide options instead of a We could have the dev point out what he wants explicitly. My suggestion:
Flex and wrap algo's can be detrimental to performance and hopefully |
L2 had just an extra The suggested |
Maybe let's start with word-wrap: [space|wrap] and then decide if we want to implement pretty ? |
Would be preferable to align with CSS rather than invent new names like "pretty" https://developer.mozilla.org/en-US/docs/Web/CSS/word-break |
Definitely. Also it is going to be a good reference. |
https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap#pretty 🙃 - however I agree that's more of a flex / text layout property over just word breaks. And the line between text layouting and word breaking is blurry, if we want to limit this to word break functionality only. I agree that word-break is a fine guidance. Likely limited to |
Weeeell the CSS pretty option has a fair explanation :D For now I think we can support However |
@elsassph so It's ok to keep current implementation and just change word-wrap to [normal | break]? |
I don't get to decide, I just a contributor 😅 |
Agree, exposing |
@wouterlucas I got a bit confused. Do we need both |
I was referring to these, they are available internally for Canvas: I'd expose them both, And Boolean's are fine I guess? |
Oh wait, the wordBreak isn't doing anything in https://github.com/lightning-js/renderer/blob/main/src/core/text-rendering/renderers/LightningTextTextureRenderer.ts#L74 as its always set to false and nothing seems to look at it down below. So that would need to hooked up/changed. Also having two boolean's would be confusing as what do we do if they're both Sorry for the confusion, the text rendering code is relatively new to me and the |
Yes L2 basic text texture renderer doesn't do word-break, it was only in the "advanced" renderer. |
With
contain: "width"
a long text is not wrapped correctly:this issue is for both canvas and sdf
The text was updated successfully, but these errors were encountered: