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

Fix issue 351: Vertical text alignment #374

Merged
merged 1 commit into from Oct 1, 2013

Conversation

Projects
None yet
3 participants
@mmorearty
Contributor

mmorearty commented Apr 19, 2013

NIAttributedLabel.verticalTextAlignment stopped working correctly in commit c856b9b. In that commit, the code for rendering attributed labels changed dramatically.

The old code called CoreText's CTFrameDraw() to render the entire text. The new code repeatedly calls CTLineDraw() after asking for the origin position of each line of text.

But when you call CTFrameGetLineOrigins() to get the origins of the lines, it would appear that that function is not accounting for the path that was set on the frame in the earlier call to CTFramesetterCreateFrame().

My fix is to manually adjust the origin.y of each line before drawing. Numerous other places in the same file that call CTFrameGetLineOrigins(), e.g. hit detection and link rendering, already contain similar adjustments (in [linkAtPoint:], [isPoint:nearLink:], [_rectsForLink:], [drawImages], and [drawHighlightWithRect:]).

Fix issue 351: Vertical text alignment
NIAttributedLabel.verticalTextAlignment stopped working correctly in
commit c856b9b.
@mmorearty

This comment has been minimized.

Show comment
Hide comment
@mmorearty

mmorearty Apr 19, 2013

Contributor

Linking to #351 for tracking purposes

Contributor

mmorearty commented Apr 19, 2013

Linking to #351 for tracking purposes

@alexbyu

This comment has been minimized.

Show comment
Hide comment
@alexbyu

alexbyu May 2, 2013

That seem to have fixed it. Thanks!

alexbyu commented on 531c75d May 2, 2013

That seem to have fixed it. Thanks!

jverkoey added a commit that referenced this pull request Oct 1, 2013

@jverkoey jverkoey merged commit fd4d255 into jverkoey:master Oct 1, 2013

@jverkoey

This comment has been minimized.

Show comment
Hide comment
@jverkoey

jverkoey Oct 1, 2013

Owner

Thanks for the fix!

Owner

jverkoey commented Oct 1, 2013

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment