diff options
author | Khaled Hosny <khaled@aliftype.com> | 2022-10-02 22:45:24 +0200 |
---|---|---|
committer | خالد حسني <khaled@aliftype.com> | 2022-10-03 01:39:56 +0200 |
commit | 9063d99ff5ee43cc1239fc1dbb5d9897bdda1c9b (patch) | |
tree | 634bdd586b6125942f56979c65fb692bbe64a264 | |
parent | tdf#148240 Drop IsExperimental from Outline folding UNOs (diff) | |
download | core-9063d99ff5ee43cc1239fc1dbb5d9897bdda1c9b.tar.gz core-9063d99ff5ee43cc1239fc1dbb5d9897bdda1c9b.zip |
tdf#137528: Fix skipping Kashida in fonts with bogus ones
There was a typo in the check, and we also want to fallback to using
blanks if no Kashidas were found, so check for Kashida positions first.
Change-Id: I64cc3bf5c76ecc01764073bb5a2302520157fad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140896
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index cf30aada8448..6efc74d95cfe 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2190,14 +2190,19 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, // Search blanks or Kashidas... std::vector<sal_Int32> aPositions; + + // Kashidas ? + ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions ); + auto nKashidas = aPositions.size(); + sal_uInt16 nLastScript = i18n::ScriptType::LATIN; for ( sal_Int32 nChar = nFirstChar; nChar <= nLastChar; nChar++ ) { EditPaM aPaM( pNode, nChar+1 ); LanguageType eLang = GetLanguage(aPaM).nLang; sal_uInt16 nScript = GetI18NScriptType(aPaM); - if ( MsLangId::getPrimaryLanguage( eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY ) - // Arabic script is handled later. + // Arabic script is handled above, but if no Kashida positions are found, use blanks. + if (MsLangId::getPrimaryLanguage(eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY && nKashidas) continue; if ( pNode->GetChar(nChar) == ' ' ) @@ -2223,13 +2228,6 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, nLastScript = nScript; } - // Save the number of blanks, we will use it below when marking Kashida - // positions. - auto nBlankSize = aPositions.size(); - - // Kashidas ? - ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions ); - if ( aPositions.empty() ) return; @@ -2268,10 +2266,10 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, // Mark Kashida positions, so that VCL knows where to insert Kashida and // where to only expand the width. - if (aPositions.size() > nBlankSize) + if (nKashidas) { pLine->GetKashidaArray().resize(pLine->GetCharPosArray().size(), false); - for (auto i = nBlankSize; i < aPositions.size(); i++) + for (size_t i = 0; i < nKashidas; i++) { auto nChar = aPositions[i]; if ( nChar < nLastChar ) @@ -2316,7 +2314,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector<sal_Int32>& rArray ) { // Kashida glyph looks suspicious, skip Kashida justification - if (GetRefDevice()->GetMinKashida() < 0) + if (GetRefDevice()->GetMinKashida() <= 0) return; std::vector<sal_Int32> aKashidaArray; |