summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-05 05:19:31 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-11-05 05:23:32 +0200
commitd9ea614a1e7c29bb6831822dc6fc29657d40bdd9 (patch)
treee54c63cbeaf2d6d192e835ace63431c4ceadd840
parenttdf#102008 Drop whitespace between "fact" and brace (diff)
downloadcore-d9ea614a1e7c29bb6831822dc6fc29657d40bdd9.tar.gz
core-d9ea614a1e7c29bb6831822dc6fc29657d40bdd9.zip
Validate Kashida positions with font fallback
MultiSalLayout did not implement IsKashidaPosValid() which meant that whenever there is a font fallback no Kashida validation was performed. Change-Id: I30e498c356c49b0c06dd6b45187105f6bd758a24
-rw-r--r--vcl/inc/sallayout.hxx1
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx5
-rw-r--r--vcl/source/gdi/sallayout.cxx23
3 files changed, 29 insertions, 0 deletions
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 364bd488a97f..2a76e11e5537 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -243,6 +243,7 @@ public:
int&, DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr,
const PhysicalFontFace** pFallbackFonts = nullptr ) const override;
virtual bool GetOutline( SalGraphics&, basegfx::B2DPolyPolygonVector& ) const override;
+ virtual bool IsKashidaPosValid(int nCharPos) const override;
// used only by OutputDevice::ImplLayout, TODO: make friend
explicit MultiSalLayout( SalLayout& rBaseLayout );
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index cb82bfa4d114..e7ed5491ef75 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -751,6 +751,11 @@ bool CommonSalLayout::IsKashidaPosValid(int nCharPos) const
{
if (pIter->mnCharPos == nCharPos)
{
+ // If the character was not supported by this layout, return false
+ // so that fallback layouts would be checked for it.
+ if (pIter->maGlyphId == 0)
+ break;
+
// Search backwards for previous glyph belonging to a different
// character. We are looking backwards because we are dealing with
// RTL glyphs, which will be in visual order.
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ef9bbc01b7f8..0034bca78b7a 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -2027,6 +2027,29 @@ bool MultiSalLayout::GetOutline( SalGraphics& rGraphics,
return bRet;
}
+bool MultiSalLayout::IsKashidaPosValid(int nCharPos) const
+{
+ // Check the base layout
+ bool bValid = mpLayouts[0]->IsKashidaPosValid(nCharPos);
+
+ // If base layout returned false, it might be because the character was not
+ // supported there, so we check fallback layouts.
+ if (!bValid)
+ {
+ for (int i = 1; i < mnLevel; ++i)
+ {
+ // - 1 because there is no fallback run for the base layout, IIUC.
+ if (maFallbackRuns[i - 1].PosIsInAnyRun(nCharPos))
+ {
+ bValid = mpLayouts[i]->IsKashidaPosValid(nCharPos);
+ break;
+ }
+ }
+ }
+
+ return bValid;
+}
+
std::shared_ptr<vcl::TextLayoutCache> SalLayout::CreateTextLayoutCache(
OUString const&) const
{