Kaydet (Commit) 9b150bf4 authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Andras Timar

More fixing of 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
Signed-off-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 17984437
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment