-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
The bottom of text is cut off when it's set to size returned from "sizeToFit" or "sizeThatFitsAttributedString" #658
Comments
It is programmer error to assign to
Can you retry by assigning to |
@jhersh sorry the "-100" was my testing code and just removed from my description. :p |
Latest version without the bug is TTTAttributedLabel 1.8.1 |
I used TTTAttributedLabel font size 30 and I had same problem. Thank @Coeur, I have used version 1.8.1 and have had no problem |
Remove all setNeedDisplay. If you want update, do this manual. Fix the bug when mix Chinese and English lineheight error. Now draw line offset y as -(font.descender+line descent). It's offset from label baseline.
commit 76a68999ffa236ed10093ca7a6da10e2e8815beb Author: Mattt Thompson <m@mattt.me> Date: Tue Mar 11 04:19:24 2014 -0700 Refactoring so that default behavior sets minimum and maximum line height to font line height, to accomodate mixed Western / Asian scripts Uncommenting calls to -setNeedsDisplay commit 9f981f5 Author: qdvictory <qdvictory@gmail.com> Date: Fri Mar 7 12:04:57 2014 +0800 set: self.attributedLabel.leading = -100; self.attributedLabel.maximumLineHeight = f.lineHeight; self.attributedLabel.minimumLineHeight = f.lineHeight; commit fa1ca22 Author: qdvictory <qdvictory@gmail.com> Date: Fri Mar 7 12:04:14 2014 +0800 add test Text commit d1a3de8 Author: qdvictory <qdvictory@gmail.com> Date: Fri Mar 7 12:02:44 2014 +0800 If you want fix linespace bug when mix Chinese & English, set leading = -100 and maximumLineHeight = minimumLineHeight = font.lineHeight. Make sure TTTLabel draw after Cell draw, and make sure setNeedsDisplay every time. Such as tableview reuse. commit 6e5fc1d Author: qdvictory <qdvictory@gmail.com> Date: Fri Mar 7 11:49:21 2014 +0800 Add property minimumLineHeight and maximumLineHeight. Remove all setNeedDisplay. If you want update, do this manual. Fix the bug when mix Chinese and English lineheight error. Now draw line offset y as -(font.descender+line descent). It's offset from label baseline. commit abf95e6 Merge: 4046ef4 4626f63 Author: Mattt Thompson <m@mattt.me> Date: Fri Feb 21 15:26:08 2014 -0800 Merge pull request #324 from ScottPetit/master Updates TTTAttributedLabelVerticalAlignment to use NS_ENUM commit 4626f63 Author: Scott Petit <petit.scott@gmail.com> Date: Fri Feb 21 06:58:04 2014 +0200 - updates TTTAttributedLabelVerticalAlignment to use NS_ENUM, fixes warning when building to 64-Bit Signed-off-by: Mattt Thompson <m@mattt.me>
The string that was used to justify the commit was:
It was later removed from tests with 7905eb3 |
@KhomenokV, did you try removing or modifying guilty lines like 6e5fc1d#commitcomment-17305527 ? |
I've checked it - unfortunately this doesn't fix the issue. |
As for you it affects versions older or equal to 1.8.1, it's probably a different issue. |
Set the same font size in storyboard (or NIB) and in NSFontAttributeName of NSMutableAttributedString, depends what you use in your project. |
I found this issue in my project with auto layout (content hugging). Then I did a test here.
The code is simple:
` UIFont *font = [UIFont systemFontOfSize:51];
`
As shown in the picture, the bottom of the text is gone and the text is drawn with a strange offset (seems like descender from baseline). However, UILabel draws things well.
The text was updated successfully, but these errors were encountered: