jverkoey/nimbus — pull request #374 by mmorearty (2013-04-19 01:13:31+00:00)
Title: Fix issue 351: Vertical text alignment

`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:]`).