Skip to content

Glyphs not rendering at correct positions #2

Open

Description

@MrBendel

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!

Activity

  1. MrBendel commented on Mar 26, 2015

    @MrBendel
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions