Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

samhsiung
Copy link
Contributor

Fixes #930

ASTextNode uses ASTextKitTailTruncater to calculate the size of the rendered truncated text by replacing the last line with the _composedTruncationString if the text is long enough to truncate.

However _composedTruncationString doesn't have attributes from _attributedString at the time of size calculation so attributes such as NSParagraphStyle were being omitted resulting in an incorrect size.

We fix this by syncing attributes of _composedTruncationString with _attributedString whenever _attributedString is updated in ASTextNode.

We also updated ASTextNodeTests to test for different line spacing applied throughout text.

@appleguy
Copy link
Contributor

@samhsiung thank you for the clear, specific description. It was very important for me to understand this diff. I also particularly appreciate you adding the test.

The attention to detail in our text rendering system is very valuable, and is an expertise that a fairly small subset of engineers have. I'm starting to look at this code more closely myself, due mainly to your lead, and am finding some sweet optimizations - one will go up soon.

appleguy added a commit that referenced this pull request Dec 18, 2015
Fix ASTextNode truncated size calculation ignoring attributes in the last line, by syncing the truncationString's attributes with the primary attributedString.
@appleguy appleguy merged commit d56a53d into facebookarchive:master Dec 18, 2015
@appleguy appleguy added the Bug label Dec 18, 2015
@appleguy appleguy added this to the 1.9.4 milestone Dec 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(ASDK 1.9.3) ASTextNode truncates on first line instead of second line for single words that are long enough

3 participants