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

ASTextNode misaligned when screen scale is 3.0 #219

Closed
Jercik opened this issue Jan 14, 2015 · 2 comments · Fixed by #221
Closed

ASTextNode misaligned when screen scale is 3.0 #219

Jercik opened this issue Jan 14, 2015 · 2 comments · Fixed by #221
Labels

Comments

@Jercik
Copy link
Contributor

Jercik commented Jan 14, 2015

I've found bug in ASTextNode when running on iPhone 6 Plus simulator. For some strings calculatedSize is slightly too large, which causes view to stretch. This results in blurry text and (probably) performance decrease.

Here is example project which demonstrates issue: https://github.com/Jercik/ASTextStretch. After enabling "Color Misaligned Images" you can see that first text node is stretched:

iphone6plus
calculatedSize returned by first node is: {286.33334350585938, 45.666667938232422}.
Second node's size was set manually to correct value which is: {286.33333333333331, 45.666666666666664}.

@ocrickard
Copy link
Contributor

Nice find! My guess is that we're getting some float math error here: https://github.com/facebook/AsyncDisplayKit/blob/master/AsyncDisplayKit/ASTextNode.mm#L68. Most likely we need a more accurate way of computing the pixel values.

*edit: added a word I missed.

@Jercik
Copy link
Contributor Author

Jercik commented Jan 14, 2015

I've found the issue. There is fminf() function used which causes double > float > double conversion (on 64 bit architecture) here: https://github.com/facebook/AsyncDisplayKit/blob/6d8d7aeece5edc0ebb67a35ecfb3d3cfebdc5a93/AsyncDisplayKit/ASTextNode.mm#L199

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

Successfully merging a pull request may close this issue.

3 participants