From 89a274d9e8bcba123b769fe018ff58695705427b Mon Sep 17 00:00:00 2001 From: Tim Eves Date: Fri, 11 Mar 2016 22:49:05 +0700 Subject: Fix several miscalulations in positioning glyph to be rendered into that Atlas Change-Id: Ife4c6f9057389c0f96801a99ccc14eb14d75bdfe --- vcl/win/gdi/winlayout.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 134be9fcedeb..0881521874e7 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(); -- cgit v1.2.3