diff options
-rw-r--r-- | include/vcl/vcllayout.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/font/FontMetricData.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/font/LogicalFontInstance.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/impglyphitem.hxx | 33 | ||||
-rw-r--r-- | vcl/inc/sallayout.hxx | 14 | ||||
-rw-r--r-- | vcl/qa/cppunit/complextext.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/LogicalFontInstance.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 40 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 54 |
11 files changed, 76 insertions, 101 deletions
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx index 4705a44d9b92..4acfb9b4ab04 100644 --- a/include/vcl/vcllayout.hxx +++ b/include/vcl/vcllayout.hxx @@ -93,9 +93,9 @@ public: } // methods using string indexing - virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0; - virtual DeviceCoordinate FillDXArray( std::vector<DeviceCoordinate>* pDXArray, const OUString& rStr ) const = 0; - virtual DeviceCoordinate GetTextWidth() const { return FillDXArray( nullptr, {} ); } + virtual sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const = 0; + virtual double FillDXArray( std::vector<double>* pDXArray, const OUString& rStr ) const = 0; + virtual double GetTextWidth() const { return FillDXArray( nullptr, {} ); } virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0; virtual bool IsKashidaPosValid ( int /*nCharPos*/, int /*nNextCharPos*/ ) const = 0; // i60594 diff --git a/vcl/inc/font/FontMetricData.hxx b/vcl/inc/font/FontMetricData.hxx index 000a5a250bbd..bd552562ff9a 100644 --- a/vcl/inc/font/FontMetricData.hxx +++ b/vcl/inc/font/FontMetricData.hxx @@ -56,11 +56,11 @@ public: tools::Long GetInternalLeading() const { return mnIntLeading; } tools::Long GetExternalLeading() const { return mnExtLeading; } int GetSlant() const { return mnSlant; } - tools::Long GetMinKashida() const { return mnMinKashida; } + double GetMinKashida() const { return mnMinKashida; } tools::Long GetHangingBaseline() const { return mnHangingBaseline; } void SetSlant(int nSlant) { mnSlant=nSlant; } - void SetMinKashida( tools::Long nMinKashida ) { mnMinKashida=nMinKashida; } + void SetMinKashida(double nMinKashida ) { mnMinKashida=nMinKashida; } // font attributes queried from the font instance bool IsFullstopCentered() const { return mbFullstopCentered; } @@ -117,7 +117,7 @@ private: tools::Long mnIntLeading; // Internal Leading tools::Long mnExtLeading; // External Leading int mnSlant; // Slant (Italic/Oblique) - tools::Long mnMinKashida; // Minimal width of kashida (Arabic) + double mnMinKashida; // Minimal width of kashida (Arabic) tools::Long mnHangingBaseline; // Offset of hanging baseline to Romn baseline // font attributes queried from the font instance diff --git a/vcl/inc/font/LogicalFontInstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx index e85d25b41f10..43b23d9cd0e9 100644 --- a/vcl/inc/font/LogicalFontInstance.hxx +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -109,7 +109,7 @@ public: // TODO: make data members private double GetGlyphWidth(sal_GlyphId, bool = false, bool = true) const; - int GetKashidaWidth() const; + double GetKashidaWidth() const; void GetScale(double* nXScale, double* nYScale) const; diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx index 87f966bd1676..c729d0cc9b7e 100644 --- a/vcl/inc/impglyphitem.hxx +++ b/vcl/inc/impglyphitem.hxx @@ -24,6 +24,7 @@ #include <tools/gen.hxx> #include <vcl/dllapi.h> #include <vcl/outdev.hxx> +#include <rtl/math.hxx> #include <vector> #include "font/LogicalFontInstance.hxx" @@ -51,18 +52,18 @@ template <> struct typed_flags<GlyphItemFlags> : is_typed_flags<GlyphItemFlags, class VCL_DLLPUBLIC GlyphItem { DevicePoint m_aLinearPos; // absolute position of non rotated string - DeviceCoordinate m_nOrigWidth; // original glyph width + double m_nOrigWidth; // original glyph width sal_Int32 m_nCharPos; // index in string - sal_Int32 m_nXOffset; - sal_Int32 m_nYOffset; - DeviceCoordinate m_nNewWidth; // width after adjustments + double m_nXOffset; + double m_nYOffset; + double m_nNewWidth; // width after adjustments sal_GlyphId m_aGlyphId; GlyphItemFlags m_nFlags; sal_Int8 m_nCharCount; // number of characters making up this glyph public: GlyphItem(int nCharPos, int nCharCount, sal_GlyphId aGlyphId, const DevicePoint& rLinearPos, - GlyphItemFlags nFlags, DeviceCoordinate nOrigWidth, int nXOffset, int nYOffset) + GlyphItemFlags nFlags, double nOrigWidth, double nXOffset, double nYOffset) : m_aLinearPos(rLinearPos) , m_nOrigWidth(nOrigWidth) , m_nCharPos(nCharPos) @@ -93,24 +94,26 @@ public: sal_GlyphId glyphId() const { return m_aGlyphId; } int charCount() const { return m_nCharCount; } - DeviceCoordinate origWidth() const { return m_nOrigWidth; } + double origWidth() const { return m_nOrigWidth; } int charPos() const { return m_nCharPos; } - int xOffset() const { return m_nXOffset; } - int yOffset() const { return m_nYOffset; } - DeviceCoordinate newWidth() const { return m_nNewWidth; } + double xOffset() const { return m_nXOffset; } + double yOffset() const { return m_nYOffset; } + double newWidth() const { return m_nNewWidth; } const DevicePoint& linearPos() const { return m_aLinearPos; } - void setNewWidth(DeviceCoordinate width) { m_nNewWidth = width; } - void addNewWidth(DeviceCoordinate width) { m_nNewWidth += width; } + void setNewWidth(double width) { m_nNewWidth = width; } + void addNewWidth(double width) { m_nNewWidth += width; } void setLinearPos(const DevicePoint& point) { m_aLinearPos = point; } void setLinearPosX(double x) { m_aLinearPos.setX(x); } void adjustLinearPosX(double diff) { m_aLinearPos.adjustX(diff); } bool isLayoutEquivalent(const GlyphItem& other) const { - return m_aLinearPos == other.m_aLinearPos && m_nOrigWidth == other.m_nOrigWidth - && m_nCharPos == other.m_nCharPos && m_nXOffset == other.m_nXOffset - && m_nYOffset == other.m_nYOffset && m_nNewWidth == other.m_nNewWidth - && m_aGlyphId == other.m_aGlyphId && m_nCharCount == other.m_nCharCount + return rtl::math::approxEqual(m_aLinearPos.getX(), other.m_aLinearPos.getX(), 8) + && rtl::math::approxEqual(m_aLinearPos.getY(), other.m_aLinearPos.getY(), 8) + && m_nOrigWidth == other.m_nOrigWidth && m_nCharPos == other.m_nCharPos + && m_nXOffset == other.m_nXOffset && m_nYOffset == other.m_nYOffset + && m_nNewWidth == other.m_nNewWidth && m_aGlyphId == other.m_aGlyphId + && m_nCharCount == other.m_nCharCount && (m_nFlags & ~GlyphItemFlags::IS_UNSAFE_TO_BREAK) == (other.m_nFlags & ~GlyphItemFlags::IS_UNSAFE_TO_BREAK); } diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index d48edaaf67f2..51f62d9b0057 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -61,9 +61,9 @@ class MultiSalLayout final : public SalLayout { public: void DrawText(SalGraphics&) const override; - sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override; - DeviceCoordinate GetTextWidth() const final override; - DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray, const OUString& rStr) const override; + sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const override; + double GetTextWidth() const final override; + double FillDXArray(std::vector<double>* pDXArray, const OUString& rStr) const override; void GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const override; bool GetNextGlyph(const GlyphItem** pGlyph, DevicePoint& rPos, int& nStart, const LogicalFontInstance** ppGlyphFont = nullptr) const override; @@ -117,9 +117,9 @@ public: bool IsKashidaPosValid(int nCharPos, int nNextCharPos) const final override; // used by upper layers - DeviceCoordinate GetTextWidth() const final override; - DeviceCoordinate FillDXArray(std::vector<DeviceCoordinate>* pDXArray, const OUString& rStr) const final override; - sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const final override; + double GetTextWidth() const final override; + double FillDXArray(std::vector<double>* pDXArray, const OUString& rStr) const final override; + sal_Int32 GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const final override; void GetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) const final override; // used by display layers @@ -144,7 +144,7 @@ private: void Justify(DeviceCoordinate nNewWidth); void ApplyAsianKerning(std::u16string_view rStr); - void GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths, + void GetCharWidths(std::vector<double>& rCharWidths, const OUString& rStr) const; void SetNeedFallback(vcl::text::ImplLayoutArgs&, sal_Int32, bool); diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index db8593e48fbb..6c2491a27010 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -424,7 +424,7 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf152048) // Without the fix this fails with: // - Expected: 393 // - Actual : 511 - CPPUNIT_ASSERT_EQUAL(DeviceCoordinate(nRefTextWidth + nKashida), pLayout->GetTextWidth()); + CPPUNIT_ASSERT_EQUAL(double(nRefTextWidth + nKashida), pLayout->GetTextWidth()); #endif } diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index 766dd2514120..965fc91591c1 100644 --- a/vcl/source/font/LogicalFontInstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -102,7 +102,7 @@ hb_font_t* LogicalFontInstance::GetHbFontUntransformed() const return pHbFont; } -int LogicalFontInstance::GetKashidaWidth() const +double LogicalFontInstance::GetKashidaWidth() const { sal_GlyphId nGlyph = GetGlyphIndex(0x0640); if (nGlyph) diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index f46f4d875210..ca34b098c8cb 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -239,12 +239,12 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay // horizontal text. That is the offset from original baseline to // the center of EM box. Maybe we can use OpenType base table to improve this // in the future. - DeviceCoordinate nBaseOffset = 0; + double nBaseOffset = 0; if (rArgs.mnFlags & SalLayoutFlags::Vertical) { hb_font_extents_t extents; if (hb_font_get_h_extents(pHbFont, &extents)) - nBaseOffset = ( extents.ascender + extents.descender ) / 2; + nBaseOffset = ( extents.ascender + extents.descender ) / 2.0; } hb_buffer_t* pHbBuffer = hb_buffer_create(); @@ -505,7 +505,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay if (hb_glyph_info_get_glyph_flags(&pHbGlyphInfos[i]) & HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL) nGlyphFlags |= GlyphItemFlags::IS_SAFE_TO_INSERT_KASHIDA; - DeviceCoordinate nAdvance, nXOffset, nYOffset; + double nAdvance, nXOffset, nYOffset; if (aSubRun.maDirection == HB_DIRECTION_TTB) { nGlyphFlags |= GlyphItemFlags::IS_VERTICAL; @@ -523,7 +523,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay GetFont().GetGlyphBoundRect(nGlyphIndex, aRect, true); nXOffset = -(aRect.Top() / nXScale + ( pHbPositions[i].y_advance - + ( aRect.GetHeight() / nXScale ) ) / 2 ); + + ( aRect.GetHeight() / nXScale ) ) / 2.0 ); } } @@ -557,7 +557,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay return true; } -void GenericSalLayout::GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths, const OUString& rStr) const +void GenericSalLayout::GetCharWidths(std::vector<double>& rCharWidths, const OUString& rStr) const { const int nCharCount = mnEndCharPos - mnMinCharPos; @@ -595,7 +595,7 @@ void GenericSalLayout::GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths, { // More than one grapheme cluster, we want to distribute the glyph // width over them. - std::vector<DeviceCoordinate> aWidths(nGraphemeCount); + std::vector<double> aWidths(nGraphemeCount); // Check if the glyph has ligature caret positions. unsigned int nCarets = nGraphemeCount; @@ -662,7 +662,7 @@ void GenericSalLayout::GetCharWidths(std::vector<DeviceCoordinate>& rCharWidths, void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKashidaArray) { int nCharCount = mnEndCharPos - mnMinCharPos; - std::vector<DeviceCoordinate> aOldCharWidths; + std::vector<double> aOldCharWidths; std::unique_ptr<double[]> const pNewCharWidths(new double[nCharCount]); // Get the natural character widths (i.e. before applying DX adjustments). @@ -679,7 +679,7 @@ void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKas // Map of Kashida insertion points (in the glyph items vector) and the // requested width. - std::map<size_t, std::pair<DeviceCoordinate, DeviceCoordinate>> pKashidas; + std::map<size_t, std::pair<double, double>> pKashidas; // The accumulated difference in X position. double nDelta = 0; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 42f85d42bb76..533fd62f2ae6 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6983,7 +6983,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool if( m_aCurrentPDFState.m_aFont.IsWordLineMode() ) { DevicePoint aStartPt; - DeviceCoordinate nWidth = 0; + double nWidth = 0; nIndex = 0; while (rLayout.GetNextGlyph(&pGlyph, aPos, nIndex)) { diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index be3506bf4e3c..da70859f4c53 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -255,7 +255,7 @@ SalLayoutGlyphs SalLayout::GetGlyphs() const return SalLayoutGlyphs(); // invalid } -DeviceCoordinate GenericSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths, const OUString& rStr ) const +double GenericSalLayout::FillDXArray( std::vector<double>* pCharWidths, const OUString& rStr ) const { if (pCharWidths) GetCharWidths(*pCharWidths, rStr); @@ -264,12 +264,12 @@ DeviceCoordinate GenericSalLayout::FillDXArray( std::vector<DeviceCoordinate>* p } // the text width is the maximum logical extent of all glyphs -DeviceCoordinate GenericSalLayout::GetTextWidth() const +double GenericSalLayout::GetTextWidth() const { if (!m_GlyphItems.IsValid()) return 0; - DeviceCoordinate nWidth = 0; + double nWidth = 0; for (auto const& aGlyphItem : m_GlyphItems) nWidth += aGlyphItem.newWidth(); @@ -470,15 +470,15 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray } } -sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor ) const +sal_Int32 GenericSalLayout::GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const { - std::vector<DeviceCoordinate> aCharWidths; + std::vector<double> aCharWidths; GetCharWidths(aCharWidths, {}); - DeviceCoordinate nWidth = 0; + double nWidth = 0; for( int i = mnMinCharPos; i < mnEndCharPos; ++i ) { - DeviceCoordinate nDelta = aCharWidths[ i - mnMinCharPos ] * nFactor; + double nDelta = aCharWidths[ i - mnMinCharPos ] * nFactor; if (nDelta != 0) { @@ -634,8 +634,7 @@ void MultiSalLayout::AdjustLayout( vcl::text::ImplLayoutArgs& rArgs ) { SalLayout::AdjustLayout( rArgs ); vcl::text::ImplLayoutArgs aMultiArgs = rArgs; - std::vector<DeviceCoordinate> aJustificationArray; - std::vector<double> aNaturalJustificationArray; + std::vector<double> aJustificationArray; if( !rArgs.HasDXArray() && rArgs.mnLayoutWidth ) { @@ -684,11 +683,8 @@ void MultiSalLayout::AdjustLayout( vcl::text::ImplLayoutArgs& rArgs ) if( nWidthSum != nTargetWidth ) aJustificationArray[ nCharCount-1 ] = nTargetWidth; - aNaturalJustificationArray.reserve(aJustificationArray.size()); - for (DeviceCoordinate a : aJustificationArray) - aNaturalJustificationArray.push_back(a); // change the DXArray temporarily (just for the justification) - aMultiArgs.mpDXArray = aNaturalJustificationArray.data(); + aMultiArgs.mpDXArray = aJustificationArray.data(); } } @@ -976,7 +972,7 @@ void MultiSalLayout::DrawText( SalGraphics& rGraphics ) const // NOTE: now the baselevel font is active again } -sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor ) const +sal_Int32 MultiSalLayout::GetTextBreak(double nMaxWidth, double nCharExtra, int nFactor) const { if( mnLevel <= 0 ) return -1; @@ -984,8 +980,8 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor ); int nCharCount = mnEndCharPos - mnMinCharPos; - std::vector<DeviceCoordinate> aCharWidths; - std::vector<DeviceCoordinate> aFallbackCharWidths; + std::vector<double> aCharWidths; + std::vector<double> aFallbackCharWidths; mpLayouts[0]->FillDXArray( &aCharWidths, {} ); for( int n = 1; n < mnLevel; ++n ) @@ -997,7 +993,7 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi aCharWidths[i] = aFallbackCharWidths[i]; } - DeviceCoordinate nWidth = 0; + double nWidth = 0; for( int i = 0; i < nCharCount; ++i ) { nWidth += aCharWidths[ i ] * nFactor; @@ -1009,7 +1005,7 @@ sal_Int32 MultiSalLayout::GetTextBreak( DeviceCoordinate nMaxWidth, DeviceCoordi return -1; } -DeviceCoordinate MultiSalLayout::GetTextWidth() const +double MultiSalLayout::GetTextWidth() const { // Measure text width. There might be holes in each SalLayout due to // missing chars, so we use GetNextGlyph() to get the glyphs across all @@ -1018,19 +1014,19 @@ DeviceCoordinate MultiSalLayout::GetTextWidth() const DevicePoint aPos; const GlyphItem* pGlyphItem; - DeviceCoordinate nWidth = 0; + double nWidth = 0; while (GetNextGlyph(&pGlyphItem, aPos, nStart)) nWidth += pGlyphItem->newWidth(); return nWidth; } -DeviceCoordinate MultiSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCharWidths, const OUString& rStr ) const +double MultiSalLayout::FillDXArray( std::vector<double>* pCharWidths, const OUString& rStr ) const { if (pCharWidths) { // prepare merging of fallback levels - std::vector<DeviceCoordinate> aTempWidths; + std::vector<double> aTempWidths; const int nCharCount = mnEndCharPos - mnMinCharPos; pCharWidths->clear(); pCharWidths->resize(nCharCount, 0); @@ -1047,7 +1043,7 @@ DeviceCoordinate MultiSalLayout::FillDXArray( std::vector<DeviceCoordinate>* pCh // one char cannot be resolved from different fallbacks if ((*pCharWidths)[i] != 0) continue; - DeviceCoordinate nCharWidth = aTempWidths[i]; + double nCharWidth = aTempWidths[i]; if (!nCharWidth) continue; (*pCharWidths)[i] = nCharWidth; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 61d965a28b68..81f4aa095840 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -989,14 +989,13 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, KernArray* pKernAr return 0; } -#if VCL_FLOAT_DEVICE_PIXEL - std::unique_ptr<std::vector<DeviceCoordinate>> xDXPixelArray; + std::unique_ptr<std::vector<double>> xDXPixelArray; if(pDXAry) { - xDXPixelArray.reset(new std::vector<DeviceCoordinate>(nLen)); + xDXPixelArray.reset(new std::vector<double>(nLen)); } - std::vector<DeviceCoordinate>* pDXPixelArray = xDXPixelArray.get(); - DeviceCoordinate nWidth = pSalLayout->FillDXArray(pDXPixelArray, bCaret ? rStr : OUString()); + std::vector<double>* pDXPixelArray = xDXPixelArray.get(); + double nWidth = pSalLayout->FillDXArray(pDXPixelArray, bCaret ? rStr : OUString()); // convert virtual char widths to virtual absolute positions if( pDXPixelArray ) @@ -1006,57 +1005,34 @@ tools::Long OutputDevice::GetTextArray( const OUString& rStr, KernArray* pKernAr (*pDXPixelArray)[i] += (*pDXPixelArray)[i - 1]; } } - if( mbMap ) - { - if( pDXPixelArray ) - { - for( int i = 0; i < nLen; ++i ) - { - (*pDXPixelArray)[i] = ImplDevicePixelToLogicWidth((*pDXPixelArray)[i]); - } - } - nWidth = ImplDevicePixelToLogicWidth( nWidth ); - } - if(pDXAry) - { - pDXAry->resize(nLen); - for( int i = 0; i < nLen; ++i ) - { - (*pDXAry)[i] = basegfx::fround((*pDXPixelArray)[i]); - } - } - return basegfx::fround(nWidth); - -#else /* ! VCL_FLOAT_DEVICE_PIXEL */ - - tools::Long nWidth = pSalLayout->FillDXArray( pDXAry, bCaret ? rStr : OUString() ); - - // convert virtual char widths to virtual absolute positions - if( pDXAry ) - for( int i = 1; i < nLen; ++i ) - (*pDXAry)[ i ] += (*pDXAry)[ i-1 ]; // convert from font units to logical units - if (pDXAry) + if (pDXPixelArray) { int nSubPixelFactor = pKernArray->get_factor(); if (mbMap) { for (int i = 0; i < nLen; ++i) - (*pDXAry)[i] = ImplDevicePixelToLogicWidth( (*pDXAry)[i] * nSubPixelFactor ); + (*pDXPixelArray)[i] = ImplDevicePixelToLogicWidth((*pDXPixelArray)[i] * nSubPixelFactor); } else if (nSubPixelFactor) { for (int i = 0; i < nLen; ++i) - (*pDXAry)[i] *= nSubPixelFactor; + (*pDXPixelArray)[i] *= nSubPixelFactor; } } + if (pDXAry) + { + pDXAry->resize(nLen); + for (int i = 0; i < nLen; ++i) + (*pDXAry)[i] = basegfx::fround((*pDXPixelArray)[i]); + } + if (mbMap) nWidth = ImplDevicePixelToLogicWidth( nWidth ); - return nWidth; -#endif /* VCL_FLOAT_DEVICE_PIXEL */ + return basegfx::fround(nWidth); } void OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXArray, |