Skip to content

Commit

Permalink
fixed text inline box y position drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhick committed May 18, 2013
1 parent c2d5644 commit a41404c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cocktail/core/graphics/TextDrawer.hx
Expand Up @@ -83,6 +83,9 @@ class TextDrawer
_destPoint.x = inlineBox.bounds.x + elementRenderer.globalBounds.x - scrollOffset.x;
_destPoint.y = inlineBox.bounds.y + elementRenderer.globalBounds.y - scrollOffset.y;

//add the text inline box own leaded ascent and remove the ascent of the text
_destPoint.y += inlineBox.leadedAscent - elementRenderer.coreStyle.fontMetrics.ascent;

//TODO 2 : should not happen, seems to happen for spaces
//on empty lines
if (inlineBox.lineBox != null)
Expand Down Expand Up @@ -130,7 +133,7 @@ class TextDrawer
_decorationRect.width = _renderRect.width;
_decorationRect.height = TEXT_DECORATION_THICKNESS;
_decorationRect.x = _destPoint.x;
_decorationRect.y = _destPoint.y + elementRenderer.getLeadedAscent() - elementRenderer.getLeadedDescent();
_decorationRect.y = _destPoint.y + elementRenderer.coreStyle.fontMetrics.ascent / 2;

graphicsContext.nativeLayer.graphics.fillRect(_decorationRect, elementRenderer.coreStyle.usedValues.color, clipRect);
}
Expand Down

0 comments on commit a41404c

Please sign in to comment.