Skip to content
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

Glyphs not rendering at correct positions #2

Open
MrBendel opened this issue Mar 26, 2015 · 1 comment
Open

Glyphs not rendering at correct positions #2

MrBendel opened this issue Mar 26, 2015 · 1 comment

Comments

@MrBendel
Copy link

Hey,

Love this project! Been using code abstracted from it for my own project but I noticed a few things while working on it. For one, the glyphs don't render properly. If you call [super setAttributedText:attributedText]; when setting the attributed text you can see how off it is. Also multi-line text doesn't render. I'm investigating but it looks like you need CGRect lineFragmentRect = [self.layoutManager lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:nil]; to get the correct y-position of the line fragment. I'll post any updates I make that seem to help resolve the issue.

many thanks!

@MrBendel
Copy link
Author

Scratch previous suggestion, looks like it can be simplified:

CGFloat centerY = CGRectGetHeight(self.bounds) * 0.5 - CGRectGetHeight(layoutRect) * 0.5; glyphRect.origin.y += centerY;

Not sure what CGPoint location = [self.layoutManager locationForGlyphAtIndex:glyphIndex]; is returning, but it seems to throw things off vertically. Also, adjusting the line height multiplier on the attributes causes all sorts of rendering issues.

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

No branches or pull requests

1 participant