summaryrefslogtreecommitdiff
path: root/toolkit
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 /toolkit
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 'toolkit')
-rw-r--r--toolkit/source/awt/vclxfont.cxx11
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx12
2 files changed, 12 insertions, 11 deletions
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
index e84fe338c5b6..866a362e710f 100644
--- a/toolkit/source/awt/vclxfont.cxx
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -25,12 +25,11 @@
#include <toolkit/awt/vclxfont.hxx>
#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/metric.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
-
-
VCLXFont::VCLXFont()
{
mpFontMetric = nullptr;
@@ -156,10 +155,12 @@ sal_Int32 VCLXFont::getStringWidthArray( const OUString& str, css::uno::Sequence
{
vcl::Font aOldFont = pOutDev->GetFont();
pOutDev->SetFont( maFont );
- std::vector<sal_Int32> aDXA;
+ KernArray aDXA;
nRet = pOutDev->GetTextArray( str, &aDXA );
- // I don't know if size of aDXA is guaranteed same as length of str, so use arrayToSequence
- rDXArray = comphelper::arrayToSequence<sal_Int32>(aDXA.data(), str.getLength());
+ rDXArray.realloc(aDXA.size());
+ sal_Int32* pArray = rDXArray.getArray();
+ for (size_t i = 0, nLen = aDXA.size(); i < nLen; ++i)
+ pArray[i] = aDXA[i];
pOutDev->SetFont( aOldFont );
}
return nRet;
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
index 673c44eb09f2..3707f573b064 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -26,6 +26,7 @@
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
+#include <vcl/kernarray.hxx>
#include <vcl/gradient.hxx>
#include <vcl/metric.hxx>
#include <tools/debug.hxx>
@@ -463,12 +464,11 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex
if( mpOutputDevice )
{
InitOutputDevice( InitOutDevFlags::COLORS|InitOutDevFlags::FONT );
- std::vector<sal_Int32> aDXA(rText.getLength());
- for(int i = 0; i < rText.getLength(); i++)
- {
- aDXA[i] = rLongs[i];
- }
- mpOutputDevice->DrawTextArray( Point( x, y ), rText, aDXA , {}, 0, rText.getLength());
+ KernArray aDXA;
+ aDXA.reserve(rText.getLength());
+ for(int i = 0; i < rText.getLength(); ++i)
+ aDXA.push_back(rLongs[i]);
+ mpOutputDevice->DrawTextArray( Point( x, y ), rText, aDXA, {}, 0, rText.getLength());
}
}