summaryrefslogtreecommitdiffstats
path: root/drawinglayer/source/tools/wmfemfhelper.cxx
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-08-08 22:08:37 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-08-14 21:10:24 +0200
commit3901e029bd39575f700e69a73818565d62226a23 (patch)
tree2851945d9b13ac071d1e21af53288f46125dbc32 /drawinglayer/source/tools/wmfemfhelper.cxx
parentchart2: add some data table default properties (diff)
downloadcore-3901e029bd39575f700e69a73818565d62226a23.tar.gz
core-3901e029bd39575f700e69a73818565d62226a23.zip
tdf#104921: Cleanup Kashida insertion logic
Communicate Kashida insertion positions in an explicit way. Rest of LibreOffice communicate adjustments to character widths (e.g. for justification or spacing) using so-called DX array. DX array is an array of absolute character positions (e.g. DX[n] is the position after character n from the start of the lines, and its widths is DX[n] - DX[n-1]). This DX array is modified also when Kashidas are inserted after a given character for Arabic justification, by expanding its width. VCL would use this to know where to insert the Kashidas and how many ones. But because DX array is used for both widths adjustments and kashida insertion, this turns out to be a source of bugs since VCL has tosecond guess the DX array to find which is pure width adjustment and which also involves Kashida insertion, and the heuristics it uses are fragile. This change adds a second array of booleans that records where Kashida is inserted and communicates it all the way from where Kashida insertion is decoded in Writer and down to VCL layout. This change passes the Kashida array only when it seems necessary (e.g. during drawing but not when measuring text since the DX array is enough in this case). Hopefully no places where Kashida insertion needs to be passed down were missed. A couple of glyph and layout flags that were used for old heuristics and no longer needed and are removed. This also fixes: tdf#87731 tdf#106309 tdf#108604 tdf#112849 tdf#114257 tdf#127176 tdf#145647 tdf#146199 Change-Id: I4ed0850ef2fdc3e9143341afac649e7e7d463c39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138068 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'drawinglayer/source/tools/wmfemfhelper.cxx')
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index f763cd887ff7..4ec6863eecea 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1077,6 +1077,7 @@ namespace wmfemfhelper
sal_uInt16 nTextStart,
sal_uInt16 nTextLength,
std::vector< double >&& rDXArray,
+ std::vector< sal_Bool >&& rKashidaArray,
TargetHolder& rTarget,
PropertyHolder const & rProperty)
{
@@ -1161,6 +1162,7 @@ namespace wmfemfhelper
nTextStart,
nTextLength,
std::move(rDXArray),
+ std::move(rKashidaArray),
aFontAttribute,
aLocale,
aFontColor,
@@ -1189,6 +1191,7 @@ namespace wmfemfhelper
nTextStart,
nTextLength,
std::vector(rDXArray),
+ std::vector(rKashidaArray),
std::move(aFontAttribute),
std::move(aLocale),
aFontColor);
@@ -1770,6 +1773,7 @@ namespace wmfemfhelper
nTextIndex,
nTextLength,
std::move(aDXArray),
+ {},
rTargetHolders.Current(),
rPropertyHolders.Current());
}
@@ -1794,6 +1798,7 @@ namespace wmfemfhelper
// prepare DXArray (if used)
std::vector< double > aDXArray;
const std::vector<sal_Int32> & rDXArray = pA->GetDXArray();
+ std::vector< sal_Bool > aKashidaArray = pA->GetKashidaArray();
if(!rDXArray.empty())
{
@@ -1811,6 +1816,7 @@ namespace wmfemfhelper
nTextIndex,
nTextLength,
std::move(aDXArray),
+ std::move(aKashidaArray),
rTargetHolders.Current(),
rPropertyHolders.Current());
}
@@ -1874,6 +1880,7 @@ namespace wmfemfhelper
nTextIndex,
nTextLength,
std::move(aTextArray),
+ {},
rTargetHolders.Current(),
rPropertyHolders.Current());
}