I am trying to vertically align text, but its definitely off. When I look at your textDimensions method I am a little confused on exactly what this calculation does:
$lineHeight = ( $this->font->ascent + $this->font->descent ) * $fontSize * 2;
Is this really getting the line height of the text? The ascent usually comes in as a positive number, and the descent a negative number. 1 + -1 = 0, how is this measuring distance? Could this be related to to the vertical centering issue?
I am trying to vertically align text, but its definitely off. When I look at your textDimensions method I am a little confused on exactly what this calculation does:
Is this really getting the line height of the text? The ascent usually comes in as a positive number, and the descent a negative number. 1 + -1 = 0, how is this measuring distance? Could this be related to to the vertical centering issue?