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
This commit is contained in:
Khaled Hosny
2016-11-05 05:19:31 +02:00
parent 6984fd5a75
commit d9ea614a1e
3 changed files with 29 additions and 0 deletions

View File

@@ -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 );

View File

@@ -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.

View File

@@ -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
{