summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-01 16:09:38 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-01 16:10:25 +0200
commitb1a918ae8aca9e9a1eaebecef3b82e011b10665f (patch)
tree8b6bbe93446d025fdf049992b9594844e1b6739b
parent6a12aecf6f7791f00894b08bb394ee0139e10d6f (diff)
tdf#93838 windows opengl: fix vertical text position in UniscribeLayout
For one, aPos.Y() is meant to be the baseline position of the text. Based on the MSDN documentation and <https://www-user.tu-chemnitz.de/~ygu/petzold/ch05c.htm>, that means if we want to get top position, we have to only extract tmAscent and not tmInternalLeading. For another, ImplWinFontEntry::AddChunkOfGlyphs() adds a border of 2 pixels both horizontally and vertically, which means that then we need to undo that when counting the vertical position, too. Change-Id: I4ac8e881ea5910662674c2a1b53ece943487ccd9
-rw-r--r--vcl/win/source/gdi/winlayout.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 18ca7ecba253..f7bc83b051cc 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -65,7 +65,7 @@ struct OpenGLGlyphCacheChunk
int mnGlyphCount;
std::vector<Rectangle> maLocation;
std::shared_ptr<OpenGLTexture> mpTexture;
- int mnAscentPlusIntLeading;
+ int mnAscent;
bool mbVertical;
};
@@ -303,7 +303,7 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
DeleteDC(hDC);
return false;
}
- aChunk.mnAscentPlusIntLeading = aTextMetric.tmAscent + aTextMetric.tmInternalLeading;
+ aChunk.mnAscent = aTextMetric.tmAscent;
LOGFONTW aLogfont;
if (!GetObjectW(rLayout.mhFont, sizeof(aLogfont), &aLogfont))
@@ -1755,7 +1755,7 @@ bool UniscribeLayout::DrawCachedGlyphs(SalGraphics& rGraphics) const
{
SalTwoRect a2Rects(rChunk.maLocation[n].Left(), rChunk.maLocation[n].Top(),
rChunk.maLocation[n].getWidth(), rChunk.maLocation[n].getHeight(),
- nAdvance + aPos.X() + mpGlyphOffsets[i].du - 2, aPos.Y() + mpGlyphOffsets[i].dv - rChunk.mnAscentPlusIntLeading,
+ nAdvance + aPos.X() + mpGlyphOffsets[i].du - 2, aPos.Y() + mpGlyphOffsets[i].dv - rChunk.mnAscent - 2,
rChunk.maLocation[n].getWidth(), rChunk.maLocation[n].getHeight()); // ???
pImpl->DrawMask(*rChunk.mpTexture, salColor, a2Rects);
}