[Libreoffice-commits] core.git: Branch 'feature/fixes7' - vcl/win

Tor Lillqvist tml at collabora.com
Tue Aug 18 03:45:30 PDT 2015


 vcl/win/source/gdi/winlayout.cxx |   41 +++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

New commits:
commit 35f9d5f84c7d1a5058a7908bc68a6f127471e82d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Aug 18 13:43:27 2015 +0300

    More hacking on OpenGL glyph caching on Windows
    
    Now text looks better, for instance the lower-case "t" glyphs on the
    Start Centre aren't totally weird any more. But for instance the tip
    of the hook of "j" leaks into the "i" texture. I guess I really would
    need to render glyphs one by one.
    
    Change-Id: I69ae2d2f7c559530bcfdfc1a4915503fcb3ab4af

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index e32b8b5..0ab9cd9 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -204,7 +204,7 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
     if (nGlyphIndex == DROPPED_OUTGLYPH)
         return true;
 
-    SAL_INFO("vcl.gdi.opengl", "AddChunkOfGlyphs " << this << " " << nGlyphIndex << " old: " << maOpenGLGlyphCache);
+    SAL_INFO("vcl.gdi.opengl", "this=" << this << " " << nGlyphIndex << " old: " << maOpenGLGlyphCache);
 
     auto n = maOpenGLGlyphCache.begin();
     while (n != maOpenGLGlyphCache.end() &&
@@ -262,12 +262,32 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
         return false;
     }
 
+    std::vector<ABC> aABC(nCount);
+    if (!GetCharABCWidthsI(hDC, 0, nCount, aGlyphIndices.data(), aABC.data()))
+    {
+        SAL_WARN("vcl.gdi", "GetCharABCWidthsI failed: " << WindowsErrorString(GetLastError()));
+        return false;
+    }
+
+    for (int i = 0; i < nCount; i++)
+        std::cerr << aABC[i].abcA << ":" << aABC[i].abcB << ":" << aABC[i].abcC << " ";
+    std::cerr << std::endl;
+
+    // Avoid kerning as we want to be able to use individual rectangles for each glyph
+    std::vector<int> aDX(nCount);
+    int totWidth = 0;
+    for (int i = 0; i < nCount; i++)
+    {
+        aDX[i] = std::abs(aABC[i].abcA) + aABC[i].abcB + std::abs(aABC[i].abcC);
+        totWidth += aDX[i];
+    }
+
     if (SelectObject(hDC, hOrigFont) == NULL)
         SAL_WARN("vcl.gdi", "SelectObject failed: " << WindowsErrorString(GetLastError()));
     if (!DeleteDC(hDC))
         SAL_WARN("vcl.gdi", "DeleteDC failed: " << WindowsErrorString(GetLastError()));
 
-    OpenGLCompatibleDC aDC(rGraphics, 0, 0, aSize.cx, aSize.cy);
+    OpenGLCompatibleDC aDC(rGraphics, 0, 0, totWidth, aSize.cy);
 
     hOrigFont = SelectFont(aDC.getCompatibleHDC(), rLayout.mhFont);
     if (hOrigFont == NULL)
@@ -279,21 +299,6 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
     SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
     SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
 
-    std::vector<ABC> aABC(nCount);
-    if (!GetCharABCWidthsI(aDC.getCompatibleHDC(), 0, nCount, aGlyphIndices.data(), aABC.data()))
-    {
-        SAL_WARN("vcl.gdi", "GetCharABCWidthsI failed: " << WindowsErrorString(GetLastError()));
-        return false;
-    }
-
-    for (int i = 0; i < nCount; i++)
-        std::cerr << aABC[i].abcA << ":" << aABC[i].abcB << ":" << aABC[i].abcC << " ";
-    std::cerr << std::endl;
-
-    // Avoid kerning as we want to be able to use individual rectangles for each glyph
-    std::vector<int> aDX(nCount);
-    for (int i = 0; i < nCount; i++)
-        aDX[i] = std::abs(aABC[i].abcA) + aABC[i].abcB + std::abs(aABC[i].abcC);
     if (!ExtTextOutW(aDC.getCompatibleHDC(), 0, 0, ETO_GLYPH_INDEX, NULL, aGlyphIndices.data(), nCount, aDX.data()))
     {
         SAL_WARN("vcl.gdi", "ExtTextOutW failed: " << WindowsErrorString(GetLastError()));
@@ -317,7 +322,7 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
 
     SelectFont(aDC.getCompatibleHDC(), hOrigFont);
 
-    SAL_INFO("vcl.gdi.opengl", "AddChunkOfGlyphs " << this << " now: " << maOpenGLGlyphCache << DumpGlyphBitmap(aChunk, aDC.getCompatibleHDC()));
+    SAL_INFO("vcl.gdi.opengl", "this=" << this << " now: " << maOpenGLGlyphCache << DumpGlyphBitmap(aChunk, aDC.getCompatibleHDC()));
 
     return true;
 }


More information about the Libreoffice-commits mailing list