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 SalLayout::CreateTextLayoutCache( OUString const&) const {