Skip to content
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

Wrapping highlight bug #3

Open
Bodysoulspirit opened this issue Jul 4, 2017 · 8 comments
Open

Wrapping highlight bug #3

Bodysoulspirit opened this issue Jul 4, 2017 · 8 comments
Assignees

Comments

@Bodysoulspirit
Copy link

Bodysoulspirit commented Jul 4, 2017

See attached file ans screenshot. The highlight shape wraps itself to a next line.

highlithwrapbug

HighlightWrapBug.zip

@Bodysoulspirit Bodysoulspirit changed the title Wrapped text bug Wrapping highlight bug Jul 4, 2017
@Bodysoulspirit
Copy link
Author

Really missing this in Sketch ;(

@matt-curtis matt-curtis self-assigned this Jan 2, 2018
@matt-curtis matt-curtis added the bug label Jan 2, 2018
@matt-curtis
Copy link
Owner

Does it still behave this exact way in the current version of Sketch?

@Bodysoulspirit
Copy link
Author

Bodysoulspirit commented Jan 3, 2018

Unfortunately yes, just checked (font is Avenir for example) :

sketch 48 2

@matt-curtis
Copy link
Owner

matt-curtis commented Jan 3, 2018

So... I've looked into this, and I'm mostly just confused. The APIs to get line rectangle information reports that the second line in your example is 'Sketc' instead of 'Sketch' which throws things off. I was thinking that this might have something to do with maybe me giving the incorrect text container width when asking for the lines (the APIs return the line geometry based on the text container width passed in) causing the text to wrap earlier, but I checked and Sketch gives the same width (the width of the text layer) so I'm kind of puzzled. I was going to try adding a pixel or two to the width to fix this, but it's imprecise and might not work for all the cases where this happens... outside of that, I'm not really sure how to fix this.

@Bodysoulspirit
Copy link
Author

Bodysoulspirit commented Jan 6, 2018

Thanks @matt-curtis for looking into it !
I tried to isolate a pattern and it seems it is somehow related to the fixed/auto text container modes.

• Text containers in fixed mode seem to work pretty well if I'm right.

• Auto mode containers not. Nor when the text is initially typed in auto mode (you cannot really create a text container in auto mode if I'm right, it starts in fixed mode that you can set to auto before typing), nor when changing it from fixed to auto. As soon as you convert to auto it cuts some words or parts, as you said, putting the "h" and the next line for example.
In some cases converting the fixed container text to auto and break the line manually works, but mostly not (as soon as you modify the text or size it breaks, perhaps it works as long as the new auto width container is the same or less as the fixed one).

So the only way I can somehow use it with auto mode typing is to type my text in auto mode, break my lines manually like I want, then convert the container to fixed, but I HAVE TO CHANGE THE FIXED CONTAINER MANUALLY FIRST before hitting the plugin, otherwise it does not work ...
Simply putting it in auto mode does not work.

Joining the sketch test file

Thanks

mode changes tests

Mode + Changes Tests.zip

@matt-curtis
Copy link
Owner

First off - that's some fantastic detective work you did, thanks!

What I find interesting is that in your tests, highlight works properly in Fixed mode. In my own texts, highlighting doesn't work properly in either mode, both have the same issue.

@Bodysoulspirit
Copy link
Author

No highlight at all in Sketch 50.2 :( Crycrycy ;)

@matt-curtis
Copy link
Owner

You may want to give the version I built using the new JS API a try. No guarantees it'll work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants