-
Notifications
You must be signed in to change notification settings - Fork 74
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
font is not considered (added also solution in comments) #10
Comments
Hi, thanks for the contribution. However, isn't the font attribute included in the attributes of attributedText? An attributed string could have different fonts for different parts of texts, I'm afraid is not appropriate to set one single font for the full range. |
Hi again.
This is initialization of my label attributed string. As you see i do not provide any font for attributed text. I am not sure how current solution will behave when attributed text will have font attributes for different parts. But at the same time without this line of code calculations are wrong when no font attributes provided.
Conclusion
|
Custom font is not working properly: with custom font its working for few font sizes . |
Hi.
Currently the font of label is not considered.
Instead of this
//textStorage to calculate the position
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:self.attributedText];
[textStorage addLayoutManager:layoutManager];
should be this
//textStorage to calculate the position
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:self.attributedText];
[textStorage addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0, self.text.length)];
[textStorage addLayoutManager:layoutManager];
The text was updated successfully, but these errors were encountered: