-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[ASTextNode] Incorrect maximum number of lines with line spacing #227
Comments
Very interesting - excellent clarifying articulation of all of the factors and other references to this! By some coincidence, just today this became an issue for one of our internal product teams and I debugged it to the same conclusion. The workaround should be suitable - I wonder if we can apply this automatically for users who do set both the lineSpacing and maxNumberOfLines, until there is a better fix? |
@maicki Shouldn't we set this lineBreakMode to Tail by default, since it is overridden by the attributed string anyway? I think this sounds right, because it is the default mode for TextKit internally / NSAttributedString, so it would be like our local property matching that default?
|
@appleguy Yep that makes sense and I think I would be in favor of it. Not only TextKit also UILabel's |
Interesting consideration. To make the call, I suppose we'd want to think about:
We should definitely be careful with such a change, and I completely support your decision on this. Here's my thinking:
So, one possibility would be to make a change in the next 2.x update with it called out prominently at the top of the release notes. Developers who have a genuine problem caused by it could delay their update while investigating, while we can then be confident that some set of other developers will save time. Another option: we could add a prominent comment to the header file above lineSpacing or near the Truncation pragma mark, referencing the documentation on this issue. Your call - if there's anything I can do to help, just let me know! |
I'm not certain if this is the same bug, but I am attempting to upgrade an app from ASDK 2.2.1 to texture 2.3.1 and have about 100 snapshot tests failing where it appears the difference is the line heights of |
ASTextNode
uses Text Kit internally to calculate the amount to shrink needed to result in the specified maximum number of lines. Unfortunately, in certain cases using a custom value forlineSpacing
andmaximumNumberOfLines
withASTextNode
can result in the wrong number of lines.Reproduction Case:
--> At last we would get a wrong number of lines.
We have a specific section with a workaround now in the
ASTextNode
docs:Incorrect maximum number of lines with line spacing
Although there exists a workaround we should still investigate to get a full picture what is going on behind the scenes.
This issue replaces (and all coming in in the future around this topic):
The text was updated successfully, but these errors were encountered: