Kaydet (Commit) d436065b authored tarafından Khaled Hosny's avatar Khaled Hosny Kaydeden (comit) Mike Kaganski

tdf#103725: Default to GDI even with the new layout engine

It seems that our DirectWrite integration is missing few key features,
so back to GDI so at least people who need these feature can have away
to make them work.

So the situation is now with the new layout engine is like the old one;
GDI when OpenGL is not use and DirectWrite when OpenGL is used.

Fixing DirectWrite is now someone else’s problem.

Should also fix tdf#100986.

Change-Id: I102cac8a324f77b050d5183911b5cfda0b6b8f2b
Reviewed-on: https://gerrit.libreoffice.org/30868Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 7e2ef433
...@@ -357,7 +357,7 @@ private: ...@@ -357,7 +357,7 @@ private:
// get kernign pairs of the current font // get kernign pairs of the current font
sal_uLong GetKernPairs(); sal_uLong GetKernPairs();
static void DrawTextLayout(const CommonSalLayout&, HDC); static void DrawTextLayout(const CommonSalLayout&, HDC, bool bUseDWrite);
public: public:
// public SalGraphics methods, the interface to the independent vcl part // public SalGraphics methods, the interface to the independent vcl part
......
...@@ -421,7 +421,7 @@ protected: ...@@ -421,7 +421,7 @@ protected:
TextOutRenderer & operator = (const TextOutRenderer &) = delete; TextOutRenderer & operator = (const TextOutRenderer &) = delete;
public: public:
static TextOutRenderer & get(); static TextOutRenderer & get(bool bUseDWrite);
virtual ~TextOutRenderer() = default; virtual ~TextOutRenderer() = default;
......
...@@ -1072,7 +1072,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC, ...@@ -1072,7 +1072,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
rLogFont.lfQuality = NONANTIALIASED_QUALITY; rLogFont.lfQuality = NONANTIALIASED_QUALITY;
// select vertical mode if requested and available // select vertical mode if requested and available
if (!SalLayout::UseCommonLayout() && pFont->mbVertical && nNameLen ) if ( pFont->mbVertical && nNameLen )
{ {
// vertical fonts start with an '@' // vertical fonts start with an '@'
memmove( &rLogFont.lfFaceName[1], &rLogFont.lfFaceName[0], memmove( &rLogFont.lfFaceName[1], &rLogFont.lfFaceName[0],
......
...@@ -93,7 +93,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex, ...@@ -93,7 +93,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
} }
// For now we assume DWrite is present and we won't bother with fallback paths. // For now we assume DWrite is present and we won't bother with fallback paths.
D2DWriteTextOutRenderer * pTxt = dynamic_cast<D2DWriteTextOutRenderer *>(&TextOutRenderer::get()); D2DWriteTextOutRenderer * pTxt = dynamic_cast<D2DWriteTextOutRenderer *>(&TextOutRenderer::get(true));
if (!pTxt) if (!pTxt)
return false; return false;
...@@ -3366,13 +3366,22 @@ void D2DWriteTextOutRenderer::CleanupModules() ...@@ -3366,13 +3366,22 @@ void D2DWriteTextOutRenderer::CleanupModules()
DWriteCreateFactory = nullptr; DWriteCreateFactory = nullptr;
} }
TextOutRenderer & TextOutRenderer::get() TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
{ {
static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules() if (bUseDWrite)
? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer()) {
: static_cast<TextOutRenderer*>(new ExTextOutRenderer())); static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules()
? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer())
: static_cast<TextOutRenderer*>(new ExTextOutRenderer()));
return *_impl;
}
else
{
static std::unique_ptr<TextOutRenderer> _impl(new ExTextOutRenderer());
return *_impl; return *_impl;
}
} }
...@@ -3390,6 +3399,15 @@ bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, ...@@ -3390,6 +3399,15 @@ bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
if (nGlyphs < 1) if (nGlyphs < 1)
break; break;
if (SalLayout::UseCommonLayout())
{
for (int i = 0; i < nGlyphs; i++)
{
if ((glyphIntStr[i] & GF_ROTMASK) == GF_ROTL)
glyphIntStr[i] |= GF_VERT;
}
}
std::copy_n(glyphIntStr, nGlyphs, glyphWStr); std::copy_n(glyphIntStr, nGlyphs, glyphWStr);
ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), nGlyphs, nullptr); ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), nGlyphs, nullptr);
} while (!pRectToErase); } while (!pRectToErase);
...@@ -3788,7 +3806,7 @@ bool GraphiteWinLayout::DrawTextImpl(HDC hDC, ...@@ -3788,7 +3806,7 @@ bool GraphiteWinLayout::DrawTextImpl(HDC hDC,
maImpl.DrawBase() = WinLayout::maDrawBase; maImpl.DrawBase() = WinLayout::maDrawBase;
maImpl.DrawOffset() = WinLayout::maDrawOffset; maImpl.DrawOffset() = WinLayout::maDrawOffset;
TextOutRenderer & render = TextOutRenderer::get(); TextOutRenderer & render = TextOutRenderer::get(true);
bool const ok = render(*this, hDC, pRectToErase, pPos, pGetNextGlypInfo); bool const ok = render(*this, hDC, pRectToErase, pPos, pGetNextGlypInfo);
if( hOrigFont ) if( hOrigFont )
DeleteFont(SelectFont(hDC, hOrigFont)); DeleteFont(SelectFont(hDC, hOrigFont));
...@@ -4035,11 +4053,11 @@ LogicalFontInstance* WinFontFace::CreateFontInstance( FontSelectPattern& rFSD ) ...@@ -4035,11 +4053,11 @@ LogicalFontInstance* WinFontFace::CreateFontInstance( FontSelectPattern& rFSD )
return pFontInstance; return pFontInstance;
} }
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC) void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, bool bUseDWrite)
{ {
Point aPos(0, 0); Point aPos(0, 0);
int nGlyphCount(0); int nGlyphCount(0);
TextOutRenderer &render = TextOutRenderer::get(); TextOutRenderer &render = TextOutRenderer::get(bUseDWrite);
bool result = render(rLayout, hDC, nullptr, &aPos, &nGlyphCount); bool result = render(rLayout, hDC, nullptr, &aPos, &nGlyphCount);
assert(!result); assert(!result);
} }
...@@ -4051,7 +4069,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout) ...@@ -4051,7 +4069,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
if (!bUseOpenGL) if (!bUseOpenGL)
{ {
// no OpenGL, just classic rendering // no OpenGL, just classic rendering
DrawTextLayout(rLayout, hDC); DrawTextLayout(rLayout, hDC, false);
} }
else else
{ {
...@@ -4115,7 +4133,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout) ...@@ -4115,7 +4133,7 @@ void WinSalGraphics::DrawSalLayout(const CommonSalLayout& rLayout)
SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color)); SalColor salColor = MAKE_SALCOLOR(GetRValue(color), GetGValue(color), GetBValue(color));
// the actual drawing // the actual drawing
DrawTextLayout(rLayout, aDC.getCompatibleHDC()); DrawTextLayout(rLayout, aDC.getCompatibleHDC(), true);
std::unique_ptr<OpenGLTexture> xTexture(aDC.getTexture()); std::unique_ptr<OpenGLTexture> xTexture(aDC.getTexture());
if (xTexture) if (xTexture)
......
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