[Libreoffice-commits] core.git: Branch 'private/tml/fixwintext' - vcl/win

Tim Eves tim_eves at sil.org
Fri Mar 11 16:31:49 UTC 2016


 vcl/win/gdi/winlayout.cxx |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 89a274d9e8bcba123b769fe018ff58695705427b
Author: Tim Eves <tim_eves at sil.org>
Date:   Fri Mar 11 22:49:05 2016 +0700

    Fix several miscalulations in positioning glyph to be rendered into that Atlas
    
    Change-Id: Ife4c6f9057389c0f96801a99ccc14eb14d75bdfe

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 134be9f..0881521 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -497,7 +497,7 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex,
         nBitmapHeight = bounds.GetHeight() + aChunk.getExtraSpace();
 
     aChunk.maLocation.resize(nCount);
-    UINT nPos = 0;
+    UINT nPos = aChunk.getExtraOffset();
     for (int i = 0; i < nCount; i++)
     {
         // FIXME: really I don't get why 'vertical' makes any difference [!] what does it mean !?
@@ -528,14 +528,9 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex,
     aDC.fill(MAKE_SALCOLOR(0xff, 0xff, 0xff));
 
     int nY = aChunk.getExtraOffset();
-    int nX = nY;
-    if (aChunk.mbVertical)
-        nX += aGlyphAdv[0];
-    else
-        nX -= bounds.Left();
+    int nX = aChunk.getExtraOffset();
 
-    bounds.Move(-bounds.Left(), -bounds.Top());
-    pTxt->BindDC(aDC.getCompatibleHDC(), bounds);
+    pTxt->BindDC(aDC.getCompatibleHDC(), Rectangle(0, 0, nBitmapWidth, nBitmapHeight));
     auto pRT = pTxt->GetRenderTarget();
 
     ID2D1SolidColorBrush* pBrush = nullptr;
@@ -545,7 +540,7 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex,
         return false;
     }
 
-    D2D1_POINT_2F baseline = { 0.0f, bounds.Bottom() - nY };
+    D2D1_POINT_2F baseline = { nX, nY + aChunk.mnAscent - bounds.Top() };
     DWRITE_GLYPH_RUN glyphs = {
         pTxt->GetFontFace(),
         pTxt->GetEmHeight(),
@@ -557,7 +552,6 @@ bool WinFontInstance::AddChunkOfGlyphs(bool bRealGlyphIndices, int nGlyphIndex,
         0
     };
 
-
     pRT->BeginDraw();
     pRT->DrawGlyphRun(baseline, &glyphs, pBrush);
     HRESULT hr = pRT->EndDraw();


More information about the Libreoffice-commits mailing list