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

[ASTextNode2] Add improved support for all line-break modes in experimental text node. #1150

Merged
merged 3 commits into from
Oct 17, 2018

Conversation

wiseoldduck
Copy link
Member

ASTextNode2 was only setting truncationMode (lineBreakMode) on existing paragraph styles in attributedString (thus having no effect for the two non-truncating modes if there were not any existing paragraph style runs).

ASTextLayout (essentially YYTextLayout) was not rendering the two non-tail truncation lineBreakModes correctly. There's not much history on github but it appears to me that it was set up correctly at one time and then some additional code was added for unclear reasons that assumed any truncation was at the end of the string.

This commit corrects both issues.

ASTextNode2 was only setting truncationMode (lineBreakMode) on existing paragraph styles in attributedString (thus having no effect for the two non-truncating modes if there were not any existing paragraph style runs).

ASTextLayout (essentially YYTextLayout) was not rendering the two non-tail truncation lineBreakModes correctly. There's not much history on github but it appears to me that it was set up correctly at one time and then some additional code was added for unclear reasons that assumed any truncation was at the end of the string.

This commit corrects both issues.
@wiseoldduck wiseoldduck changed the title ASTextNode2 rendering corrections. [ASTextNode2] Add improved support for all line-break modes in experimental text node. Sep 29, 2018
Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty complicated stuff! I went line-by-line and if I squint it all makes sense. I thought our text node tests were all being run against text node 2 thanks to @wsdwsd0829 's change a while back. Can we easily cover these truncation modes?

@wiseoldduck
Copy link
Member Author

wiseoldduck commented Oct 17, 2018 via email

@wiseoldduck
Copy link
Member Author

wiseoldduck commented Oct 17, 2018 via email

@wiseoldduck
Copy link
Member Author

Before:

simulator screen shot - iphone x - 2018-10-17 at 10 30 18

After:

simulator screen shot - iphone x - 2018-10-17 at 10 40 28

@wiseoldduck
Copy link
Member Author

Before:

simulator screen shot - iphone x - 2018-10-17 at 10 30 20

After:

simulator screen shot - iphone x - 2018-10-17 at 10 40 29

@wiseoldduck
Copy link
Member Author

Before:

simulator screen shot - iphone x - 2018-10-17 at 10 30 21

After:

simulator screen shot - iphone x - 2018-10-17 at 10 40 30

@wiseoldduck
Copy link
Member Author

Before:

simulator screen shot - iphone x - 2018-10-17 at 10 30 26

After:

simulator screen shot - iphone x - 2018-10-17 at 10 40 33

@wiseoldduck
Copy link
Member Author

Before:

simulator screen shot - iphone x - 2018-10-17 at 10 30 28

After:

simulator screen shot - iphone x - 2018-10-17 at 10 40 35

@wiseoldduck
Copy link
Member Author

etc. 😄

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty fly

@Adlai-Holler Adlai-Holler merged commit bfb2298 into TextureGroup:master Oct 17, 2018
@wiseoldduck
Copy link
Member Author

oops I might have buried the lead with all my screenshots

Also my merge with master yesterday was kind of back-of-the-envelope, I mostly pushed it in case I wanted to work on it from a different machine. So I would discourage merging this until I get to audit that more carefully... which adding those tests should give me a chance to do!

But umm I'm sure it's fine! I'll put the tests into another PR 😁

mikezucc pushed a commit to mikezucc/Texture that referenced this pull request Nov 7, 2018
…mental text node. (TextureGroup#1150)

* ASTextNode2 rendering corrections.

ASTextNode2 was only setting truncationMode (lineBreakMode) on existing paragraph styles in attributedString (thus having no effect for the two non-truncating modes if there were not any existing paragraph style runs).

ASTextLayout (essentially YYTextLayout) was not rendering the two non-tail truncation lineBreakModes correctly. There's not much history on github but it appears to me that it was set up correctly at one time and then some additional code was added for unclear reasons that assumed any truncation was at the end of the string.

This commit corrects both issues.

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

Successfully merging this pull request may close these issues.

2 participants