[Libreoffice-commits] core.git: Branch 'feature/commonsallayout' - vcl/unx vcl/win
Akash Jain
akash96j at gmail.com
Sat Jul 23 16:28:23 UTC 2016
Rebased ref, commits from common ancestor:
commit b550726937efb1ee3a9c22d55d5294ab8ac1d160
Author: Akash Jain <akash96j at gmail.com>
Date: Sat Jul 23 21:41:40 2016 +0530
GSoC: Add Graphite support for CommonSalLayout
Enable Graphite font rendering in CommonSalLayout through Harfbuzz
Change-Id: Ia6a00a1bb6ea1a7bd705ed91d4f4f6cb9803e062
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 10079c9..9340e02 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -504,7 +504,14 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL
if (!bDisableGraphite_ &&
GraphiteServerFontLayout::IsGraphiteEnabledFont(*mpServerFont[nFallbackLevel]))
{
- pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]);
+ if(getenv("SAL_USE_COMMON_LAYOUT"))
+ {
+ pLayout = new CommonSalLayout( *mpServerFont[ nFallbackLevel ] );
+ }
+ else
+ {
+ pLayout = new GraphiteServerFontLayout(*mpServerFont[nFallbackLevel]);
+ }
}
else
#endif
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 64540c7..ddeb7b7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -68,7 +68,7 @@ public:
virtual ~TextOutRenderer() = default;
- virtual bool operator ()(WinLayout const &rLayout, HDC hDC,
+ virtual bool operator ()(SalLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo) = 0;
};
@@ -82,7 +82,7 @@ public:
explicit ExTextOutRenderer() = default;
virtual ~ExTextOutRenderer() override = default;
- bool operator ()(WinLayout const &rLayout, HDC hDC,
+ bool operator ()(SalLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo) override;
};
@@ -106,7 +106,7 @@ public:
explicit D2DWriteTextOutRenderer();
virtual ~D2DWriteTextOutRenderer() override;
- bool operator ()(WinLayout const &rLayout, HDC hDC,
+ bool operator ()(SalLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo) override;
@@ -138,7 +138,7 @@ private:
D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete;
bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const;
- bool GetDWriteInkBox(IDWriteFontFace & rFontFace, WinLayout const &rLayout, float const lfEmHeight, Rectangle &) const;
+ bool GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLayout const &rLayout, float const lfEmHeight, Rectangle &) const;
bool DrawGlyphs(const Point & origin, uint16_t * pGid, uint16_t * pGidEnd,
float * pAdvances, Point * pOffsets) /*override*/;
@@ -3474,7 +3474,7 @@ TextOutRenderer & TextOutRenderer::get()
}
-bool ExTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
+bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo)
{
@@ -3533,7 +3533,7 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
CleanupModules();
}
-bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
+bool D2DWriteTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo)
{
@@ -3773,7 +3773,7 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p
return succeeded;
}
-bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, WinLayout const &rLayout, float const /*lfEmHeight*/, Rectangle & rOut) const
+bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLayout const &rLayout, float const /*lfEmHeight*/, Rectangle & rOut) const
{
rOut.SetEmpty();
@@ -4148,20 +4148,28 @@ void WinSalGraphics::DrawSalLayout( const GenericSalLayout& rLayout )
{
HDC hDC = getHDC();
- Point aPos;
- sal_GlyphId aGlyphId;
- int nFetchedGlyphs = 0 ;
-
- UINT oldTa = GetTextAlign( hDC );
- SetTextAlign( hDC, ( oldTa & ~TA_NOUPDATECP ) );
-
- while( rLayout.GetNextGlyphs( 1, &aGlyphId, aPos, nFetchedGlyphs ) )
+ if((std::getenv("SAL_DWRITE_COMMON_LAYOUT")))
{
- ExtTextOutW( hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, reinterpret_cast<LPCWSTR>( &aGlyphId ),
- 1, nullptr);
+ Point aPos(0, 0);
+ int nGlyphCount(0);
+ TextOutRenderer &render = TextOutRenderer::get();
+ bool result = render( rLayout, hDC, nullptr, &aPos, &nGlyphCount );
+ assert( !result );
+ }
+ else
+ {
+ Point aPos;
+ sal_GlyphId aGlyphId;
+ int nFetchedGlyphs = 0;
+ UINT oldTa = GetTextAlign( hDC );
+ SetTextAlign( hDC, ( oldTa & ~TA_NOUPDATECP ) );
+ while( rLayout.GetNextGlyphs( 1, &aGlyphId, aPos, nFetchedGlyphs ) )
+ {
+ ExtTextOutW( hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, reinterpret_cast<LPCWSTR>( &aGlyphId ),
+ 1, nullptr);
+ }
+ SetTextAlign(hDC, oldTa);
}
-
- SetTextAlign(hDC, oldTa);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list