summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-11-29 20:31:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-02 15:20:07 +0000
commitf9395a123e8c85134bdd6e471bc93b2745e22a9d (patch)
treefd64e75a7ea36f28e9b993ae0c00480c480803df /vcl
parent1e222575a3b637398b5b2d8e3172f12538ff34e3 (diff)
tdf#152094 retain more accuracy from RefDevMode::MSO1
do it like this to avoid adding another mapmode and to keep things "the same" as much as possible Change-Id: I1965aa545646f2d27b950d6335b2f608c3e4e04b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143475 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/pdf/pdfwriter_impl.hxx2
-rw-r--r--vcl/qa/cppunit/complextext.cxx52
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx2
-rw-r--r--vcl/source/control/calendar.cxx3
-rw-r--r--vcl/source/filter/eps/eps.cxx10
-rw-r--r--vcl/source/filter/svm/SvmConverter.cxx12
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx7
-rw-r--r--vcl/source/filter/svm/SvmWriter.cxx2
-rw-r--r--vcl/source/filter/wmf/emfwr.cxx10
-rw-r--r--vcl/source/filter/wmf/emfwr.hxx2
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx10
-rw-r--r--vcl/source/filter/wmf/wmfwr.hxx6
-rw-r--r--vcl/source/gdi/metaact.cxx10
-rw-r--r--vcl/source/gdi/pdfwriter.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx3
-rw-r--r--vcl/source/gdi/textlayout.cxx7
-rw-r--r--vcl/source/outdev/text.cxx39
-rw-r--r--vcl/workben/vcldemo.cxx3
18 files changed, 90 insertions, 92 deletions
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index 6f68478f2f61..e8ce5163177f 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -1230,7 +1230,7 @@ public:
/* actual drawing functions */
void drawText( const Point& rPos, const OUString& rText, sal_Int32 nIndex, sal_Int32 nLen, bool bTextLines = true );
- void drawTextArray( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, o3tl::span<const sal_Bool> pKashidaArray, sal_Int32 nIndex, sal_Int32 nLen );
+ void drawTextArray( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, o3tl::span<const sal_Bool> pKashidaArray, sal_Int32 nIndex, sal_Int32 nLen );
void drawStretchText( const Point& rPos, sal_uLong nWidth, const OUString& rText,
sal_Int32 nIndex, sal_Int32 nLen );
void drawText( const tools::Rectangle& rRect, const OUString& rOrigStr, DrawTextFlags nStyle );
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 92f537b1b73a..1e82a70e9546 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -78,10 +78,10 @@ void VclComplexTextTest::testArabic()
// absolute character widths AKA text array.
std::vector<sal_Int32> aRefCharWidths {6, 9, 16, 16, 22, 22, 26, 29, 32, 32,
36, 40, 49, 53, 56, 63, 63, 66, 72, 72};
- std::vector<sal_Int32> aCharWidths(aOneTwoThree.getLength(), 0);
+ KernArray aCharWidths;
tools::Long nTextWidth = pOutDev->GetTextArray(aOneTwoThree, &aCharWidths);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
CPPUNIT_ASSERT_EQUAL(tools::Long(72), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -246,7 +246,8 @@ void VclComplexTextTest::testCaret()
pOutDev->SetFont( aFont );
OUString aText;
- std::vector<sal_Int32> aCharWidths, aRefCharWidths;
+ KernArray aCharWidths;
+ std::vector<sal_Int32> aRefCharWidths;
tools::Long nTextWidth, nTextWidth2;
// A. RTL text
@@ -255,20 +256,16 @@ void VclComplexTextTest::testCaret()
// 1) Regular DX array, the ligature width is given to the first components
// and the next ones are all zero width.
aRefCharWidths = { 114, 114, 178, 234, 353, 353 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/false);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(353), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
// 2) Caret placement DX array, ligature width is distributed over its
// components.
aRefCharWidths = { 57, 114, 178, 234, 293, 353 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(353), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -276,14 +273,12 @@ void VclComplexTextTest::testCaret()
// component count.
aText = u"لَاَ بلَاَ";
aRefCharWidths = { 57, 57, 114, 114, 178, 234, 293, 293, 353, 353 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth2 = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
CPPUNIT_ASSERT_EQUAL(aCharWidths[0], aCharWidths[1]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(353), nTextWidth2);
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -294,20 +289,16 @@ void VclComplexTextTest::testCaret()
// 1) Regular DX array, the ligature width is given to the first components
// and the next ones are all zero width.
aRefCharWidths = { 126, 126, 190, 316, 316, 380, 573, 573, 573, 637, 830, 830, 830 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/false);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(830), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
// 2) Caret placement DX array, ligature width is distributed over its
// components.
aRefCharWidths = { 63, 126, 190, 253, 316, 380, 444, 508, 573, 637, 701, 765, 830 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(830), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
#endif
@@ -322,7 +313,8 @@ void VclComplexTextTest::testGdefCaret()
vcl::Font aFont;
OUString aText;
- std::vector<sal_Int32> aCharWidths, aRefCharWidths;
+ KernArray aCharWidths;
+ std::vector<sal_Int32> aRefCharWidths;
tools::Long nTextWidth, nTextWidth2;
// A. RTL text
@@ -333,21 +325,17 @@ void VclComplexTextTest::testGdefCaret()
// 1) Regular DX array, the ligature width is given to the first components
// and the next ones are all zero width.
- aRefCharWidths = { 104, 104, 148, 203, 325, 325 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
+ aRefCharWidths= { 104, 104, 148, 203, 325, 325 };
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/false);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(325), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
// 2) Caret placement DX array, ligature width is distributed over its
// components.
aRefCharWidths = { 53, 104, 148, 203, 265, 325 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(325), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -355,14 +343,12 @@ void VclComplexTextTest::testGdefCaret()
// component count.
aText = u"لَاَ بلَاَ";
aRefCharWidths = { 53, 53, 104, 104, 148, 203, 265, 265, 325, 325 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth2 = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
CPPUNIT_ASSERT_EQUAL(aCharWidths[0], aCharWidths[1]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(325), nTextWidth2);
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -377,10 +363,8 @@ void VclComplexTextTest::testGdefCaret()
// and the next ones are all zero width.
aRefCharWidths = { 104, 104, 162, 321, 321, 321, 379, 487, 487, 545, 708,
708, 708, 766, 926, 926, 984, 1198, 1198, 1198 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/false);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(1198), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
@@ -388,10 +372,8 @@ void VclComplexTextTest::testGdefCaret()
// components.
aRefCharWidths = { 53, 104, 162, 215, 269, 321, 379, 433, 487, 545, 599,
654, 708, 766, 826, 926, 984, 1038, 1097, 1198 };
- aCharWidths.resize(aText.getLength());
- std::fill(aCharWidths.begin(), aCharWidths.end(), 0);
nTextWidth = pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/true);
- CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
+ CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
CPPUNIT_ASSERT_EQUAL(tools::Long(1198), nTextWidth);
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
#endif
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index abc4414c1566..3c92ea3d7d7f 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -860,7 +860,7 @@ void SvmTest::testTextArray()
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
sal_Int32 const aDX[] = { 10, 15, 20, 25, 30, 35 };
- pVirtualDev->DrawTextArray(Point(4,6), "123456", aDX, {}, 1, 4);
+ pVirtualDev->DrawTextArray(Point(4,6), "123456", KernArraySpan(aDX), {}, 1, 4);
checkTextArray(writeAndReadStream(aGDIMetaFile));
checkTextArray(readFile(u"textarray.svm"));
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 44d6fc56ab70..421e159eee81 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -20,6 +20,7 @@
#include <vcl/builder.hxx>
#include <vcl/svapp.hxx>
#include <vcl/help.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
#include <vcl/event.hxx>
@@ -707,7 +708,7 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext)
rRenderContext.SetLineColor(rStyleSettings.GetWindowTextColor());
Point aStartPos(nDayX, nDeltaY);
rRenderContext.DrawLine(aStartPos, Point(nDayX + (7 * mnDayWidth), nDeltaY));
- std::vector<sal_Int32> aTmp;
+ KernArray aTmp;
for (int k=0; k<7; ++k)
aTmp.push_back(mnDayOfWeekAry[k+1]);
rRenderContext.DrawTextArray(Point(nDayX + mnDayOfWeekAry[0], nDayY), maDayOfWeekText, aTmp, {}, 0, aTmp.size());
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 797d6b887efc..9da4f666b238 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -201,10 +201,10 @@ private:
void ImplSetClipRegion( vcl::Region const & rRegion );
void ImplBmp( Bitmap const *, Bitmap const *, const Point &, double nWidth, double nHeight );
- void ImplText( const OUString& rUniString, const Point& rPos, o3tl::span<const sal_Int32> pDXArry, o3tl::span<const sal_Bool> pKashidaArry, sal_Int32 nWidth, VirtualDevice const & rVDev );
+ void ImplText( const OUString& rUniString, const Point& rPos, KernArraySpan pDXArry, o3tl::span<const sal_Bool> pKashidaArry, sal_Int32 nWidth, VirtualDevice const & rVDev );
void ImplSetAttrForText( const Point & rPoint );
void ImplWriteCharacter( char );
- void ImplWriteString( const OString&, VirtualDevice const & rVDev, o3tl::span<const sal_Int32> pDXArry, bool bStretch );
+ void ImplWriteString( const OString&, VirtualDevice const & rVDev, KernArraySpan pDXArry, bool bStretch );
void ImplDefineFont( const char*, const char* );
void ImplClosePathDraw();
@@ -1958,7 +1958,7 @@ void PSWriter::ImplWriteCharacter( char nChar )
ImplWriteByte( static_cast<sal_uInt8>(nChar), PS_NONE );
}
-void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rVDev, o3tl::span<const sal_Int32> pDXArry, bool bStretch )
+void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rVDev, KernArraySpan pDXArry, bool bStretch )
{
sal_Int32 nLen = rString.getLength();
if ( !nLen )
@@ -1988,7 +1988,7 @@ void PSWriter::ImplWriteString( const OString& rString, VirtualDevice const & rV
}
}
-void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, o3tl::span<const sal_Int32> pDXArry, o3tl::span<const sal_Bool> pKashidaArry, sal_Int32 nWidth, VirtualDevice const & rVDev )
+void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, KernArraySpan pDXArry, o3tl::span<const sal_Bool> pKashidaArry, sal_Int32 nWidth, VirtualDevice const & rVDev )
{
if ( rUniString.isEmpty() )
return;
@@ -2036,7 +2036,7 @@ void PSWriter::ImplText( const OUString& rUniString, const Point& rPos, o3tl::sp
else if ( ( mnTextMode == 1 ) || ( mnTextMode == 2 ) ) // normal text output
{
if ( mnTextMode == 2 ) // forcing output one complete text packet, by
- pDXArry = {}; // ignoring the kerning array
+ pDXArry = {}; // ignoring the kerning array
ImplSetAttrForText( rPos );
OString aStr(OUStringToOString(rUniString,
maFont.GetCharSet()));
diff --git a/vcl/source/filter/svm/SvmConverter.cxx b/vcl/source/filter/svm/SvmConverter.cxx
index 0729a41c767e..60fa48f2927d 100644
--- a/vcl/source/filter/svm/SvmConverter.cxx
+++ b/vcl/source/filter/svm/SvmConverter.cxx
@@ -251,7 +251,7 @@ namespace
}
void ClampRange(std::u16string_view rStr, sal_Int32& rIndex, sal_Int32& rLength,
- std::vector<sal_Int32>* pDXAry = nullptr)
+ KernArray* pDXAry = nullptr)
{
const sal_Int32 nStrLength = rStr.size();
@@ -738,7 +738,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
OUString aStr(OStringToOUString(aByteStr, eActualCharSet));
- std::vector<sal_Int32> aDXAry;
+ KernArray aDXAry;
if (nAryLen > 0)
{
const size_t nMinRecordSize = sizeof(sal_Int32);
@@ -770,7 +770,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
for (sal_Int32 j = 0; j < nAryLen; ++j)
{
rIStm.ReadInt32( nTmp );
- aDXAry[ j ] = nTmp;
+ aDXAry.set(j, nTmp);
}
// #106172# Add last DX array elem, if missing
@@ -778,7 +778,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
{
if (nAryLen+1 == nStrLen && nIndex >= 0)
{
- std::vector<sal_Int32> aTmpAry;
+ KernArray aTmpAry;
aFontVDev->GetTextArray( aStr, &aTmpAry, nIndex, nLen );
@@ -794,9 +794,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
// difference to last elem and store
// in very last.
if( nStrLen > 1 )
- aDXAry[ nStrLen-1 ] = aDXAry[ nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ];
+ aDXAry.set(nStrLen-1, aDXAry[ nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ]);
else
- aDXAry[ nStrLen-1 ] = aTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
+ aDXAry.set(nStrLen-1, aTmpAry[ nStrLen-1 ]); // len=1: 0th position taken to be 0
}
}
#ifdef DBG_UTIL
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 253f89e91d79..e2b6e87c0ce0 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -631,7 +631,7 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p
{
rtl::Reference<MetaTextArrayAction> pAction(new MetaTextArrayAction);
- std::vector<sal_Int32> aArray;
+ KernArray aArray;
VersionCompatRead aCompat(mrStream);
TypeSerializer aSerializer(mrStream);
@@ -670,17 +670,16 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(const ImplMetaReadData* p
{
try
{
- aArray.resize(nTmpLen);
sal_Int32 i;
sal_Int32 val(0);
for (i = 0; i < nAryLen; i++)
{
mrStream.ReadInt32(val);
- aArray[i] = val;
+ aArray.push_back(val);
}
// #106172# setup remainder
for (; i < nTmpLen; i++)
- aArray[i] = 0;
+ aArray.push_back(0);
}
catch (std::bad_alloc&)
{
diff --git a/vcl/source/filter/svm/SvmWriter.cxx b/vcl/source/filter/svm/SvmWriter.cxx
index e79df6a756bd..c1913b048b27 100644
--- a/vcl/source/filter/svm/SvmWriter.cxx
+++ b/vcl/source/filter/svm/SvmWriter.cxx
@@ -984,7 +984,7 @@ void SvmWriter::TextArrayHandler(const MetaTextArrayAction* pAction, const ImplM
{
mrStream.WriteUInt16(static_cast<sal_uInt16>(pAction->GetType()));
- const std::vector<sal_Int32>& rDXArray = pAction->GetDXArray();
+ const KernArray& rDXArray = pAction->GetDXArray();
const sal_Int32 nAryLen = !rDXArray.empty() ? pAction->GetLen() : 0;
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index b2782847b1b1..a82c45de8d8e 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -861,7 +861,7 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
}
-void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, sal_uInt32 nWidth )
+void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, sal_uInt32 nWidth )
{
sal_Int32 nLen = rText.getLength(), i;
@@ -869,8 +869,8 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, o
return;
sal_uInt32 nNormWidth;
- std::vector<sal_Int32> aOwnArray;
- o3tl::span<const sal_Int32> pDX;
+ KernArray aOwnArray;
+ KernArraySpan pDX;
// get text sizes
if( !pDXArray.empty() )
@@ -892,13 +892,13 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, o
{
if (!pDXArray.empty())
{
- aOwnArray.insert(aOwnArray.begin(), pDXArray.begin(), pDXArray.end());
+ aOwnArray.assign(pDXArray);
pDX = aOwnArray;
}
const double fFactor = static_cast<double>(nWidth) / nNormWidth;
for( i = 0; i < ( nLen - 1 ); i++ )
- aOwnArray[ i ] = FRound( aOwnArray[ i ] * fFactor );
+ aOwnArray.set(i, FRound(aOwnArray[i] * fFactor));
}
}
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index 10ecd7f09f6d..4298096ff68c 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -74,7 +74,7 @@ private:
void ImplWritePolygonRecord( const tools::Polygon& rPoly, bool bClose );
void ImplWritePolyPolygonRecord( const tools::PolyPolygon& rPolyPoly );
void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP );
- void ImplWriteTextRecord( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, sal_uInt32 nWidth );
+ void ImplWriteTextRecord( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, sal_uInt32 nWidth );
void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
void ImplWrite( const GDIMetaFile& rMtf );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 7c209b3a02ee..2c52aa7f5946 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -442,7 +442,7 @@ void WMFWriter::WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_In
/* if return value is true, then a complete unicode string and also a polygon replacement has been written,
so there is no more action necessary
*/
-bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rUniStr, o3tl::span<const sal_Int32> pDXAry )
+bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rUniStr, KernArraySpan pDXAry )
{
bool bEscapeUsed = false;
@@ -547,7 +547,7 @@ bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& r
void WMFWriter::WMFRecord_ExtTextOut( const Point& rPoint,
std::u16string_view rString,
- o3tl::span<const sal_Int32> pDXAry )
+ KernArraySpan pDXAry )
{
sal_Int32 nOriginalTextLen = rString.size();
@@ -562,7 +562,7 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point& rPoint,
}
void WMFWriter::TrueExtTextOut( const Point& rPoint, std::u16string_view rString,
- const OString& rByteString, o3tl::span<const sal_Int32> pDXAry )
+ const OString& rByteString, KernArraySpan pDXAry )
{
WriteRecordHeader( 0, W_META_EXTTEXTOUT );
WritePointYX( rPoint );
@@ -1197,7 +1197,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
pVirDev->SetFont( aSrcFont );
const sal_Int32 nLen = aTemp.getLength();
- std::vector<sal_Int32> aDXAry;
+ KernArray aDXAry;
const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, nLen ? &aDXAry : nullptr );
if (nLen && nNormSize == 0)
{
@@ -1206,7 +1206,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
else
{
for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
- aDXAry[ i ] = aDXAry[ i ] * static_cast<sal_Int32>(pA->GetWidth()) / nNormSize;
+ aDXAry.set(i, aDXAry[i] * static_cast<sal_Int32>(pA->GetWidth()) / nNormSize);
if ( ( nLen <= 1 ) || ( static_cast<sal_Int32>(pA->GetWidth()) == nNormSize ) )
aDXAry.clear();
aSrcLineInfo = LineInfo();
diff --git a/vcl/source/filter/wmf/wmfwr.hxx b/vcl/source/filter/wmf/wmfwr.hxx
index 3b423e4fe682..b22d3d295c59 100644
--- a/vcl/source/filter/wmf/wmfwr.hxx
+++ b/vcl/source/filter/wmf/wmfwr.hxx
@@ -141,11 +141,11 @@ private:
void WMFRecord_DeleteObject(sal_uInt16 nObjectHandle);
void WMFRecord_Ellipse(const tools::Rectangle& rRect);
void WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData );
- bool WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rStr, o3tl::span<const sal_Int32> pDXAry );
- void WMFRecord_ExtTextOut(const Point& rPoint, std::u16string_view rString, o3tl::span<const sal_Int32> pDXAry);
+ bool WMFRecord_Escape_Unicode( const Point& rPoint, const OUString& rStr, KernArraySpan pDXAry );
+ void WMFRecord_ExtTextOut(const Point& rPoint, std::u16string_view rString, KernArraySpan pDXAry);
void TrueExtTextOut(const Point& rPoint, std::u16string_view rString,
- const OString& rByteString, o3tl::span<const sal_Int32> pDXAry);
+ const OString& rByteString, KernArraySpan pDXAry);
void TrueTextOut(const Point& rPoint, const OString& rString);
void WMFRecord_LineTo(const Point & rPoint);
void WMFRecord_MoveTo(const Point & rPoint);
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 0c426d1f930d..c072a27a7864 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -609,7 +609,7 @@ MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) :
MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
OUString aStr,
- std::vector<sal_Int32> aDXAry,
+ KernArray aDXAry,
std::vector<sal_Bool> aKashidaAry,
sal_Int32 nIndex,
sal_Int32 nLen ) :
@@ -625,18 +625,18 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
OUString aStr,
- o3tl::span<const sal_Int32> pDXAry,
+ KernArraySpan pDXAry,
o3tl::span<const sal_Bool> pKashidaAry,
sal_Int32 nIndex,
sal_Int32 nLen ) :
MetaAction ( MetaActionType::TEXTARRAY ),
maStartPt ( rStartPt ),
maStr (std::move( aStr )),
- maDXAry ( pDXAry.begin(), pDXAry.end() ),
maKashidaAry( pKashidaAry.begin(), pKashidaAry.end() ),
mnIndex ( nIndex ),
mnLen ( nLen )
{
+ maDXAry.assign(pDXAry);
}
MetaTextArrayAction::~MetaTextArrayAction()
@@ -665,11 +665,11 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
if ( !maDXAry.empty() && mnLen )
{
for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
- maDXAry[ i ] = FRound( maDXAry[ i ] * fabs(fScaleX) );
+ maDXAry.set(i, FRound(maDXAry[i] * fabs(fScaleX)));
}
}
-void MetaTextArrayAction::SetDXArray(std::vector<sal_Int32> aArray)
+void MetaTextArrayAction::SetDXArray(KernArray aArray)
{
maDXAry = std::move(aArray);
}
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index efea6a987f5b..8b206debfbc1 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -81,7 +81,7 @@ void PDFWriter::DrawTextLine(
void PDFWriter::DrawTextArray(
const Point& rStartPt,
const OUString& rStr,
- o3tl::span<const sal_Int32> pDXAry,
+ KernArraySpan pDXAry,
o3tl::span<const sal_Bool> pKashidaAry,
sal_Int32 nIndex,
sal_Int32 nLen )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 18f9032529c9..5958a202e29e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -64,6 +64,7 @@
#include <vcl/cvtgrf.hxx>
#include <vcl/fontcharmap.hxx>
#include <vcl/glyphitemcache.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/lineinfo.hxx>
#include <vcl/metric.hxx>
#include <vcl/mnemonic.hxx>
@@ -6970,7 +6971,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int3
}
}
-void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, o3tl::span<const sal_Int32> pDXArray, o3tl::span<const sal_Bool> pKashidaArray, sal_Int32 nIndex, sal_Int32 nLen )
+void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, KernArraySpan pDXArray, o3tl::span<const sal_Bool> pKashidaArray, sal_Int32 nIndex, sal_Int32 nLen )
{
MARK( "drawText with array" );
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index 2d0219041ba2..0ee1c9ba5faf 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -18,6 +18,7 @@
*/
#include <vcl/ctrl.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/outdev.hxx>
#include <textlayout.hxx>
@@ -86,7 +87,7 @@ namespace vcl
tools::Rectangle GetTextRect( const tools::Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize );
private:
- tools::Long GetTextArray( const OUString& _rText, std::vector<sal_Int32>* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
+ tools::Long GetTextArray( const OUString& _rText, KernArray* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const;
OutputDevice& m_rTargetDevice;
OutputDevice& m_rReferenceDevice;
@@ -159,7 +160,7 @@ namespace vcl
}
}
- tools::Long ReferenceDeviceTextLayout::GetTextArray( const OUString& _rText, std::vector<sal_Int32>* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
+ tools::Long ReferenceDeviceTextLayout::GetTextArray( const OUString& _rText, KernArray* _pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const
{
if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) )
return 0;
@@ -207,7 +208,7 @@ namespace vcl
return;
}
- std::vector<sal_Int32> aCharWidths;
+ KernArray aCharWidths;
tools::Long nTextWidth = GetTextArray( _rText, &aCharWidths, _nStartIndex, _nLength );
m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, aCharWidths, {}, _nStartIndex, _nLength );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 029a49cc9acf..f66ece92d48b 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -921,7 +921,7 @@ float OutputDevice::approximate_digit_width() const
}
void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
- o3tl::span<const sal_Int32> pDXAry,
+ KernArraySpan pDXAry,
o3tl::span<const sal_Bool> pKashidaAry,
sal_Int32 nIndex, sal_Int32 nLen, SalLayoutFlags flags,
const SalLayoutGlyphs* pSalLayoutCache )
@@ -955,7 +955,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr,
mpAlphaVDev->DrawTextArray( rStartPt, rStr, pDXAry, pKashidaAry, nIndex, nLen, flags );
}
-tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_Int32>* pDXAry,
+tools::Long OutputDevice::GetTextArray( const OUString& rStr, KernArray* pKernArray,
sal_Int32 nIndex, sal_Int32 nLen, bool bCaret,
vcl::text::TextLayoutCache const*const pLayoutCache,
SalLayoutGlyphs const*const pSalLayoutCache) const
@@ -968,6 +968,8 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In
nLen = rStr.getLength() - nIndex;
}
+ std::vector<sal_Int32>* pDXAry = pKernArray ? &pKernArray->get_subunit_array() : nullptr;
+
// do layout
std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen,
Point(0,0), 0, {}, {}, eDefaultLayout, pLayoutCache, pSalLayoutCache);
@@ -1035,14 +1037,24 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, std::vector<sal_In
(*pDXAry)[ i ] += (*pDXAry)[ i-1 ];
// convert from font units to logical units
- if( mbMap )
+ if (pDXAry)
{
- if( pDXAry )
- for( int i = 0; i < nLen; ++i )
- (*pDXAry)[i] = ImplDevicePixelToLogicWidth( (*pDXAry)[i] );
- nWidth = ImplDevicePixelToLogicWidth( nWidth );
+ int nSubPixelFactor = pKernArray->get_factor();
+ if (mbMap)
+ {
+ for (int i = 0; i < nLen; ++i)
+ (*pDXAry)[i] = ImplDevicePixelToLogicWidth( (*pDXAry)[i] * nSubPixelFactor );
+ }
+ else if (nSubPixelFactor)
+ {
+ for (int i = 0; i < nLen; ++i)
+ (*pDXAry)[i] *= nSubPixelFactor;
+ }
}
+ if (mbMap)
+ nWidth = ImplDevicePixelToLogicWidth( nWidth );
+
return nWidth;
#endif /* VCL_FLOAT_DEVICE_PIXEL */
}
@@ -1290,7 +1302,7 @@ OutputDevice::FontMappingUseData OutputDevice::FinishTrackingFontMappingUse()
std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr,
sal_Int32 nMinIndex, sal_Int32 nLen,
const Point& rLogicalPos, tools::Long nLogicalWidth,
- o3tl::span<const sal_Int32> pDXArray,
+ KernArraySpan pDXArray,
o3tl::span<const sal_Bool> pKashidaArray,
SalLayoutFlags flags,
vcl::text::TextLayoutCache const* pLayoutCache,
@@ -1360,13 +1372,14 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr,
{
// convert from logical units to font units without rounding,
// keeping accuracy for lower levels
+ int nSubPixels = pDXArray.get_factor();
for (int i = 0; i < nLen; ++i)
- xNaturalDXPixelArray[i] = ImplLogicWidthToDeviceSubPixel(pDXArray[i]);
+ xNaturalDXPixelArray[i] = ImplLogicWidthToDeviceSubPixel(pDXArray.get_subunit(i)) / nSubPixels;
}
else
{
for(int i = 0; i < nLen; ++i)
- xNaturalDXPixelArray[i] = pDXArray[i];
+ xNaturalDXPixelArray[i] = pDXArray.get(i);
}
aLayoutArgs.SetNaturalDXArray(xNaturalDXPixelArray.get());
@@ -2310,7 +2323,7 @@ tools::Long OutputDevice::GetCtrlTextWidth( const OUString& rStr, const SalLayou
bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
const OUString& rStr, sal_Int32 nBase,
sal_Int32 nIndex, sal_Int32 nLen,
- sal_uLong nLayoutWidth, o3tl::span<const sal_Int32> pDXAry,
+ sal_uLong nLayoutWidth, KernArraySpan pDXAry,
o3tl::span<const sal_Bool> pKashidaAry,
const SalLayoutGlyphs* pGlyphs ) const
{
@@ -2361,7 +2374,7 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector,
const OUString& rStr, sal_Int32 nBase,
sal_Int32 nIndex, sal_Int32 nLen,
sal_uLong nLayoutWidth,
- o3tl::span<const sal_Int32> pDXArray,
+ KernArraySpan pDXArray,
o3tl::span<const sal_Bool> pKashidaArray ) const
{
if (!InitFont())
@@ -2442,7 +2455,7 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector,
bool OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector,
const OUString& rStr, sal_Int32 nBase,
sal_Int32 nIndex, sal_Int32 nLen,
- sal_uLong nLayoutWidth, o3tl::span<const sal_Int32> pDXArray,
+ sal_uLong nLayoutWidth, KernArraySpan pDXArray,
o3tl::span<const sal_Bool> pKashidaArray ) const
{
rResultVector.clear();
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 4588b4e73a8e..05897bce5f6d 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -47,6 +47,7 @@
#include <vcl/toolbox.hxx>
#include <vcl/toolkit/floatwin.hxx>
#include <vcl/help.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/menu.hxx>
#include <vcl/ImageTree.hxx>
#include <vcl/BitmapEmbossGreyFilter.hxx>
@@ -633,7 +634,7 @@ public:
}
// DX array rendering
- std::vector<sal_Int32> aItems;
+ KernArray aItems;
rDev.GetTextArray(aText, &aItems);
for (tools::Long j = 0; j < aText.getLength(); ++j)
{