[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/win

Miklos Vajna vmiklos at collabora.co.uk
Tue Sep 1 08:21:11 PDT 2015


 vcl/win/source/gdi/winlayout.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7abc8172faa888ce8da22ddd0e4b33a60f23de75
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Sep 1 16:09:38 2015 +0200

    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
    (cherry picked from commit b1a918ae8aca9e9a1eaebecef3b82e011b10665f)
    Reviewed-on: https://gerrit.libreoffice.org/18244
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 24463a2..c5f7e65 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);
             }


More information about the Libreoffice-commits mailing list