convert KernArray from sal_Int32 to double
which allows us to eliminate a bunch of rounding at various layers, and consequently maintain a lot more precision Change-Id: I911dedd7c041c1d67396c082e5695346ea689acb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175814 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
ef085d09e0
commit
11b1557147
@ -208,12 +208,7 @@ namespace dxcanvas
|
|||||||
if( rLogicalAdvancements.getLength() )
|
if( rLogicalAdvancements.getLength() )
|
||||||
{
|
{
|
||||||
// create the DXArray
|
// create the DXArray
|
||||||
const sal_Int32 nLen( rLogicalAdvancements.getLength() );
|
KernArraySpan DXArray( rLogicalAdvancements.getConstArray(), rLogicalAdvancements.getLength() );
|
||||||
KernArray DXArray;
|
|
||||||
DXArray.reserve(nLen);
|
|
||||||
for( sal_Int32 i=0; i<nLen; ++i )
|
|
||||||
DXArray.push_back(basegfx::fround(rLogicalAdvancements[i]));
|
|
||||||
|
|
||||||
std::span<const sal_Bool> aKashidaArray(rKashidaPositions.getConstArray(), rKashidaPositions.getLength());
|
std::span<const sal_Bool> aKashidaArray(rKashidaPositions.getConstArray(), rKashidaPositions.getLength());
|
||||||
|
|
||||||
// draw the String
|
// draw the String
|
||||||
|
@ -728,12 +728,7 @@ namespace oglcanvas
|
|||||||
uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements();
|
uno::Sequence<double> aLogicalAdvancements=xLayoutetText->queryLogicalAdvancements();
|
||||||
if( aLogicalAdvancements.hasElements() )
|
if( aLogicalAdvancements.hasElements() )
|
||||||
{
|
{
|
||||||
// create the DXArray
|
KernArraySpan aDXArray(aLogicalAdvancements.getConstArray(), aLogicalAdvancements.getLength());
|
||||||
const sal_Int32 nLen( aLogicalAdvancements.getLength() );
|
|
||||||
KernArray aDXArray;
|
|
||||||
aDXArray.resize(nLen);
|
|
||||||
for( sal_Int32 i=0; i<nLen; ++i )
|
|
||||||
aDXArray.set(i, basegfx::fround(aLogicalAdvancements[i]));
|
|
||||||
|
|
||||||
uno::Sequence<sal_Bool> aKashidaPositions=xLayoutetText->queryKashidaPositions();
|
uno::Sequence<sal_Bool> aKashidaPositions=xLayoutetText->queryKashidaPositions();
|
||||||
std::span<const sal_Bool> aKashidaArray(aKashidaPositions.getConstArray(), aKashidaPositions.getLength());
|
std::span<const sal_Bool> aKashidaArray(aKashidaPositions.getConstArray(), aKashidaPositions.getLength());
|
||||||
|
@ -169,8 +169,6 @@ namespace vclcanvas
|
|||||||
uno::Sequence<double>(4),
|
uno::Sequence<double>(4),
|
||||||
rendering::CompositeOperation::SOURCE);
|
rendering::CompositeOperation::SOURCE);
|
||||||
|
|
||||||
KernArray aOffsets(setupTextOffsets(maLogicalAdvancements, aViewState, aRenderState));
|
|
||||||
|
|
||||||
std::vector< ::tools::Rectangle > aMetricVector;
|
std::vector< ::tools::Rectangle > aMetricVector;
|
||||||
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
|
uno::Sequence<geometry::RealRectangle2D> aBoundingBoxes;
|
||||||
if (pVDev->GetGlyphBoundRects(
|
if (pVDev->GetGlyphBoundRects(
|
||||||
|
@ -204,9 +204,9 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="5957" positionY="12784" sizeX="5792" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=1">
|
<XShape positionX="5958" positionY="12784" sizeX="5791" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=1">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="5957" positionY="12784" sizeX="5792" sizeY="1747" type="com.sun.star.drawing.TextShape" text="Black - The color of night and coffee 28%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="5958" positionY="12784" sizeX="5791" sizeY="1747" type="com.sun.star.drawing.TextShape" text="Black - The color of night and coffee 28%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
||||||
@ -215,14 +215,14 @@
|
|||||||
<LineStart/>
|
<LineStart/>
|
||||||
<LineEnd/>
|
<LineEnd/>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5793.000000" column2="0.000000" column3="5957.000000"/>
|
<Line1 column1="5792.000000" column2="0.000000" column3="5958.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="12784.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="12784.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5793.000000" column2="0.000000" column3="5957.000000"/>
|
<Line1 column1="5792.000000" column2="0.000000" column3="5958.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="12784.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="12784.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
@ -273,9 +273,9 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="16335" positionY="2226" sizeX="5692" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=4">
|
<XShape positionX="16335" positionY="2226" sizeX="5691" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=4">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="16335" positionY="2226" sizeX="5692" sizeY="1747" type="com.sun.star.drawing.TextShape" text="White - The color of milk and purity 14%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="16335" positionY="2226" sizeX="5691" sizeY="1747" type="com.sun.star.drawing.TextShape" text="White - The color of milk and purity 14%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
||||||
@ -284,14 +284,14 @@
|
|||||||
<LineStart/>
|
<LineStart/>
|
||||||
<LineEnd/>
|
<LineEnd/>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5693.000000" column2="0.000000" column3="16335.000000"/>
|
<Line1 column1="5692.000000" column2="0.000000" column3="16335.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="2226.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="2226.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5693.000000" column2="0.000000" column3="16335.000000"/>
|
<Line1 column1="5692.000000" column2="0.000000" column3="16335.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="2226.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="2226.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.GroupShape" name="CID/D=0">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.GroupShape" name="CID/D=0">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="9761" positionY="3821" sizeX="9721" sizeY="9721" type="com.sun.star.drawing.RectangleShape" name="MarkHandles" fontHeight="12.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="9761" positionY="3821" sizeX="9721" sizeY="9721" type="com.sun.star.drawing.RectangleShape" name="MarkHandles" fontHeight="12.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.RectangleShape" name="PlotAreaIncludingAxes" fontHeight="12.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.RectangleShape" name="PlotAreaIncludingAxes" fontHeight="12.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="CENTER" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
||||||
@ -39,12 +39,12 @@
|
|||||||
<LineStart/>
|
<LineStart/>
|
||||||
<LineEnd/>
|
<LineEnd/>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="9761" positionY="3819" sizeX="9721" sizeY="9723" type="com.sun.star.drawing.GroupShape">
|
<XShape positionX="9761" positionY="3819" sizeX="9721" sizeY="9723" type="com.sun.star.drawing.GroupShape">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
@ -175,15 +175,15 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.GroupShape">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="2509" positionY="2808" sizeX="22659" sizeY="11141" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:CT=0:Series=0:DataLabels=">
|
<XShape positionX="2509" positionY="2808" sizeX="22658" sizeY="11141" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:CT=0:Series=0:DataLabels=">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="19461" positionY="9977" sizeX="5707" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0">
|
<XShape positionX="19461" positionY="9977" sizeX="5706" sizeY="1747" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="19461" positionY="9977" sizeX="5707" sizeY="1747" type="com.sun.star.drawing.TextShape" text="Yellow - The color of sun and honey 33%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="19461" positionY="9977" sizeX="5706" sizeY="1747" type="com.sun.star.drawing.TextShape" text="Yellow - The color of sun and honey 33%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5929" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
||||||
@ -192,14 +192,14 @@
|
|||||||
<LineStart/>
|
<LineStart/>
|
||||||
<LineEnd/>
|
<LineEnd/>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5708.000000" column2="0.000000" column3="19461.000000"/>
|
<Line1 column1="5707.000000" column2="0.000000" column3="19461.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="9977.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="9977.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="5708.000000" column2="0.000000" column3="19461.000000"/>
|
<Line1 column1="5707.000000" column2="0.000000" column3="19461.000000"/>
|
||||||
<Line2 column1="0.000000" column2="1748.000000" column3="9977.000000"/>
|
<Line2 column1="0.000000" column2="1748.000000" column3="9977.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
@ -298,35 +298,35 @@
|
|||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="22660.000000" column2="0.000000" column3="2509.000000"/>
|
<Line1 column1="22659.000000" column2="0.000000" column3="2509.000000"/>
|
||||||
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
<Line2 column1="0.000000" column2="11142.000000" column3="2808.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
|
@ -250,9 +250,9 @@
|
|||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
<XShape positionX="5188" positionY="2570" sizeX="4461" sizeY="2329" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=3">
|
<XShape positionX="5189" positionY="2570" sizeX="4460" sizeY="2329" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=3">
|
||||||
<XShapes>
|
<XShapes>
|
||||||
<XShape positionX="5188" positionY="2570" sizeX="4461" sizeY="2329" type="com.sun.star.drawing.TextShape" text="Red - The color of rose and passion 70 19%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5199" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
<XShape positionX="5189" positionY="2570" sizeX="4460" sizeY="2329" type="com.sun.star.drawing.TextShape" text="Red - The color of rose and passion 70 19%" fontHeight="12.000000" fontColor="595959" textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" textLeftDistance="0" textRightDistance="0" textUpperDistance="0" textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="5199" textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
|
||||||
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
|
||||||
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
|
||||||
@ -261,14 +261,14 @@
|
|||||||
<LineStart/>
|
<LineStart/>
|
||||||
<LineEnd/>
|
<LineEnd/>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="4462.000000" column2="0.000000" column3="5188.000000"/>
|
<Line1 column1="4461.000000" column2="0.000000" column3="5189.000000"/>
|
||||||
<Line2 column1="0.000000" column2="2330.000000" column3="2570.000000"/>
|
<Line2 column1="0.000000" column2="2330.000000" column3="2570.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
</XShape>
|
</XShape>
|
||||||
</XShapes>
|
</XShapes>
|
||||||
<Transformation>
|
<Transformation>
|
||||||
<Line1 column1="4462.000000" column2="0.000000" column3="5188.000000"/>
|
<Line1 column1="4461.000000" column2="0.000000" column3="5189.000000"/>
|
||||||
<Line2 column1="0.000000" column2="2330.000000" column3="2570.000000"/>
|
<Line2 column1="0.000000" column2="2330.000000" column3="2570.000000"/>
|
||||||
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
|
||||||
</Transformation>
|
</Transformation>
|
||||||
|
@ -129,8 +129,8 @@ CPPUNIT_TEST_FIXTURE(CanvasTest, testTdf155810)
|
|||||||
pDev->GetTextArray(aText, &aDXArray);
|
pDev->GetTextArray(aText, &aDXArray);
|
||||||
|
|
||||||
auto nKashida = 200;
|
auto nKashida = 200;
|
||||||
aDXArray.set(0, aDXArray[0] + nKashida);
|
aDXArray[0] += nKashida;
|
||||||
aDXArray.set(2, aDXArray[2] + nKashida);
|
aDXArray[2] += nKashida;
|
||||||
aKashidaArray = { true, false, true, false };
|
aKashidaArray = { true, false, true, false };
|
||||||
|
|
||||||
pDev->DrawTextArray(Point(0, 0), aText, aDXArray, aKashidaArray, 0, -1);
|
pDev->DrawTextArray(Point(0, 0), aText, aDXArray, aKashidaArray, 0, -1);
|
||||||
|
@ -991,15 +991,8 @@ namespace cppcanvas::internal
|
|||||||
nStrikeoutWidth += nInterval;
|
nStrikeoutWidth += nInterval;
|
||||||
KernArray aStrikeoutCharWidths;
|
KernArray aStrikeoutCharWidths;
|
||||||
|
|
||||||
for ( int i = 0;i<nLen; i++)
|
for ( int i = 0;i< nLen; i++ )
|
||||||
{
|
aStrikeoutCharWidths.push_back(nStrikeoutWidth * (i + 1));
|
||||||
aStrikeoutCharWidths.push_back(nStrikeoutWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( int i = 1;i< nLen; i++ )
|
|
||||||
{
|
|
||||||
aStrikeoutCharWidths.adjust(i, aStrikeoutCharWidths[i - 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
pStrikeoutTextAction =
|
pStrikeoutTextAction =
|
||||||
TextActionFactory::createTextAction(
|
TextActionFactory::createTextAction(
|
||||||
@ -2566,7 +2559,7 @@ namespace cppcanvas::internal
|
|||||||
rVDev.GetTextArray( pAct->GetText(), &aDXArray,
|
rVDev.GetTextArray( pAct->GetText(), &aDXArray,
|
||||||
pAct->GetIndex(), pAct->GetLen() );
|
pAct->GetIndex(), pAct->GetLen() );
|
||||||
|
|
||||||
const sal_Int32 nWidthDifference( pAct->GetWidth() - aDXArray[ nLen-1 ] );
|
const double nWidthDifferencePerDx = ( pAct->GetWidth() - aDXArray[ nLen-1 ] ) / nLen;
|
||||||
|
|
||||||
// Last entry of pDXArray contains total width of the text
|
// Last entry of pDXArray contains total width of the text
|
||||||
for (sal_Int32 i = 1; i <= nLen; ++i)
|
for (sal_Int32 i = 1; i <= nLen; ++i)
|
||||||
@ -2577,7 +2570,7 @@ namespace cppcanvas::internal
|
|||||||
// entry represents the 'end' position of
|
// entry represents the 'end' position of
|
||||||
// the corresponding character, thus, we
|
// the corresponding character, thus, we
|
||||||
// let i run from 1 to nLen.
|
// let i run from 1 to nLen.
|
||||||
aDXArray.adjust(i - 1, i * nWidthDifference / nLen);
|
aDXArray[i - 1] += i * nWidthDifferencePerDx;
|
||||||
}
|
}
|
||||||
|
|
||||||
createTextAction(
|
createTextAction(
|
||||||
|
@ -2982,7 +2982,7 @@ void DesktopLOKTest::testTextSelectionHandles()
|
|||||||
CPPUNIT_ASSERT_EQUAL(aText, OString(pText));
|
CPPUNIT_ASSERT_EQUAL(aText, OString(pText));
|
||||||
free(pText);
|
free(pText);
|
||||||
CPPUNIT_ASSERT_EQUAL("1418, 1418, 0, 275"_ostr, m_aTextSelectionStart);
|
CPPUNIT_ASSERT_EQUAL("1418, 1418, 0, 275"_ostr, m_aTextSelectionStart);
|
||||||
CPPUNIT_ASSERT_EQUAL("1898, 1418, 0, 275"_ostr, m_aTextSelectionEnd);
|
CPPUNIT_ASSERT_EQUAL("1897, 1418, 0, 275"_ostr, m_aTextSelectionEnd);
|
||||||
|
|
||||||
// deselect & check
|
// deselect & check
|
||||||
m_aTextSelectionStart = ""_ostr;
|
m_aTextSelectionStart = ""_ostr;
|
||||||
@ -3003,7 +3003,7 @@ void DesktopLOKTest::testTextSelectionHandles()
|
|||||||
CPPUNIT_ASSERT_EQUAL(aText, OString(pText));
|
CPPUNIT_ASSERT_EQUAL(aText, OString(pText));
|
||||||
free(pText);
|
free(pText);
|
||||||
CPPUNIT_ASSERT_EQUAL("1418, 1418, 0, 275"_ostr, m_aTextSelectionStart);
|
CPPUNIT_ASSERT_EQUAL("1418, 1418, 0, 275"_ostr, m_aTextSelectionStart);
|
||||||
CPPUNIT_ASSERT_EQUAL("1898, 1418, 0, 275"_ostr, m_aTextSelectionEnd);
|
CPPUNIT_ASSERT_EQUAL("1897, 1418, 0, 275"_ostr, m_aTextSelectionEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopLOKTest::testDialogPaste()
|
void DesktopLOKTest::testDialogPaste()
|
||||||
|
@ -274,13 +274,8 @@ void TextLayouterDevice::getTextOutlines(basegfx::B2DPolyPolygonVector& rB2DPoly
|
|||||||
OSL_ENSURE(nDXArrayCount == nTextLength,
|
OSL_ENSURE(nDXArrayCount == nTextLength,
|
||||||
"DXArray size does not correspond to text portion size (!)");
|
"DXArray size does not correspond to text portion size (!)");
|
||||||
|
|
||||||
KernArray aIntegerDXArray;
|
mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, 0, rDXArray,
|
||||||
aIntegerDXArray.reserve(nDXArrayCount);
|
rKashidaArray);
|
||||||
for (sal_uInt32 a(0); a < nDXArrayCount; a++)
|
|
||||||
aIntegerDXArray.push_back(basegfx::fround(rDXArray[a]));
|
|
||||||
|
|
||||||
mrDevice.GetTextOutlines(rB2DPolyPolyVector, rText, nIndex, nIndex, nLength, 0,
|
|
||||||
aIntegerDXArray, rKashidaArray);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -374,8 +369,7 @@ TextLayouterDevice::getSalLayout(const OUString& rText, sal_uInt32 nIndex, sal_u
|
|||||||
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(&mrDevice, rText, nIndex, nLength));
|
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(&mrDevice, rText, nIndex, nLength));
|
||||||
const Point aStartPoint(basegfx::fround<tools::Long>(rStartPoint.getX()),
|
const Point aStartPoint(basegfx::fround<tools::Long>(rStartPoint.getX()),
|
||||||
basegfx::fround<tools::Long>(rStartPoint.getY()));
|
basegfx::fround<tools::Long>(rStartPoint.getY()));
|
||||||
KernArraySpan aKernArraySpan(rDXArray);
|
return mrDevice.ImplLayout(rText, nIndex, nLength, aStartPoint, 0, rDXArray, pKashidaAry,
|
||||||
return mrDevice.ImplLayout(rText, nIndex, nLength, aStartPoint, 0, aKernArraySpan, pKashidaAry,
|
|
||||||
SalLayoutFlags::NONE, nullptr, pGlyphs);
|
SalLayoutFlags::NONE, nullptr, pGlyphs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,22 +353,14 @@ void TextSimplePortionPrimitive2D::createTextLayouter(TextLayouterDevice& rTextL
|
|||||||
std::unique_ptr<SalLayout>
|
std::unique_ptr<SalLayout>
|
||||||
TextSimplePortionPrimitive2D::createSalLayout(TextLayouterDevice& rTextLayouter) const
|
TextSimplePortionPrimitive2D::createSalLayout(TextLayouterDevice& rTextLayouter) const
|
||||||
{
|
{
|
||||||
// create integer DXArray. As mentioned above we can act in the
|
// As mentioned above we can act in the
|
||||||
// Text's local coordinate system without transformation at all
|
// Text's local coordinate system without transformation at all
|
||||||
const ::std::vector<double>& rDXArray(getDXArray());
|
const ::std::vector<double>& rDXArray(getDXArray());
|
||||||
KernArray aDXArray;
|
|
||||||
|
|
||||||
if (!rDXArray.empty())
|
|
||||||
{
|
|
||||||
aDXArray.reserve(rDXArray.size());
|
|
||||||
for (auto const& elem : rDXArray)
|
|
||||||
aDXArray.push_back(basegfx::fround(elem));
|
|
||||||
}
|
|
||||||
|
|
||||||
// create SalLayout. No need for a position, as mentioned text can work
|
// create SalLayout. No need for a position, as mentioned text can work
|
||||||
// without transformations, so start point is always 0,0
|
// without transformations, so start point is always 0,0
|
||||||
return rTextLayouter.getSalLayout(getText(), getTextPosition(), getTextLength(),
|
return rTextLayouter.getSalLayout(getText(), getTextPosition(), getTextLength(),
|
||||||
basegfx::B2DPoint(0.0, 0.0), aDXArray, getKashidaArray());
|
basegfx::B2DPoint(0.0, 0.0), rDXArray, getKashidaArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
// provide unique ID
|
// provide unique ID
|
||||||
|
@ -309,7 +309,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
|
|||||||
|
|
||||||
aDXArray.reserve(rTextCandidate.getDXArray().size());
|
aDXArray.reserve(rTextCandidate.getDXArray().size());
|
||||||
for (auto const& elem : rTextCandidate.getDXArray())
|
for (auto const& elem : rTextCandidate.getDXArray())
|
||||||
aDXArray.push_back(basegfx::fround(elem * fPixelVectorFactor));
|
aDXArray.push_back(elem * fPixelVectorFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set parameters and paint text snippet
|
// set parameters and paint text snippet
|
||||||
|
@ -22,16 +22,14 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sal/types.h>
|
#include <sal/types.h>
|
||||||
#include <tools/gen.hxx>
|
#include <tools/gen.hxx>
|
||||||
|
#include <vcl/kernarray.hxx>
|
||||||
|
|
||||||
class ParaPortion;
|
class ParaPortion;
|
||||||
|
|
||||||
class EditLine
|
class EditLine
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
typedef std::vector<sal_Int32> CharPosArrayType;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CharPosArrayType maPositions;
|
KernArray maPositions;
|
||||||
std::vector<sal_Bool> maKashidaPositions;
|
std::vector<sal_Bool> maKashidaPositions;
|
||||||
sal_Int32 mnTextWidth = 0;
|
sal_Int32 mnTextWidth = 0;
|
||||||
sal_Int32 mnStartPosX = 0;
|
sal_Int32 mnStartPosX = 0;
|
||||||
@ -111,8 +109,8 @@ public:
|
|||||||
|
|
||||||
bool IsEmpty() const { return mnEnd <= mnStart; }
|
bool IsEmpty() const { return mnEnd <= mnStart; }
|
||||||
|
|
||||||
CharPosArrayType& GetCharPosArray() { return maPositions; }
|
KernArray& GetCharPosArray() { return maPositions; }
|
||||||
const CharPosArrayType& GetCharPosArray() const { return maPositions; }
|
const KernArray& GetCharPosArray() const { return maPositions; }
|
||||||
|
|
||||||
std::vector<sal_Bool>& GetKashidaArray() { return maKashidaPositions; }
|
std::vector<sal_Bool>& GetKashidaArray() { return maKashidaPositions; }
|
||||||
const std::vector<sal_Bool>& GetKashidaArray() const { return maKashidaPositions; }
|
const std::vector<sal_Bool>& GetKashidaArray() const { return maKashidaPositions; }
|
||||||
|
@ -71,14 +71,14 @@ struct ExtraPortionInfo
|
|||||||
bool bFirstCharIsRightPunktuation = false;
|
bool bFirstCharIsRightPunktuation = false;
|
||||||
bool bCompressed = false;
|
bool bCompressed = false;
|
||||||
|
|
||||||
std::unique_ptr<sal_Int32[]> pOrgDXArray;
|
std::unique_ptr<double[]> pOrgDXArray;
|
||||||
std::vector<sal_Int32> lineBreaksList;
|
std::vector<sal_Int32> lineBreaksList;
|
||||||
|
|
||||||
void SaveOrgDXArray(const sal_Int32* pDXArray, sal_Int32 nLen)
|
void SaveOrgDXArray(const double* pDXArray, sal_Int32 nLen)
|
||||||
{
|
{
|
||||||
if (pDXArray)
|
if (pDXArray)
|
||||||
{
|
{
|
||||||
pOrgDXArray.reset(new sal_Int32[nLen]);
|
pOrgDXArray.reset(new double[nLen]);
|
||||||
memcpy(pOrgDXArray.get(), pDXArray, nLen * sizeof(sal_Int32));
|
memcpy(pOrgDXArray.get(), pDXArray, nLen * sizeof(sal_Int32));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ) override;
|
virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ) override;
|
||||||
|
|
||||||
virtual void DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart,
|
virtual void DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart,
|
||||||
sal_Int32 nTextLen, std::span<const sal_Int32> pDXArray,
|
sal_Int32 nTextLen, KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray, const SvxFont& rFont,
|
std::span<const sal_Bool> pKashidaArray, const SvxFont& rFont,
|
||||||
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
||||||
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
||||||
|
@ -2140,12 +2140,12 @@ void Test::testCreateLines()
|
|||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rLine.GetStart());
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rLine.GetStart());
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rLine.GetEnd());
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rLine.GetEnd());
|
||||||
|
|
||||||
std::vector<sal_Int32> const& rArray = rLine.GetCharPosArray();
|
KernArray const& rArray = rLine.GetCharPosArray();
|
||||||
CPPUNIT_ASSERT_EQUAL(size_t(3), rArray.size());
|
CPPUNIT_ASSERT_EQUAL(size_t(3), rArray.size());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(173), rArray[0]);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(173), sal_Int32(rArray[0]));
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(333), rArray[1]);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(333), sal_Int32(rArray[1]));
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(493), rArray[2]);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(493), sal_Int32(rArray[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1582,7 +1582,7 @@ EditEngine::CreateTransferable(const ESelection& rSelection)
|
|||||||
// ====================== Virtual Methods ========================
|
// ====================== Virtual Methods ========================
|
||||||
|
|
||||||
void EditEngine::DrawingText( const Point&, const OUString&, sal_Int32, sal_Int32,
|
void EditEngine::DrawingText( const Point&, const OUString&, sal_Int32, sal_Int32,
|
||||||
std::span<const sal_Int32>, std::span<const sal_Bool>,
|
KernArraySpan, std::span<const sal_Bool>,
|
||||||
const SvxFont&, sal_Int32 /*nPara*/, sal_uInt8 /*nRightToLeft*/,
|
const SvxFont&, sal_Int32 /*nPara*/, sal_uInt8 /*nRightToLeft*/,
|
||||||
const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool,
|
const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool,
|
||||||
const css::lang::Locale*, const Color&, const Color&)
|
const css::lang::Locale*, const Color&, const Color&)
|
||||||
|
@ -758,7 +758,7 @@ private:
|
|||||||
bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const;
|
bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const;
|
||||||
|
|
||||||
bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos,
|
bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos,
|
||||||
sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray );
|
double* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray );
|
||||||
void ImplExpandCompressedPortions(EditLine& rLine, ParaPortion& rParaPortion, tools::Long nRemainingWidth);
|
void ImplExpandCompressedPortions(EditLine& rLine, ParaPortion& rParaPortion, tools::Long nRemainingWidth);
|
||||||
|
|
||||||
void ImplInitLayoutMode(OutputDevice& rOutDev, sal_Int32 nPara, sal_Int32 nIndex);
|
void ImplInitLayoutMode(OutputDevice& rOutDev, sal_Int32 nPara, sal_Int32 nIndex);
|
||||||
|
@ -4439,7 +4439,7 @@ tools::Long ImpEditEngine::GetXPos(ParaPortion const& rParaPortion, EditLine con
|
|||||||
if ( nType == AsianCompressionFlags::PunctuationRight && !rLine.GetCharPosArray().empty() )
|
if ( nType == AsianCompressionFlags::PunctuationRight && !rLine.GetCharPosArray().empty() )
|
||||||
{
|
{
|
||||||
sal_Int32 n = nIndex - nTextPortionStart;
|
sal_Int32 n = nIndex - nTextPortionStart;
|
||||||
const sal_Int32* pDXArray = rLine.GetCharPosArray().data() + (nTextPortionStart - rLine.GetStart());
|
const double* pDXArray = rLine.GetCharPosArray().data() + (nTextPortionStart - rLine.GetStart());
|
||||||
sal_Int32 nCharWidth = ( ( (n+1) < rPortion.GetLen() ) ? pDXArray[n] : rPortion.GetSize().Width() )
|
sal_Int32 nCharWidth = ( ( (n+1) < rPortion.GetLen() ) ? pDXArray[n] : rPortion.GetSize().Width() )
|
||||||
- ( n ? pDXArray[n-1] : 0 );
|
- ( n ? pDXArray[n-1] : 0 );
|
||||||
if ( (n+1) < rPortion.GetLen() )
|
if ( (n+1) < rPortion.GetLen() )
|
||||||
|
@ -153,7 +153,7 @@ static void lcl_DrawRedLines( OutputDevice& rOutDev,
|
|||||||
const Point& rPoint,
|
const Point& rPoint,
|
||||||
size_t nIndex,
|
size_t nIndex,
|
||||||
size_t nMaxEnd,
|
size_t nMaxEnd,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
WrongList const * pWrongs,
|
WrongList const * pWrongs,
|
||||||
Degree10 nOrientation,
|
Degree10 nOrientation,
|
||||||
const Point& rOrigin,
|
const Point& rOrigin,
|
||||||
@ -1051,7 +1051,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
bEOL = true;
|
bEOL = true;
|
||||||
bBrokenLine = true;
|
bBrokenLine = true;
|
||||||
}
|
}
|
||||||
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
|
KernArray& rArray = pLine->GetCharPosArray();
|
||||||
size_t nPos = nTmpPos - pLine->GetStart();
|
size_t nPos = nTmpPos - pLine->GetStart();
|
||||||
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
||||||
bCompressedChars = false;
|
bCompressedChars = false;
|
||||||
@ -1065,7 +1065,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
bLineBreak = true;
|
bLineBreak = true;
|
||||||
pPortion->SetKind( PortionKind::LINEBREAK );
|
pPortion->SetKind( PortionKind::LINEBREAK );
|
||||||
bCompressedChars = false;
|
bCompressedChars = false;
|
||||||
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
|
KernArray& rArray = pLine->GetCharPosArray();
|
||||||
size_t nPos = nTmpPos - pLine->GetStart();
|
size_t nPos = nTmpPos - pLine->GetStart();
|
||||||
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
||||||
}
|
}
|
||||||
@ -1179,7 +1179,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nTmpWidth += pPortion->GetSize().Width();
|
nTmpWidth += pPortion->GetSize().Width();
|
||||||
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
|
KernArray& rArray = pLine->GetCharPosArray();
|
||||||
size_t nPos = nTmpPos - pLine->GetStart();
|
size_t nPos = nTmpPos - pLine->GetStart();
|
||||||
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
rArray.insert(rArray.begin()+nPos, pPortion->GetSize().Width());
|
||||||
pPortion->SetKind(PortionKind::FIELD);
|
pPortion->SetKind(PortionKind::FIELD);
|
||||||
@ -1233,15 +1233,13 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
// The array is generally flattened at the beginning
|
// The array is generally flattened at the beginning
|
||||||
// => Always simply quick inserts.
|
// => Always simply quick inserts.
|
||||||
size_t nPos = nTmpPos - pLine->GetStart();
|
size_t nPos = nTmpPos - pLine->GetStart();
|
||||||
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
|
KernArray& rArray = pLine->GetCharPosArray();
|
||||||
assert(aCharPositionArray.get_factor() == 1);
|
rArray.insert( rArray.begin() + nPos, aCharPositionArray.data(), aCharPositionArray.data() + nPortionLen);
|
||||||
std::vector<sal_Int32>& rKernArray = aCharPositionArray.get_subunit_array();
|
|
||||||
rArray.insert( rArray.begin() + nPos, rKernArray.data(), rKernArray.data() + nPortionLen);
|
|
||||||
|
|
||||||
// And now check for Compression:
|
// And now check for Compression:
|
||||||
if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() != CharCompressType::NONE )
|
if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() != CharCompressType::NONE )
|
||||||
{
|
{
|
||||||
sal_Int32* pDXArray = rArray.data() + nTmpPos - pLine->GetStart();
|
double* pDXArray = rArray.data() + nTmpPos - pLine->GetStart();
|
||||||
bCompressedChars |= ImplCalcAsianCompression(
|
bCompressedChars |= ImplCalcAsianCompression(
|
||||||
pNode, pPortion, nTmpPos, pDXArray, 10000, false);
|
pNode, pPortion, nTmpPos, pDXArray, 10000, false);
|
||||||
}
|
}
|
||||||
@ -1435,7 +1433,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
|
if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed )
|
||||||
{
|
{
|
||||||
// I need the manipulated DXArray for determining the break position...
|
// I need the manipulated DXArray for determining the break position...
|
||||||
sal_Int32* pDXArray = pLine->GetCharPosArray().data() + (nPortionStart - pLine->GetStart());
|
double* pDXArray = pLine->GetCharPosArray().data() + (nPortionStart - pLine->GetStart());
|
||||||
ImplCalcAsianCompression(
|
ImplCalcAsianCompression(
|
||||||
pNode, pPortion, nPortionStart, pDXArray, 10000, true);
|
pNode, pPortion, nPortionStart, pDXArray, 10000, true);
|
||||||
}
|
}
|
||||||
@ -1648,7 +1646,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
|
|||||||
|
|
||||||
// If a portion was wrapped there may be far too many positions in
|
// If a portion was wrapped there may be far too many positions in
|
||||||
// CharPosArray:
|
// CharPosArray:
|
||||||
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
|
KernArray& rArray = pLine->GetCharPosArray();
|
||||||
size_t nLen = pLine->GetLen();
|
size_t nLen = pLine->GetLen();
|
||||||
if (rArray.size() > nLen)
|
if (rArray.size() > nLen)
|
||||||
rArray.erase(rArray.begin()+nLen, rArray.end());
|
rArray.erase(rArray.begin()+nLen, rArray.end());
|
||||||
@ -3477,7 +3475,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
|
|||||||
OUString aText;
|
OUString aText;
|
||||||
sal_Int32 nTextStart = 0;
|
sal_Int32 nTextStart = 0;
|
||||||
sal_Int32 nTextLen = 0;
|
sal_Int32 nTextLen = 0;
|
||||||
std::span<const sal_Int32> pDXArray;
|
KernArraySpan pDXArray;
|
||||||
std::span<const sal_Bool> pKashidaArray;
|
std::span<const sal_Bool> pKashidaArray;
|
||||||
KernArray aTmpDXArray;
|
KernArray aTmpDXArray;
|
||||||
|
|
||||||
@ -3486,7 +3484,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
|
|||||||
aText = rParaPortion.GetNode()->GetString();
|
aText = rParaPortion.GetNode()->GetString();
|
||||||
nTextStart = nIndex;
|
nTextStart = nIndex;
|
||||||
nTextLen = rTextPortion.GetLen();
|
nTextLen = rTextPortion.GetLen();
|
||||||
pDXArray = std::span(pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart()),
|
pDXArray = KernArraySpan(pLine->GetCharPosArray().data() + (nIndex - pLine->GetStart()),
|
||||||
pLine->GetCharPosArray().size() - (nIndex - pLine->GetStart()));
|
pLine->GetCharPosArray().size() - (nIndex - pLine->GetStart()));
|
||||||
|
|
||||||
if (!pLine->GetKashidaArray().empty())
|
if (!pLine->GetKashidaArray().empty())
|
||||||
@ -3647,9 +3645,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
|
|||||||
aTmpFont.SetPhysFont(*GetRefDevice());
|
aTmpFont.SetPhysFont(*GetRefDevice());
|
||||||
aTmpFont.QuickGetTextSize( GetRefDevice(), aText, nTextStart, nTextLen,
|
aTmpFont.QuickGetTextSize( GetRefDevice(), aText, nTextStart, nTextLen,
|
||||||
&aTmpDXArray );
|
&aTmpDXArray );
|
||||||
assert(aTmpDXArray.get_factor() == 1);
|
pDXArray = KernArraySpan(aTmpDXArray);
|
||||||
std::vector<sal_Int32>& rKernArray = aTmpDXArray.get_subunit_array();
|
|
||||||
pDXArray = rKernArray;
|
|
||||||
|
|
||||||
// add a meta file comment if we record to a metafile
|
// add a meta file comment if we record to a metafile
|
||||||
if( bMetafileValid )
|
if( bMetafileValid )
|
||||||
@ -3676,9 +3672,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
|
|||||||
aTmpFont.SetPhysFont(*GetRefDevice());
|
aTmpFont.SetPhysFont(*GetRefDevice());
|
||||||
aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.getLength(),
|
aTmpFont.QuickGetTextSize( GetRefDevice(), aText, 0, aText.getLength(),
|
||||||
&aTmpDXArray );
|
&aTmpDXArray );
|
||||||
assert(aTmpDXArray.get_factor() == 1);
|
pDXArray = aTmpDXArray;
|
||||||
std::vector<sal_Int32>& rKernArray = aTmpDXArray.get_subunit_array();
|
|
||||||
pDXArray = rKernArray;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tools::Long nTxtWidth = rTextPortion.GetSize().Width();
|
tools::Long nTxtWidth = rTextPortion.GetSize().Width();
|
||||||
@ -4792,7 +4786,7 @@ Color ImpEditEngine::GetAutoColor() const
|
|||||||
|
|
||||||
bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
|
bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
|
||||||
TextPortion* pTextPortion, sal_Int32 nStartPos,
|
TextPortion* pTextPortion, sal_Int32 nStartPos,
|
||||||
sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax,
|
double* pDXArray, sal_uInt16 n100thPercentFromMax,
|
||||||
bool bManipulateDXArray)
|
bool bManipulateDXArray)
|
||||||
{
|
{
|
||||||
DBG_ASSERT( GetAsianCompressionMode() != CharCompressType::NONE, "ImplCalcAsianCompression - Why?" );
|
DBG_ASSERT( GetAsianCompressionMode() != CharCompressType::NONE, "ImplCalcAsianCompression - Why?" );
|
||||||
@ -4960,7 +4954,7 @@ void ImpEditEngine::ImplExpandCompressedPortions(EditLine& rLine, ParaPortion& r
|
|||||||
sal_Int32 nTxtPortion = rParaPortion.GetTextPortions().GetPos( pTP );
|
sal_Int32 nTxtPortion = rParaPortion.GetTextPortions().GetPos( pTP );
|
||||||
sal_Int32 nTxtPortionStart = rParaPortion.GetTextPortions().GetStartPos( nTxtPortion );
|
sal_Int32 nTxtPortionStart = rParaPortion.GetTextPortions().GetStartPos( nTxtPortion );
|
||||||
DBG_ASSERT( nTxtPortionStart >= rLine.GetStart(), "Portion doesn't belong to the line!!!" );
|
DBG_ASSERT( nTxtPortionStart >= rLine.GetStart(), "Portion doesn't belong to the line!!!" );
|
||||||
sal_Int32* pDXArray = rLine.GetCharPosArray().data() + (nTxtPortionStart - rLine.GetStart());
|
double* pDXArray = rLine.GetCharPosArray().data() + (nTxtPortionStart - rLine.GetStart());
|
||||||
if ( pTP->GetExtraInfos()->pOrgDXArray )
|
if ( pTP->GetExtraInfos()->pOrgDXArray )
|
||||||
memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), (pTP->GetLen()-1)*sizeof(sal_Int32) );
|
memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), (pTP->GetLen()-1)*sizeof(sal_Int32) );
|
||||||
ImplCalcAsianCompression( rParaPortion.GetNode(), pTP, nTxtPortionStart, pDXArray, static_cast<sal_uInt16>(nCompressPercent), true );
|
ImplCalcAsianCompression( rParaPortion.GetNode(), pTP, nTxtPortionStart, pDXArray, static_cast<sal_uInt16>(nCompressPercent), true );
|
||||||
|
@ -480,10 +480,10 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
|
|||||||
|
|
||||||
if( IsFixKerning() && ( nLen > 1 ) && !bStacked)
|
if( IsFixKerning() && ( nLen > 1 ) && !bStacked)
|
||||||
{
|
{
|
||||||
auto nKern = GetFixKerning();
|
short nKern = GetFixKerning();
|
||||||
tools::Long nOldValue = (*pDXArray)[0];
|
double nOldValue = (*pDXArray)[0];
|
||||||
tools::Long nSpaceSum = nKern;
|
tools::Long nSpaceSum = nKern;
|
||||||
pDXArray->adjust(0, nSpaceSum);
|
(*pDXArray)[0] += nSpaceSum;
|
||||||
|
|
||||||
for ( sal_Int32 i = 1; i < nLen; i++ )
|
for ( sal_Int32 i = 1; i < nLen; i++ )
|
||||||
{
|
{
|
||||||
@ -492,14 +492,14 @@ Size SvxFont::QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
|
|||||||
nOldValue = (*pDXArray)[i];
|
nOldValue = (*pDXArray)[i];
|
||||||
nSpaceSum += nKern;
|
nSpaceSum += nKern;
|
||||||
}
|
}
|
||||||
pDXArray->adjust(i, nSpaceSum);
|
(*pDXArray)[i] += nSpaceSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last one is a nKern too big:
|
// The last one is a nKern too big:
|
||||||
nOldValue = (*pDXArray)[nLen - 1];
|
nOldValue = (*pDXArray)[nLen - 1];
|
||||||
tools::Long nNewValue = nOldValue - nKern;
|
double nNewValue = nOldValue - nKern;
|
||||||
for ( sal_Int32 i = nLen - 1; i >= 0 && (*pDXArray)[i] == nOldValue; --i)
|
for ( sal_Int32 i = nLen - 1; i >= 0 && (*pDXArray)[i] == nOldValue; --i)
|
||||||
pDXArray->set(i, nNewValue);
|
(*pDXArray)[i] = nNewValue;
|
||||||
|
|
||||||
aTxtSize.AdjustWidth(nSpaceSum - nKern);
|
aTxtSize.AdjustWidth(nSpaceSum - nKern);
|
||||||
}
|
}
|
||||||
@ -525,7 +525,7 @@ Size SvxFont::GetTextSize(const OutputDevice& rOut, const OUString &rTxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void DrawTextArray( OutputDevice* pOut, const Point& rStartPt, const OUString& rStr,
|
static void DrawTextArray( OutputDevice* pOut, const Point& rStartPt, const OUString& rStr,
|
||||||
std::span<const sal_Int32> pDXAry,
|
KernArraySpan pDXAry,
|
||||||
std::span<const sal_Bool> pKashidaAry,
|
std::span<const sal_Bool> pKashidaAry,
|
||||||
sal_Int32 nIndex, sal_Int32 nLen )
|
sal_Int32 nIndex, sal_Int32 nLen )
|
||||||
{
|
{
|
||||||
@ -536,7 +536,7 @@ static void DrawTextArray( OutputDevice* pOut, const Point& rStartPt, const OUSt
|
|||||||
void SvxFont::QuickDrawText( OutputDevice *pOut,
|
void SvxFont::QuickDrawText( OutputDevice *pOut,
|
||||||
const Point &rPos, const OUString &rTxt,
|
const Point &rPos, const OUString &rTxt,
|
||||||
const sal_Int32 nIdx, const sal_Int32 nLen,
|
const sal_Int32 nIdx, const sal_Int32 nLen,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray) const
|
std::span<const sal_Bool> pKashidaArray) const
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -728,14 +728,11 @@ void SvxDoGetCapitalSize::Do( const OUString &_rTxt, const sal_Int32 _nIdx,
|
|||||||
KernArray aKernArray;
|
KernArray aKernArray;
|
||||||
aPartSize.setWidth(basegfx::fround<tools::Long>(
|
aPartSize.setWidth(basegfx::fround<tools::Long>(
|
||||||
pOut->GetTextArray(_rTxt, &aKernArray, _nIdx, _nLen).nWidth));
|
pOut->GetTextArray(_rTxt, &aKernArray, _nIdx, _nLen).nWidth));
|
||||||
assert(pDXAry->get_factor() == aKernArray.get_factor());
|
double nStart = pDXAry->empty() ? 0 : pDXAry->back();
|
||||||
auto& dest = pDXAry->get_subunit_array();
|
|
||||||
sal_Int32 nStart = dest.empty() ? 0 : dest.back();
|
|
||||||
size_t nSrcLen = aKernArray.size();
|
size_t nSrcLen = aKernArray.size();
|
||||||
dest.reserve(dest.size() + nSrcLen);
|
pDXAry->reserve(pDXAry->size() + nSrcLen);
|
||||||
const auto& src = aKernArray.get_subunit_array();
|
|
||||||
for (size_t i = 0; i < nSrcLen; ++i)
|
for (size_t i = 0; i < nSrcLen; ++i)
|
||||||
dest.push_back(src[i] + nStart);
|
(*pDXAry).push_back(aKernArray[i] + nStart);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -782,11 +779,11 @@ protected:
|
|||||||
Point aPos;
|
Point aPos;
|
||||||
Point aSpacePos;
|
Point aSpacePos;
|
||||||
short nKern;
|
short nKern;
|
||||||
std::span<const sal_Int32> pDXArray;
|
KernArraySpan pDXArray;
|
||||||
std::span<const sal_Bool> pKashidaArray;
|
std::span<const sal_Bool> pKashidaArray;
|
||||||
public:
|
public:
|
||||||
SvxDoDrawCapital( SvxFont *pFnt, OutputDevice *_pOut, const OUString &_rTxt,
|
SvxDoDrawCapital( SvxFont *pFnt, OutputDevice *_pOut, const OUString &_rTxt,
|
||||||
std::span<const sal_Int32> _pDXArray,
|
KernArraySpan _pDXArray,
|
||||||
std::span<const sal_Bool> _pKashidaArray,
|
std::span<const sal_Bool> _pKashidaArray,
|
||||||
const sal_Int32 _nIdx, const sal_Int32 _nLen,
|
const sal_Int32 _nIdx, const sal_Int32 _nLen,
|
||||||
const Point &rPos, const short nKrn )
|
const Point &rPos, const short nKrn )
|
||||||
@ -872,10 +869,10 @@ void SvxDoDrawCapital::Do( const OUString &_rTxt, const sal_Int32 nSpanIdx,
|
|||||||
|
|
||||||
Point aStartPos(aPos.X() + nStartX, aPos.Y());
|
Point aStartPos(aPos.X() + nStartX, aPos.Y());
|
||||||
|
|
||||||
std::vector<sal_Int32> aDXArray;
|
KernArray aDXArray;
|
||||||
aDXArray.reserve(nSpanLen);
|
aDXArray.resize(nSpanLen);
|
||||||
for (sal_Int32 i = 0; i < nSpanLen; ++i)
|
for (sal_Int32 i = 0; i < nSpanLen; ++i)
|
||||||
aDXArray.push_back(pDXArray[nStartOffset + i] - nStartX);
|
aDXArray[i] = pDXArray[nStartOffset + i] - nStartX;
|
||||||
|
|
||||||
auto aKashidaArray = !pKashidaArray.empty() ?
|
auto aKashidaArray = !pKashidaArray.empty() ?
|
||||||
std::span<const sal_Bool>(pKashidaArray.data() + nStartOffset, nSpanLen) :
|
std::span<const sal_Bool>(pKashidaArray.data() + nStartOffset, nSpanLen) :
|
||||||
@ -901,7 +898,7 @@ void SvxDoDrawCapital::Do( const OUString &_rTxt, const sal_Int32 nSpanIdx,
|
|||||||
|
|
||||||
void SvxFont::DrawCapital( OutputDevice *pOut,
|
void SvxFont::DrawCapital( OutputDevice *pOut,
|
||||||
const Point &rPos, const OUString &rTxt,
|
const Point &rPos, const OUString &rTxt,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray,
|
std::span<const sal_Bool> pKashidaArray,
|
||||||
const sal_Int32 nIdx, const sal_Int32 nLen ) const
|
const sal_Int32 nIdx, const sal_Int32 nLen ) const
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen,
|
void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen,
|
||||||
std::span<const sal_Int32> pDXArray, std::span<const sal_Bool> pKashidaArray,
|
KernArraySpan pDXArray, std::span<const sal_Bool> pKashidaArray,
|
||||||
const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
||||||
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
||||||
const SvxFieldData* pFieldData,
|
const SvxFieldData* pFieldData,
|
||||||
|
@ -967,8 +967,7 @@ void Outliner::PaintBullet(sal_Int32 nPara, const Point& rStartPos, const Point&
|
|||||||
aTextPos.AdjustY( -(aMetric.GetDescent()) );
|
aTextPos.AdjustY( -(aMetric.GetDescent()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(aBuf.get_factor() == 1);
|
DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), aBuf, {},
|
||||||
DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), aBuf.get_subunit_array(), {},
|
|
||||||
aSvxFont, nPara, bRightToLeftPara ? 1 : 0, nullptr, nullptr, false, false, true, nullptr, Color(), Color());
|
aSvxFont, nPara, bRightToLeftPara ? 1 : 0, nullptr, nullptr, false, false, true, nullptr, Color(), Color());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1644,7 +1643,7 @@ void Outliner::StripPortions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart,
|
void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart,
|
||||||
sal_Int32 nTextLen, std::span<const sal_Int32> pDXArray,
|
sal_Int32 nTextLen, std::span<const double> pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray, const SvxFont& rFont,
|
std::span<const sal_Bool> pKashidaArray, const SvxFont& rFont,
|
||||||
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
||||||
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
||||||
|
@ -1399,7 +1399,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExtTextOutOpaqueAndClipWMF)
|
|||||||
|
|
||||||
assertXPath(pDocument, aPrefix + "group[3]/mask/group/polypolygoncolor", "color", u"#ff8000");
|
assertXPath(pDocument, aPrefix + "group[3]/mask/group/polypolygoncolor", "color", u"#ff8000");
|
||||||
assertXPath(pDocument, aPrefix + "group[3]/mask/group/polypolygoncolor/polypolygon", "path",
|
assertXPath(pDocument, aPrefix + "group[3]/mask/group/polypolygoncolor/polypolygon", "path",
|
||||||
u"m1067 1067h1317v473h-1317z");
|
u"m1067 1067h1317.12890625v473h-1317.12890625z");
|
||||||
assertXPath(pDocument, aPrefix + "group[3]/mask/group/textsimpleportion", "text", u"OOOO");
|
assertXPath(pDocument, aPrefix + "group[3]/mask/group/textsimpleportion", "text", u"OOOO");
|
||||||
assertXPath(pDocument, aPrefix + "group[3]/mask/group/textsimpleportion", "fontcolor",
|
assertXPath(pDocument, aPrefix + "group[3]/mask/group/textsimpleportion", "fontcolor",
|
||||||
u"#000000");
|
u"#000000");
|
||||||
|
@ -1962,7 +1962,7 @@ namespace emfio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aDXAry.set(i, 0);
|
aDXAry[i] = 0;
|
||||||
if (nOptions & ETO_PDY)
|
if (nOptions & ETO_PDY)
|
||||||
{
|
{
|
||||||
pDYAry[i] = 0;
|
pDYAry[i] = 0;
|
||||||
@ -1972,7 +1972,7 @@ namespace emfio
|
|||||||
{
|
{
|
||||||
sal_Int32 nDxTmp = 0;
|
sal_Int32 nDxTmp = 0;
|
||||||
mpInputStream->ReadInt32(nDxTmp);
|
mpInputStream->ReadInt32(nDxTmp);
|
||||||
aDXAry.set(i, o3tl::saturating_add(aDXAry[i], nDxTmp));
|
aDXAry[i] += nDxTmp;
|
||||||
if (nOptions & ETO_PDY)
|
if (nOptions & ETO_PDY)
|
||||||
{
|
{
|
||||||
sal_Int32 nDyTmp = 0;
|
sal_Int32 nDyTmp = 0;
|
||||||
|
@ -1681,7 +1681,7 @@ namespace emfio
|
|||||||
// #i121382# Map DXArray using WorldTransform
|
// #i121382# Map DXArray using WorldTransform
|
||||||
const Size aSizeX(ImplMap(Size(nSumX, 0)));
|
const Size aSizeX(ImplMap(Size(nSumX, 0)));
|
||||||
const basegfx::B2DVector aVectorX(aSizeX.Width(), aSizeX.Height());
|
const basegfx::B2DVector aVectorX(aSizeX.Width(), aSizeX.Height());
|
||||||
pDXArry->set(i, basegfx::fround(aVectorX.getLength()) * (nSumX >= 0 ? 1 : -1));
|
(*pDXArry)[i] = aVectorX.getLength() * (nSumX >= 0 ? 1 : -1);
|
||||||
|
|
||||||
if (pDYArry)
|
if (pDYArry)
|
||||||
{
|
{
|
||||||
|
@ -805,7 +805,7 @@ namespace emfio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aDXAry.set(i, nDx);
|
aDXAry[i] = nDx;
|
||||||
if ( nOptions & ETO_PDY )
|
if ( nOptions & ETO_PDY )
|
||||||
{
|
{
|
||||||
pDYAry[i] = nDy;
|
pDYAry[i] = nDy;
|
||||||
@ -1303,7 +1303,7 @@ namespace emfio
|
|||||||
{
|
{
|
||||||
sal_Int32 val;
|
sal_Int32 val;
|
||||||
aMemoryStream.ReadInt32(val);
|
aMemoryStream.ReadInt32(val);
|
||||||
aDXAry.set(i, val);
|
aDXAry[i] = val;
|
||||||
}
|
}
|
||||||
aMemoryStream.ReadUInt32(mnSkipActions);
|
aMemoryStream.ReadUInt32(mnSkipActions);
|
||||||
DrawText(aPt, aString,
|
DrawText(aPt, aString,
|
||||||
|
@ -2724,7 +2724,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
|
|||||||
if( !pDXArray.empty() )
|
if( !pDXArray.empty() )
|
||||||
{
|
{
|
||||||
aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
|
aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 );
|
||||||
aTmpArray.assign(pDXArray);
|
aTmpArray.assign(pDXArray.begin(), pDXArray.end());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2786,7 +2786,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
|
|||||||
const double fFactor = static_cast<double>(nWidth) / aNormSize.Width();
|
const double fFactor = static_cast<double>(nWidth) / aNormSize.Width();
|
||||||
|
|
||||||
for( i = 0; i < ( nLen - 1 ); i++ )
|
for( i = 0; i < ( nLen - 1 ); i++ )
|
||||||
aTmpArray.set(i, basegfx::fround(aTmpArray[i] * fFactor));
|
aTmpArray[i] *= fFactor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
|
#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||||
|
#include <vcl/kernarray.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
#include <tools/fontenum.hxx>
|
#include <tools/fontenum.hxx>
|
||||||
#include <span>
|
#include <span>
|
||||||
@ -34,7 +35,6 @@ class VirtualDevice;
|
|||||||
class GDIMetaFile;
|
class GDIMetaFile;
|
||||||
enum class DrawTextFlags;
|
enum class DrawTextFlags;
|
||||||
class SalLayout;
|
class SalLayout;
|
||||||
class KernArray;
|
|
||||||
namespace vcl
|
namespace vcl
|
||||||
{
|
{
|
||||||
class Font;
|
class Font;
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <editeng/eedata.hxx>
|
#include <editeng/eedata.hxx>
|
||||||
#include <o3tl/typed_flags_set.hxx>
|
#include <o3tl/typed_flags_set.hxx>
|
||||||
#include <svl/languageoptions.hxx>
|
#include <svl/languageoptions.hxx>
|
||||||
|
#include <vcl/kernarray.hxx>
|
||||||
#include <comphelper/errcode.hxx>
|
#include <comphelper/errcode.hxx>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -498,7 +499,7 @@ public:
|
|||||||
|
|
||||||
virtual void DrawingText( const Point& rStartPos, const OUString& rText,
|
virtual void DrawingText( const Point& rStartPos, const OUString& rText,
|
||||||
sal_Int32 nTextStart, sal_Int32 nTextLen,
|
sal_Int32 nTextStart, sal_Int32 nTextLen,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray,
|
std::span<const sal_Bool> pKashidaArray,
|
||||||
const SvxFont& rFont,
|
const SvxFont& rFont,
|
||||||
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
||||||
|
@ -407,7 +407,7 @@ public:
|
|||||||
sal_Int32 mnTextLen;
|
sal_Int32 mnTextLen;
|
||||||
sal_Int32 mnPara;
|
sal_Int32 mnPara;
|
||||||
const SvxFont& mrFont;
|
const SvxFont& mrFont;
|
||||||
std::span<const sal_Int32> mpDXArray;
|
KernArraySpan mpDXArray;
|
||||||
std::span<const sal_Bool> mpKashidaArray;
|
std::span<const sal_Bool> mpKashidaArray;
|
||||||
|
|
||||||
const EEngineData::WrongSpellVector* mpWrongSpellVector;
|
const EEngineData::WrongSpellVector* mpWrongSpellVector;
|
||||||
@ -431,7 +431,7 @@ public:
|
|||||||
sal_Int32 nTxtLen,
|
sal_Int32 nTxtLen,
|
||||||
const SvxFont& rFnt,
|
const SvxFont& rFnt,
|
||||||
sal_Int32 nPar,
|
sal_Int32 nPar,
|
||||||
std::span<const sal_Int32> pDXArr,
|
KernArraySpan pDXArr,
|
||||||
std::span<const sal_Bool> pKashidaArr,
|
std::span<const sal_Bool> pKashidaArr,
|
||||||
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
const EEngineData::WrongSpellVector* pWrongSpellVector,
|
||||||
const SvxFieldData* pFieldData,
|
const SvxFieldData* pFieldData,
|
||||||
@ -824,7 +824,7 @@ public:
|
|||||||
|
|
||||||
SAL_DLLPRIVATE void DrawingText( const Point& rStartPos, const OUString& rText,
|
SAL_DLLPRIVATE void DrawingText( const Point& rStartPos, const OUString& rText,
|
||||||
sal_Int32 nTextStart, sal_Int32 nTextLen,
|
sal_Int32 nTextStart, sal_Int32 nTextLen,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray,
|
std::span<const sal_Bool> pKashidaArray,
|
||||||
const SvxFont& rFont,
|
const SvxFont& rFont,
|
||||||
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
sal_Int32 nPara, sal_uInt8 nRightToLeft,
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <editeng/svxenum.hxx>
|
#include <editeng/svxenum.hxx>
|
||||||
#include <tools/long.hxx>
|
#include <tools/long.hxx>
|
||||||
#include <vcl/font.hxx>
|
#include <vcl/font.hxx>
|
||||||
|
#include <vcl/kernarray.hxx>
|
||||||
#include <editeng/editengdllapi.h>
|
#include <editeng/editengdllapi.h>
|
||||||
#include <tools/poly.hxx>
|
#include <tools/poly.hxx>
|
||||||
|
|
||||||
@ -33,7 +34,6 @@
|
|||||||
// See i#1526# for full explanation
|
// See i#1526# for full explanation
|
||||||
#define SMALL_CAPS_PERCENTAGE 80
|
#define SMALL_CAPS_PERCENTAGE 80
|
||||||
|
|
||||||
class KernArray;
|
|
||||||
class SvxDoCapitals;
|
class SvxDoCapitals;
|
||||||
class OutputDevice;
|
class OutputDevice;
|
||||||
class Printer;
|
class Printer;
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt, KernArray* pDXAry,
|
Size GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt, KernArray* pDXAry,
|
||||||
const sal_Int32 nIdx, const sal_Int32 nLen) const;
|
const sal_Int32 nIdx, const sal_Int32 nLen) const;
|
||||||
void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
|
void DrawCapital( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
|
||||||
std::span<const sal_Int32> pDXArray,
|
KernArraySpan pDXArray,
|
||||||
std::span<const sal_Bool> pKashidaArray,
|
std::span<const sal_Bool> pKashidaArray,
|
||||||
const sal_Int32 nIdx, const sal_Int32 nLen ) const;
|
const sal_Int32 nIdx, const sal_Int32 nLen ) const;
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
|
void QuickDrawText( OutputDevice *pOut, const Point &rPos, const OUString &rTxt,
|
||||||
const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32,
|
const sal_Int32 nIdx = 0, const sal_Int32 nLen = SAL_MAX_INT32,
|
||||||
std::span<const sal_Int32> pDXArray = {},
|
KernArraySpan pDXArray = {},
|
||||||
std::span<const sal_Bool> pKashidaArray = {} ) const;
|
std::span<const sal_Bool> pKashidaArray = {} ) const;
|
||||||
|
|
||||||
Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
|
Size QuickGetTextSize( const OutputDevice *pOut, const OUString &rTxt,
|
||||||
|
@ -10,99 +10,10 @@
|
|||||||
|
|
||||||
#include <sal/config.h>
|
#include <sal/config.h>
|
||||||
|
|
||||||
#include <sal/types.h>
|
|
||||||
#include <cmath>
|
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class KernArraySpan final
|
using KernArraySpan = std::span<const double>;
|
||||||
{
|
using KernArray = std::vector<double>;
|
||||||
private:
|
|
||||||
int m_nSubUnitFactor;
|
|
||||||
std::span<const sal_Int32> m_DXArray;
|
|
||||||
|
|
||||||
public:
|
|
||||||
KernArraySpan()
|
|
||||||
: m_nSubUnitFactor(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
KernArraySpan(std::span<const sal_Int32> DXArray, int nSubUnitFactor = 1)
|
|
||||||
: m_nSubUnitFactor(nSubUnitFactor)
|
|
||||||
, m_DXArray(DXArray)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
size_t size() const { return m_DXArray.size(); }
|
|
||||||
bool empty() const { return m_DXArray.empty(); }
|
|
||||||
sal_Int32 operator[](size_t nIndex) const { return get(nIndex); }
|
|
||||||
sal_Int32 get(size_t nIndex) const
|
|
||||||
{
|
|
||||||
return std::round(static_cast<double>(m_DXArray[nIndex]) / m_nSubUnitFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_factor() const { return m_nSubUnitFactor; }
|
|
||||||
sal_Int32 get_subunit(size_t nIndex) const { return m_DXArray[nIndex]; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class KernArray final
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
int m_nSubUnitFactor;
|
|
||||||
std::vector<sal_Int32> m_aDXArray;
|
|
||||||
|
|
||||||
public:
|
|
||||||
KernArray(int nSubUnitFactor = 1)
|
|
||||||
: m_nSubUnitFactor(nSubUnitFactor)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Int32 operator[](size_t nIndex) const { return get(nIndex); }
|
|
||||||
sal_Int32 get(size_t nIndex) const
|
|
||||||
{
|
|
||||||
return std::round(static_cast<double>(m_aDXArray[nIndex]) / m_nSubUnitFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_factor() const { return m_nSubUnitFactor; }
|
|
||||||
sal_Int32 get_subunit(size_t nIndex) const { return m_aDXArray[nIndex]; }
|
|
||||||
|
|
||||||
void set_subunit(size_t nIndex, sal_Int32 nValue) { m_aDXArray[nIndex] = nValue; }
|
|
||||||
std::vector<sal_Int32>& get_subunit_array() { return m_aDXArray; }
|
|
||||||
|
|
||||||
void adjust(size_t nIndex, sal_Int32 nDiff) { m_aDXArray[nIndex] += nDiff * m_nSubUnitFactor; }
|
|
||||||
void set(size_t nIndex, sal_Int32 nValue) { m_aDXArray[nIndex] = nValue * m_nSubUnitFactor; }
|
|
||||||
void push_back(sal_Int32 nUnit) { m_aDXArray.push_back(nUnit * m_nSubUnitFactor); }
|
|
||||||
sal_Int32 back() const { return m_aDXArray.back() * m_nSubUnitFactor; }
|
|
||||||
size_t size() const { return m_aDXArray.size(); }
|
|
||||||
bool empty() const { return m_aDXArray.empty(); }
|
|
||||||
void clear() { m_aDXArray.clear(); }
|
|
||||||
void assign(KernArraySpan other)
|
|
||||||
{
|
|
||||||
m_nSubUnitFactor = other.get_factor();
|
|
||||||
m_aDXArray.clear();
|
|
||||||
size_t nLen = other.size();
|
|
||||||
m_aDXArray.reserve(nLen);
|
|
||||||
for (size_t i = 0; i < nLen; ++i)
|
|
||||||
m_aDXArray.push_back(other.get_subunit(i));
|
|
||||||
}
|
|
||||||
void resize(size_t nSize) { m_aDXArray.resize(nSize); }
|
|
||||||
void resize(size_t nSize, sal_Int32 nDefault)
|
|
||||||
{
|
|
||||||
m_aDXArray.resize(nSize, nDefault * m_nSubUnitFactor);
|
|
||||||
}
|
|
||||||
void reserve(size_t nCapacity) { m_aDXArray.reserve(nCapacity); }
|
|
||||||
|
|
||||||
bool operator==(const KernArray& rOther) const
|
|
||||||
{
|
|
||||||
size_t nSize = size();
|
|
||||||
if (nSize != rOther.size())
|
|
||||||
return false;
|
|
||||||
for (size_t i = 0; i < nSize; ++i)
|
|
||||||
if (m_aDXArray[i] != rOther.m_aDXArray[i])
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator KernArraySpan() const { return KernArraySpan(m_aDXArray, m_nSubUnitFactor); }
|
|
||||||
};
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||||
|
@ -2193,7 +2193,7 @@ void ScOutputData::LayoutStrings(bool bPixelToLogic)
|
|||||||
{
|
{
|
||||||
double fMul = GetStretch();
|
double fMul = GetStretch();
|
||||||
for (size_t i = 0; i < nLen; ++i)
|
for (size_t i = 0; i < nLen; ++i)
|
||||||
aDX.set(i, static_cast<sal_Int32>(aDX[i] / fMul + 0.5));
|
aDX[i] /= fMul;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpDev->DrawTextArray(aDrawTextPos, aShort, aDX, {}, 0, nLen);
|
mpDev->DrawTextArray(aDrawTextPos, aShort, aDX, {}, 0, nLen);
|
||||||
|
@ -393,9 +393,9 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour)
|
|||||||
|
|
||||||
// index, length, x, y
|
// index, length, x, y
|
||||||
const std::tuple<int, int, int, int> strings[] = {
|
const std::tuple<int, int, int, int> strings[] = {
|
||||||
{ 0, 6, 9599, 8647 }, // Lorem
|
{ 0, 6, 9600, 8647 }, // Lorem
|
||||||
{ 6, 22, 7570, 9358 }, // ipsum dolor sit amet,
|
{ 6, 22, 7570, 9358 }, // ipsum dolor sit amet,
|
||||||
{ 28, 29, 6775, 10069 }, // consectetur adipiscing elit.
|
{ 28, 29, 6776, 10069 }, // consectetur adipiscing elit.
|
||||||
{ 57, 29, 6299, 10780 }, // Vestibulum consequat mi quis
|
{ 57, 29, 6299, 10780 }, // Vestibulum consequat mi quis
|
||||||
{ 86, 37, 5453, 11491 }, // pretium semper. Proin luctus orci ac
|
{ 86, 37, 5453, 11491 }, // pretium semper. Proin luctus orci ac
|
||||||
{ 123, 36, 5134, 12202 }, // neque venenatis, quis commodo dolor
|
{ 123, 36, 5134, 12202 }, // neque venenatis, quis commodo dolor
|
||||||
@ -404,7 +404,7 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testTdf152906_AdjustToContour)
|
|||||||
{ 243, 40, 4975, 14335 }, // nec pellentesque eros molestie eget. In
|
{ 243, 40, 4975, 14335 }, // nec pellentesque eros molestie eget. In
|
||||||
{ 283, 42, 4552, 15046 }, // consectetur aliquam hendrerit. Sed cursus
|
{ 283, 42, 4552, 15046 }, // consectetur aliquam hendrerit. Sed cursus
|
||||||
{ 325, 38, 5363, 15757 }, // mauris vitae ligula pellentesque, non
|
{ 325, 38, 5363, 15757 }, // mauris vitae ligula pellentesque, non
|
||||||
{ 363, 42, 4692, 16468 }, // pellentesque urna aliquet. Fusce placerat
|
{ 363, 42, 4693, 16468 }, // pellentesque urna aliquet. Fusce placerat
|
||||||
{ 405, 37, 5047, 17179 }, // mauris enim, nec rutrum purus semper
|
{ 405, 37, 5047, 17179 }, // mauris enim, nec rutrum purus semper
|
||||||
{ 442, 33, 5963, 17890 }, // vel. Praesent tincidunt neque eu
|
{ 442, 33, 5963, 17890 }, // vel. Praesent tincidunt neque eu
|
||||||
{ 475, 29, 6387, 18601 }, // pellentesque pharetra. Fusce
|
{ 475, 29, 6387, 18601 }, // pellentesque pharetra. Fusce
|
||||||
|
@ -191,14 +191,14 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 nStartOffset = nSpanIdx - nIdx;
|
sal_Int32 nStartOffset = nSpanIdx - nIdx;
|
||||||
sal_Int32 nStartX = nStartOffset ? m_rInfo.mpDXArray[nStartOffset - 1] : 0;
|
double nStartX = nStartOffset ? m_rInfo.mpDXArray[nStartOffset - 1] : 0;
|
||||||
|
|
||||||
Point aStartPos(m_rInfo.mrStartPos.X() + nStartX, m_rInfo.mrStartPos.Y());
|
Point aStartPos(m_rInfo.mrStartPos.X() + nStartX, m_rInfo.mrStartPos.Y());
|
||||||
|
|
||||||
std::vector<sal_Int32> aDXArray;
|
KernArray aDXArray;
|
||||||
aDXArray.reserve(nSpanLen);
|
aDXArray.resize(nSpanLen);
|
||||||
for (sal_Int32 i = 0; i < nSpanLen; ++i)
|
for (sal_Int32 i = 0; i < nSpanLen; ++i)
|
||||||
aDXArray.push_back(m_rInfo.mpDXArray[nStartOffset + i] - nStartX);
|
aDXArray[i] = m_rInfo.mpDXArray[nStartOffset + i] - nStartX;
|
||||||
|
|
||||||
auto aKashidaArray = !m_rInfo.mpKashidaArray.empty() ?
|
auto aKashidaArray = !m_rInfo.mpKashidaArray.empty() ?
|
||||||
std::span<const sal_Bool>(m_rInfo.mpKashidaArray.data() + nStartOffset, nSpanLen) :
|
std::span<const sal_Bool>(m_rInfo.mpKashidaArray.data() + nStartOffset, nSpanLen) :
|
||||||
|
@ -1623,9 +1623,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
|
|||||||
CPPUNIT_ASSERT_EQUAL(size_t(14), pDXArray.size());
|
CPPUNIT_ASSERT_EQUAL(size_t(14), pDXArray.size());
|
||||||
|
|
||||||
// Assert we are using the expected width for uncompressed chars
|
// Assert we are using the expected width for uncompressed chars
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(720), pDXArray[0]);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(720), sal_Int32(pDXArray[0]));
|
||||||
// Assert we are using the expected width for compressed chars
|
// Assert we are using the expected width for compressed chars
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(500), pDXArray[6] - pDXArray[5]);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(500), sal_Int32(pDXArray[6] - pDXArray[5]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,13 +56,13 @@ std::ostream& operator<<(std::ostream& rStrm, const CharWidthArray& rCharWidthAr
|
|||||||
void CharWidthArray::ConvertToKernArray()
|
void CharWidthArray::ConvertToKernArray()
|
||||||
{
|
{
|
||||||
for (std::size_t i = 1; i < maArray.size(); ++i)
|
for (std::size_t i = 1; i < maArray.size(); ++i)
|
||||||
maArray.adjust(i, maArray[i - 1]);
|
maArray[i] += maArray[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharWidthArray::ConvertToCharWidths()
|
void CharWidthArray::ConvertToCharWidths()
|
||||||
{
|
{
|
||||||
for (sal_Int32 i = maArray.size() - 1; i > 0; --i)
|
for (sal_Int32 i = maArray.size() - 1; i > 0; --i)
|
||||||
maArray.adjust(i, -maArray[i - 1]);
|
maArray[i] -= maArray[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert maArray to kern array values, then invoke the function, and convert it back.
|
/// Convert maArray to kern array values, then invoke the function, and convert it back.
|
||||||
|
@ -446,7 +446,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf161810)
|
|||||||
|
|
||||||
// Assert we are using the expected position for the last char
|
// Assert we are using the expected position for the last char
|
||||||
// This was 9369, now 9165, according to the fixed space shrinking
|
// This was 9369, now 9165, according to the fixed space shrinking
|
||||||
CPPUNIT_ASSERT_LESS(sal_Int32(9300), pDXArray[72]);
|
CPPUNIT_ASSERT_LESS(sal_Int32(9300), sal_Int32(pDXArray[72]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf163149)
|
|||||||
|
|
||||||
// Assert we are using the expected position for the last char
|
// Assert we are using the expected position for the last char
|
||||||
// This was 4673, now 4163, according to the fixed space shrinking
|
// This was 4673, now 4163, according to the fixed space shrinking
|
||||||
CPPUNIT_ASSERT_LESS(sal_Int32(4200), pDXArray[45]);
|
CPPUNIT_ASSERT_LESS(sal_Int32(4200), sal_Int32(pDXArray[45]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -920,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf122607)
|
|||||||
assertXPath(pXmlDoc,
|
assertXPath(pXmlDoc,
|
||||||
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
|
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
|
||||||
"fly/txt/SwParaPortion/SwLineLayout/child::*[1]",
|
"fly/txt/SwParaPortion/SwLineLayout/child::*[1]",
|
||||||
"width", u"428");
|
"width", u"427");
|
||||||
assertXPath(pXmlDoc,
|
assertXPath(pXmlDoc,
|
||||||
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
|
"/root/page[1]/anchored/fly/txt[1]/anchored/fly/tab/row[2]/cell/txt[7]/anchored/"
|
||||||
"fly/txt/SwParaPortion/SwLineLayout/child::*[1]",
|
"fly/txt/SwParaPortion/SwLineLayout/child::*[1]",
|
||||||
|
@ -3389,7 +3389,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testDropDownFormFieldButton)
|
|||||||
CPPUNIT_ASSERT_EQUAL("drop-down"_ostr, sType);
|
CPPUNIT_ASSERT_EQUAL("drop-down"_ostr, sType);
|
||||||
|
|
||||||
OString sTextArea( aTree.get_child("textArea").get_value<std::string>() );
|
OString sTextArea( aTree.get_child("textArea").get_value<std::string>() );
|
||||||
CPPUNIT_ASSERT_EQUAL("1538, 1418, 1026, 275"_ostr, sTextArea);
|
CPPUNIT_ASSERT_EQUAL("1538, 1418, 1025, 275"_ostr, sTextArea);
|
||||||
|
|
||||||
boost::property_tree::ptree aItems = aTree.get_child("params").get_child("items");
|
boost::property_tree::ptree aItems = aTree.get_child("params").get_child("items");
|
||||||
CPPUNIT_ASSERT_EQUAL(size_t(6), aItems.size());
|
CPPUNIT_ASSERT_EQUAL(size_t(6), aItems.size());
|
||||||
|
@ -2141,8 +2141,8 @@ tools::Long SwScriptInfo::Compress(KernArray& rKernArray, TextFrameIndex nIdx, T
|
|||||||
nSub -= nLast;
|
nSub -= nLast;
|
||||||
nLast = rKernArray[ nI ];
|
nLast = rKernArray[ nI ];
|
||||||
if( nI && nMove )
|
if( nI && nMove )
|
||||||
rKernArray.adjust(nI - 1, nMove);
|
rKernArray[nI - 1] += nMove;
|
||||||
rKernArray.adjust(nI, -nSub);
|
rKernArray[nI] += -nSub;
|
||||||
++nI;
|
++nI;
|
||||||
++nIdx;
|
++nIdx;
|
||||||
}
|
}
|
||||||
@ -2163,7 +2163,7 @@ tools::Long SwScriptInfo::Compress(KernArray& rKernArray, TextFrameIndex nIdx, T
|
|||||||
while( nIdx < nTmpChg )
|
while( nIdx < nTmpChg )
|
||||||
{
|
{
|
||||||
nLast = rKernArray[ nI ];
|
nLast = rKernArray[ nI ];
|
||||||
rKernArray.adjust(nI, -nSub);
|
rKernArray[nI] += -nSub;
|
||||||
++nI;
|
++nI;
|
||||||
++nIdx;
|
++nIdx;
|
||||||
}
|
}
|
||||||
@ -2251,7 +2251,7 @@ sal_Int32 SwScriptInfo::KashidaJustify( KernArray* pKernArray,
|
|||||||
|
|
||||||
while ( nArrayPos < nArrayEnd )
|
while ( nArrayPos < nArrayEnd )
|
||||||
{
|
{
|
||||||
pKernArray->adjust(sal_Int32(nArrayPos), nKashAdd);
|
(*pKernArray)[sal_Int32(nArrayPos)] += nKashAdd;
|
||||||
++nArrayPos;
|
++nArrayPos;
|
||||||
}
|
}
|
||||||
nKashAdd += nSpaceAdd;
|
nKashAdd += nSpaceAdd;
|
||||||
@ -2496,7 +2496,7 @@ TextFrameIndex SwScriptInfo::ThaiJustify( std::u16string_view aText, KernArray*
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pKernArray)
|
if (pKernArray)
|
||||||
pKernArray->adjust(nI, nSpaceSum);
|
(*pKernArray)[nI] += nSpaceSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nCnt;
|
return nCnt;
|
||||||
@ -2877,7 +2877,7 @@ void SwScriptInfo::CJKJustify( const OUString& rText, KernArray& rKernArray,
|
|||||||
if (nNext < sal_Int32(nStt + nLen) || !bIsSpaceStop)
|
if (nNext < sal_Int32(nStt + nLen) || !bIsSpaceStop)
|
||||||
nSpaceSum += nSpaceAdd;
|
nSpaceSum += nSpaceAdd;
|
||||||
}
|
}
|
||||||
rKernArray.adjust(nI, nSpaceSum);
|
rKernArray[nI] += nSpaceSum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@ -1108,7 +1108,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||||||
tools::Long nSum = nDiff;
|
tools::Long nSum = nDiff;
|
||||||
for( sal_Int32 i = 0; i < nZwi; )
|
for( sal_Int32 i = 0; i < nZwi; )
|
||||||
{
|
{
|
||||||
aKernArray.adjust(i, nSum);
|
aKernArray[i] += nSum;
|
||||||
if( ++i == nRest )
|
if( ++i == nRest )
|
||||||
nDiff += nAdd;
|
nDiff += nAdd;
|
||||||
nSum += nDiff;
|
nSum += nDiff;
|
||||||
@ -1202,7 +1202,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||||||
{
|
{
|
||||||
if (CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx()) + i])
|
if (CH_BLANK == rInf.GetText()[sal_Int32(rInf.GetIdx()) + i])
|
||||||
nKernSum += nSpaceAdd;
|
nKernSum += nSpaceAdd;
|
||||||
aKernArray.adjust(i, nKernSum);
|
aKernArray[i] += nKernSum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of underlined/strike-through justified text
|
// In case of underlined/strike-through justified text
|
||||||
@ -1213,14 +1213,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||||||
// If it is a single underlined space, output 2 spaces:
|
// If it is a single underlined space, output 2 spaces:
|
||||||
if (TextFrameIndex(1) == rInf.GetLen())
|
if (TextFrameIndex(1) == rInf.GetLen())
|
||||||
{
|
{
|
||||||
aKernArray.set(0, rInf.GetWidth() + nSpaceAdd);
|
aKernArray[0] = rInf.GetWidth() + nSpaceAdd;
|
||||||
rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
|
rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
|
||||||
aKernArray, aKashidaArray, sal_Int32(rInf.GetIdx()), 1 );
|
aKernArray, aKashidaArray, sal_Int32(rInf.GetIdx()), 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sal_Int32 nIndex(sal_Int32(rInf.GetLen()) - 2);
|
sal_Int32 nIndex(sal_Int32(rInf.GetLen()) - 2);
|
||||||
aKernArray.adjust(nIndex, nSpaceAdd);
|
aKernArray[nIndex] += nSpaceAdd;
|
||||||
DrawTextArray(rInf.GetOut(), aTextOriginPos, rInf.GetText(), aKernArray,
|
DrawTextArray(rInf.GetOut(), aTextOriginPos, rInf.GetText(), aKernArray,
|
||||||
aKashidaArray, sal_Int32{ rInf.GetIdx() },
|
aKashidaArray, sal_Int32{ rInf.GetIdx() },
|
||||||
sal_Int32{ rInf.GetLen() }, rInf.GetLayoutContext());
|
sal_Int32{ rInf.GetLen() }, rInf.GetLayoutContext());
|
||||||
@ -1455,9 +1455,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||||||
// have to output 2 spaces:
|
// have to output 2 spaces:
|
||||||
if ((nCnt == TextFrameIndex(1)) && rInf.GetSpace() && (cChPrev == CH_BLANK))
|
if ((nCnt == TextFrameIndex(1)) && rInf.GetSpace() && (cChPrev == CH_BLANK))
|
||||||
{
|
{
|
||||||
aKernArray.set(0, rInf.GetWidth() +
|
aKernArray[0] = rInf.GetWidth() +
|
||||||
rInf.GetKern() +
|
rInf.GetKern() +
|
||||||
(rInf.GetSpace() / SPACING_PRECISION_FACTOR));
|
(rInf.GetSpace() / SPACING_PRECISION_FACTOR);
|
||||||
|
|
||||||
if ( bSwitchL2R )
|
if ( bSwitchL2R )
|
||||||
rInf.GetFrame()->SwitchLTRtoRTL( aTextOriginPos );
|
rInf.GetFrame()->SwitchLTRtoRTL( aTextOriginPos );
|
||||||
@ -1615,9 +1615,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
|
|||||||
for( sal_Int32 i = 1 ; i < nLen ; ++i )
|
for( sal_Int32 i = 1 ; i < nLen ; ++i )
|
||||||
{
|
{
|
||||||
if ( aBulletOverlay[ i ] == CH_BULLET )
|
if ( aBulletOverlay[ i ] == CH_BULLET )
|
||||||
aKernArray.adjust(i - 1, nShift);
|
aKernArray[i - 1] += nShift;
|
||||||
if ( nAdd )
|
if ( nAdd )
|
||||||
aKernArray.adjust(i - 1, -nAdd);
|
aKernArray[i - 1] += -nAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, aKernArray,
|
rInf.GetOut().DrawTextArray( aTextOriginPos, aBulletOverlay, aKernArray,
|
||||||
|
@ -152,23 +152,23 @@ void SpaceDistribution(KernArray& rKernArray, std::u16string_view aText, sal_Int
|
|||||||
}
|
}
|
||||||
|
|
||||||
cChPrev = nCh;
|
cChPrev = nCh;
|
||||||
rKernArray.adjust(nPrevIdx, nKernSum + nSpaceSum);
|
rKernArray[nPrevIdx] += nKernSum + nSpaceSum;
|
||||||
// In word line mode and for Arabic, we disabled the half space trick. If a portion
|
// In word line mode and for Arabic, we disabled the half space trick. If a portion
|
||||||
// ends with a blank, the full nSpaceAdd value has been added to the character in
|
// ends with a blank, the full nSpaceAdd value has been added to the character in
|
||||||
// front of the blank. This leads to painting artifacts, therefore we remove the
|
// front of the blank. This leads to painting artifacts, therefore we remove the
|
||||||
// nSpaceAdd value again:
|
// nSpaceAdd value again:
|
||||||
if (bNoHalfSpace && i + 1 == nLen && nCh == CH_BLANK)
|
if (bNoHalfSpace && i + 1 == nLen && nCh == CH_BLANK)
|
||||||
rKernArray.adjust(nPrevIdx, -nSpaceAdd);
|
rKernArray[nPrevIdx] += -nSpaceAdd;
|
||||||
|
|
||||||
// Advance nPrevIdx and assign kern values to previous cluster.
|
// Advance nPrevIdx and assign kern values to previous cluster.
|
||||||
for (tools::Long nValue = rKernArray[nPrevIdx++]; nPrevIdx < i; ++nPrevIdx)
|
for (tools::Long nValue = rKernArray[nPrevIdx++]; nPrevIdx < i; ++nPrevIdx)
|
||||||
rKernArray.set(nPrevIdx, nValue);
|
rKernArray[nPrevIdx] = nValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the layout engine requires the total width of the output
|
// the layout engine requires the total width of the output
|
||||||
while (nPrevIdx < nLen)
|
while (nPrevIdx < nLen)
|
||||||
{
|
{
|
||||||
rKernArray.adjust(nPrevIdx, nKernSum + nSpaceSum);
|
rKernArray[nPrevIdx] += nKernSum + nSpaceSum;
|
||||||
++nPrevIdx;
|
++nPrevIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,14 +199,14 @@ tools::Long SnapToGrid(KernArray& rKernArray, std::u16string_view aText, sal_Int
|
|||||||
|
|
||||||
while (nLast < i)
|
while (nLast < i)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nX);
|
rKernArray[nLast] = nX;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nLast < nLen)
|
while (nLast < nLen)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nEdge);
|
rKernArray[nLast] = nEdge;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void lcl_MsoCompatSnapToGridEdge(KernArray& rKernArray, sal_Int32 nLen, tools::L
|
|||||||
tools::Long nMinWidth = lcl_MsoGridWidth(nGridWidth, nBaseFontSize, nCharWidth + nKern);
|
tools::Long nMinWidth = lcl_MsoGridWidth(nGridWidth, nBaseFontSize, nCharWidth + nKern);
|
||||||
while (nLast < i)
|
while (nLast < i)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nEdge);
|
rKernArray[nLast] = nEdge;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ void lcl_MsoCompatSnapToGridEdge(KernArray& rKernArray, sal_Int32 nLen, tools::L
|
|||||||
|
|
||||||
while (nLast < nLen)
|
while (nLast < nLen)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nEdge);
|
rKernArray[nLast] = nEdge;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ void SnapToGridEdge(KernArray& rKernArray, sal_Int32 nLen, tools::Long nGridWidt
|
|||||||
tools::Long nMinWidth = lcl_MinGridWidth(nGridWidth, nCharWidth + nKern);
|
tools::Long nMinWidth = lcl_MinGridWidth(nGridWidth, nCharWidth + nKern);
|
||||||
while (nLast < i)
|
while (nLast < i)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nEdge);
|
rKernArray[nLast] = nEdge;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ void SnapToGridEdge(KernArray& rKernArray, sal_Int32 nLen, tools::Long nGridWidt
|
|||||||
|
|
||||||
while (nLast < nLen)
|
while (nLast < nLen)
|
||||||
{
|
{
|
||||||
rKernArray.set(nLast, nEdge);
|
rKernArray[nLast] = nEdge;
|
||||||
++nLast;
|
++nLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#if HAVE_MORE_FONTS
|
#if HAVE_MORE_FONTS
|
||||||
// must be declared before inclusion of test/bootstrapfixture.hxx
|
// must be declared before inclusion of test/bootstrapfixture.hxx
|
||||||
static std::ostream& operator<<(std::ostream& rStream, const std::vector<sal_Int32>& rVec);
|
static std::ostream& operator<<(std::ostream& rStream, const std::vector<sal_Int32>& rVec);
|
||||||
|
static std::ostream& operator<<(std::ostream& rStream, const std::vector<double>& rVec);
|
||||||
#endif
|
#endif
|
||||||
#include <test/bootstrapfixture.hxx>
|
#include <test/bootstrapfixture.hxx>
|
||||||
|
|
||||||
@ -40,6 +41,15 @@ static std::ostream& operator<<(std::ostream& rStream, const std::vector<sal_Int
|
|||||||
rStream << " }";
|
rStream << " }";
|
||||||
return rStream;
|
return rStream;
|
||||||
}
|
}
|
||||||
|
static std::ostream& operator<<(std::ostream& rStream, const std::vector<double>& rVec)
|
||||||
|
{
|
||||||
|
rStream << "{ ";
|
||||||
|
for (size_t i = 0; i < rVec.size() - 1; i++)
|
||||||
|
rStream << rVec[i] << ", ";
|
||||||
|
rStream << rVec.back();
|
||||||
|
rStream << " }";
|
||||||
|
return rStream;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class VclComplexTextTest : public test::BootstrapFixture
|
class VclComplexTextTest : public test::BootstrapFixture
|
||||||
@ -82,17 +92,17 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testArabic)
|
|||||||
|
|
||||||
// absolute character widths AKA text array.
|
// absolute character widths AKA text array.
|
||||||
tools::Long nRefTextWidth = 12595;
|
tools::Long nRefTextWidth = 12595;
|
||||||
std::vector<sal_Int32> aRefCharWidths = { 989, 1558, 2824, 2824, 3899,
|
KernArray aRefCharWidths = { 989, 1558, 2824, 2824, 3899,
|
||||||
3899, 4550, 5119, 5689, 5689, 6307, 6925, 8484, 9135, 9705, 10927,
|
3899, 4550, 5119, 5689, 5689, 6307, 6925, 8484, 9135, 9705, 10927,
|
||||||
10927, 11497, 12595, 12595 };
|
10927, 11497, 12595, 12595 };
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
tools::Long nTextWidth
|
tools::Long nTextWidth
|
||||||
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aOneTwoThree, &aCharWidths).nWidth);
|
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aOneTwoThree, &aCharWidths).nWidth);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// text advance width and line height
|
// text advance width and line height
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aOneTwoThree));
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aOneTwoThree));
|
||||||
@ -258,7 +268,7 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaret)
|
|||||||
|
|
||||||
OUString aText;
|
OUString aText;
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
std::vector<sal_Int32> aRefCharWidths;
|
KernArray aRefCharWidths;
|
||||||
tools::Long nTextWidth, nTextWidth2, nRefTextWidth;
|
tools::Long nTextWidth, nTextWidth2, nRefTextWidth;
|
||||||
|
|
||||||
// A. RTL text
|
// A. RTL text
|
||||||
@ -270,18 +280,18 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaret)
|
|||||||
aRefCharWidths = { 1168, 1168, 1819, 2389, 3611, 3611 };
|
aRefCharWidths = { 1168, 1168, 1819, 2389, 3611, 3611 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 2) Caret placement DX array, ligature width is distributed over its
|
// 2) Caret placement DX array, ligature width is distributed over its
|
||||||
// components.
|
// components.
|
||||||
aRefCharWidths = { 584, 1168, 1819, 2389, 3000, 3611 };
|
aRefCharWidths = { 584, 1168, 1819, 2389, 3000, 3611 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 3) caret placement with combining marks, they should not add to ligature
|
// 3) caret placement with combining marks, they should not add to ligature
|
||||||
// component count.
|
// component count.
|
||||||
@ -293,10 +303,10 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaret)
|
|||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth2);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth2);
|
||||||
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// B. LTR text
|
// B. LTR text
|
||||||
aText = u"fi fl ffi ffl"_ustr;
|
aText = u"fi fl ffi ffl"_ustr;
|
||||||
@ -307,18 +317,18 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaret)
|
|||||||
aRefCharWidths = { 1290, 1290, 1941, 3231, 3231, 3882, 5862, 5862, 5862, 6513, 8493, 8493, 8493 };
|
aRefCharWidths = { 1290, 1290, 1941, 3231, 3231, 3882, 5862, 5862, 5862, 6513, 8493, 8493, 8493 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 2) Caret placement DX array, ligature width is distributed over its
|
// 2) Caret placement DX array, ligature width is distributed over its
|
||||||
// components.
|
// components.
|
||||||
aRefCharWidths = { 645, 1290, 1941, 2586, 3231, 3882, 4542, 5202, 5862, 6513, 7173, 7833, 8493 };
|
aRefCharWidths = { 645, 1290, 1941, 2586, 3231, 3882, 4542, 5202, 5862, 6513, 7173, 7833, 8493 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +342,7 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testGdefCaret)
|
|||||||
vcl::Font aFont;
|
vcl::Font aFont;
|
||||||
OUString aText;
|
OUString aText;
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
std::vector<sal_Int32> aRefCharWidths;
|
KernArray aRefCharWidths;
|
||||||
tools::Long nTextWidth, nTextWidth2, nRefTextWidth;
|
tools::Long nTextWidth, nTextWidth2, nRefTextWidth;
|
||||||
|
|
||||||
// A. RTL text
|
// A. RTL text
|
||||||
@ -348,18 +358,18 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testGdefCaret)
|
|||||||
aRefCharWidths= { 582, 582, 842, 1111, 1710, 1710 };
|
aRefCharWidths= { 582, 582, 842, 1111, 1710, 1710 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 2) Caret placement DX array, ligature width is distributed over its
|
// 2) Caret placement DX array, ligature width is distributed over its
|
||||||
// components.
|
// components.
|
||||||
aRefCharWidths = { 291, 582, 842, 1111, 1410, 1710 };
|
aRefCharWidths = { 291, 582, 842, 1111, 1410, 1710 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 3) caret placement with combining marks, they should not add to ligature
|
// 3) caret placement with combining marks, they should not add to ligature
|
||||||
// component count.
|
// component count.
|
||||||
@ -371,10 +381,10 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testGdefCaret)
|
|||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[2], aCharWidths[3]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[6], aCharWidths[7]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
|
CPPUNIT_ASSERT_EQUAL(aCharWidths[8], aCharWidths[9]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth2);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth2);
|
||||||
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, nTextWidth2);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// B. LTR text
|
// B. LTR text
|
||||||
// Set font size to its UPEM to decrease rounding issues
|
// Set font size to its UPEM to decrease rounding issues
|
||||||
@ -390,9 +400,9 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testGdefCaret)
|
|||||||
3544, 3544, 3544, 3836, 4634, 4634, 4926, 5996, 5996, 5996 };
|
3544, 3544, 3544, 3836, 4634, 4634, 4926, 5996, 5996, 5996 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ false).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// 2) Caret placement DX array, ligature width is distributed over its
|
// 2) Caret placement DX array, ligature width is distributed over its
|
||||||
// components.
|
// components.
|
||||||
@ -400,9 +410,9 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testGdefCaret)
|
|||||||
3004, 3278, 3544, 3836, 4138, 4634, 4926, 5199, 5494, 5996 };
|
3004, 3278, 3544, 3836, 4138, 4634, 4926, 5199, 5494, 5996 };
|
||||||
nTextWidth = basegfx::fround<tools::Long>(
|
nTextWidth = basegfx::fround<tools::Long>(
|
||||||
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
pOutDev->GetTextArray(aText, &aCharWidths, 0, -1, /*bCaret*/ true).nWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,25 +427,25 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf152048)
|
|||||||
pOutDev->SetFont(aFont);
|
pOutDev->SetFont(aFont);
|
||||||
|
|
||||||
// get an compare the default text array
|
// get an compare the default text array
|
||||||
std::vector<sal_Int32> aRefCharWidths{ 934, 2341, 2341, 3689, 4647, 5495 };
|
KernArray aRefCharWidths{ 934, 2341, 2341, 3689, 4647, 5495 };
|
||||||
tools::Long nRefTextWidth(5495);
|
tools::Long nRefTextWidth(5495);
|
||||||
|
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
tools::Long nTextWidth
|
tools::Long nTextWidth
|
||||||
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aText, &aCharWidths).nWidth);
|
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aText, &aCharWidths).nWidth);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// Simulate Kashida insertion using Kashida array and extending text array
|
// Simulate Kashida insertion using Kashida array and extending text array
|
||||||
// to have room for Kashida.
|
// to have room for Kashida.
|
||||||
std::vector<sal_Bool> aKashidaArray{ false, false, false, true, false, false };
|
std::vector<sal_Bool> aKashidaArray{ false, false, false, true, false, false };
|
||||||
auto nKashida = 4000;
|
auto nKashida = 4000;
|
||||||
|
|
||||||
aCharWidths.set(3, aCharWidths[3] + nKashida);
|
aCharWidths[3] += nKashida;
|
||||||
aCharWidths.set(4, aCharWidths[4] + nKashida);
|
aCharWidths[4] += nKashida;
|
||||||
aCharWidths.set(5, aCharWidths[5] + nKashida);
|
aCharWidths[5] += nKashida;
|
||||||
auto pLayout = pOutDev->ImplLayout(aText, 0, -1, Point(0, 0), 0, aCharWidths, aKashidaArray);
|
auto pLayout = pOutDev->ImplLayout(aText, 0, -1, Point(0, 0), 0, aCharWidths, aKashidaArray);
|
||||||
|
|
||||||
// Without the fix this fails with:
|
// Without the fix this fails with:
|
||||||
@ -463,7 +473,7 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf152048_2)
|
|||||||
// Without the fix this fails with:
|
// Without the fix this fails with:
|
||||||
// - Expected: 158
|
// - Expected: 158
|
||||||
// - Actual : 118
|
// - Actual : 118
|
||||||
CPPUNIT_ASSERT_EQUAL(aCharWidths.back(), sal_Int32(nTextWidth));
|
CPPUNIT_ASSERT_EQUAL(tools::Long(aCharWidths.back()), nTextWidth);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,14 +535,14 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testMixedCJKLatinScript_glyph_advanceme
|
|||||||
|
|
||||||
// absolute character widths AKA text array.
|
// absolute character widths AKA text array.
|
||||||
tools::Long nRefTextWidth = 704;
|
tools::Long nRefTextWidth = 704;
|
||||||
std::vector<sal_Int32> aRefCharWidths = { 72, 144, 190, 236, 259, 305, 333, 379, 425, 474, 523, 551, 567, 612, 658, 704 };
|
KernArray aRefCharWidths = { 72, 144, 190, 236, 259, 305, 333, 379, 425, 474, 523, 551, 567, 612, 658, 704 };
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
tools::Long nTextWidth
|
tools::Long nTextWidth
|
||||||
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aTestScript, &aCharWidths).nWidth);
|
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aTestScript, &aCharWidths).nWidth);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths);
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// text advance width and line height
|
// text advance width and line height
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aTestScript));
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aTestScript));
|
||||||
|
@ -2246,7 +2246,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
|
|||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
// this changed to the end of the text, not the start of the fly
|
// this changed to the end of the text, not the start of the fly
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(187.207, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(187.157, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(688.389, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(688.389, pNumB->GetValue(), 1e-3);
|
||||||
@ -2312,7 +2312,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
|
|||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(660.789, pNumT->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(660.789, pNumT->GetValue(), 1e-3);
|
||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(146.157, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(146.107, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(674.589, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(674.589, pNumB->GetValue(), 1e-3);
|
||||||
@ -2372,13 +2372,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
|
|||||||
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size());
|
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size());
|
||||||
const auto* pNumL = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[0]);
|
const auto* pNumL = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[0]);
|
||||||
CPPUNIT_ASSERT(pNumL);
|
CPPUNIT_ASSERT(pNumL);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(146.093, pNumL->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(146.043, pNumL->GetValue(), 1e-3);
|
||||||
const auto* pNumT = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[1]);
|
const auto* pNumT = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[1]);
|
||||||
CPPUNIT_ASSERT(pNumT);
|
CPPUNIT_ASSERT(pNumT);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(660.789, pNumT->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(660.789, pNumT->GetValue(), 1e-3);
|
||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(179.457, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(179.357, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(674.589, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(674.589, pNumB->GetValue(), 1e-3);
|
||||||
@ -2510,7 +2510,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
|
|||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(633.189, pNumT->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(633.189, pNumT->GetValue(), 1e-3);
|
||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(86.807, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(86.757, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(646.989, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(646.989, pNumB->GetValue(), 1e-3);
|
||||||
@ -2636,7 +2636,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link)
|
|||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
// this changed to the end of the text, not the start of the fly
|
// this changed to the end of the text, not the start of the fly
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(191.707, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(191.657, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(785.189, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(785.189, pNumB->GetValue(), 1e-3);
|
||||||
@ -2792,7 +2792,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link)
|
|||||||
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
const auto* pNumR = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[2]);
|
||||||
CPPUNIT_ASSERT(pNumR);
|
CPPUNIT_ASSERT(pNumR);
|
||||||
// this changed to the end of the text, not the start of the fly
|
// this changed to the end of the text, not the start of the fly
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(191.707, pNumR->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(191.657, pNumR->GetValue(), 1e-3);
|
||||||
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
const auto* pNumB = dynamic_cast<vcl::filter::PDFNumberElement*>(rElements[3]);
|
||||||
CPPUNIT_ASSERT(pNumB);
|
CPPUNIT_ASSERT(pNumB);
|
||||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(771.389, pNumB->GetValue(), 1e-3);
|
CPPUNIT_ASSERT_DOUBLES_EQUAL(771.389, pNumB->GetValue(), 1e-3);
|
||||||
|
@ -865,8 +865,8 @@ void SvmTest::testTextArray()
|
|||||||
GDIMetaFile aGDIMetaFile;
|
GDIMetaFile aGDIMetaFile;
|
||||||
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
||||||
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
||||||
sal_Int32 const aDX[] = { 10, 15, 20, 25, 30, 35 };
|
KernArray aDX { 10, 15, 20, 25, 30, 35 };
|
||||||
pVirtualDev->DrawTextArray(Point(4,6), u"123456"_ustr, KernArraySpan(aDX), {}, 1, 4);
|
pVirtualDev->DrawTextArray(Point(4,6), u"123456"_ustr, aDX, {}, 1, 4);
|
||||||
|
|
||||||
checkTextArray(writeAndReadStream(aGDIMetaFile));
|
checkTextArray(writeAndReadStream(aGDIMetaFile));
|
||||||
checkTextArray(readFile(u"textarray.svm"));
|
checkTextArray(readFile(u"textarray.svm"));
|
||||||
@ -892,8 +892,8 @@ void SvmTest::testTextArrayWithContext()
|
|||||||
GDIMetaFile aGDIMetaFile;
|
GDIMetaFile aGDIMetaFile;
|
||||||
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
|
||||||
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile);
|
||||||
sal_Int32 const aDX[] = { 10, 15, 20, 25, 30, 35 };
|
KernArray aDX { 10, 15, 20, 25, 30, 35 };
|
||||||
pVirtualDev->DrawPartialTextArray(Point(4, 6), u"123456"_ustr, KernArraySpan(aDX), {}, 0, 5, 1, 4);
|
pVirtualDev->DrawPartialTextArray(Point(4, 6), u"123456"_ustr, aDX, {}, 0, 5, 1, 4);
|
||||||
|
|
||||||
checkTextArrayWithContext(writeAndReadStream(aGDIMetaFile));
|
checkTextArrayWithContext(writeAndReadStream(aGDIMetaFile));
|
||||||
checkTextArrayWithContext(readFile(u"textarraycontext.svm"));
|
checkTextArrayWithContext(readFile(u"textarraycontext.svm"));
|
||||||
|
@ -240,16 +240,16 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextFontSpecificKerning)
|
|||||||
|
|
||||||
// absolute character widths AKA text array.
|
// absolute character widths AKA text array.
|
||||||
tools::Long nRefTextWidth = 2671;
|
tools::Long nRefTextWidth = 2671;
|
||||||
std::vector<sal_Int32> aRefCharWidths = { 1270, 2671 };
|
KernArray aRefCharWidths{ 1270, 2671 };
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
tools::Long nTextWidth
|
tools::Long nTextWidth
|
||||||
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aAV, &aCharWidths).nWidth);
|
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aAV, &aCharWidths).nWidth);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], aCharWidths.get_subunit_array()[0]);
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], aCharWidths[0]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], aCharWidths.get_subunit_array()[1]);
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], aCharWidths[1]);
|
||||||
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// text advance width and line height
|
// text advance width and line height
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
|
||||||
@ -290,16 +290,16 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextNoKerning)
|
|||||||
|
|
||||||
// absolute character widths AKA text array.
|
// absolute character widths AKA text array.
|
||||||
tools::Long nRefTextWidth = 2802;
|
tools::Long nRefTextWidth = 2802;
|
||||||
std::vector<sal_Int32> aRefCharWidths = { 1401, 2802 };
|
KernArray aRefCharWidths{ 1401, 2802 };
|
||||||
KernArray aCharWidths;
|
KernArray aCharWidths;
|
||||||
tools::Long nTextWidth
|
tools::Long nTextWidth
|
||||||
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aAV, &aCharWidths).nWidth);
|
= basegfx::fround<tools::Long>(pOutDev->GetTextArray(aAV, &aCharWidths).nWidth);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], aCharWidths.get_subunit_array()[0]);
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], aCharWidths[0]);
|
||||||
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], aCharWidths.get_subunit_array()[1]);
|
CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], aCharWidths[1]);
|
||||||
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
// this sporadically returns 75 or 74 on some of the windows tinderboxes eg. tb73
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
|
CPPUNIT_ASSERT_EQUAL(nTextWidth, tools::Long(aCharWidths.back()));
|
||||||
|
|
||||||
// text advance width and line height
|
// text advance width and line height
|
||||||
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
|
CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
|
||||||
|
@ -770,7 +770,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
for (sal_Int32 j = 0; j < nAryLen; ++j)
|
for (sal_Int32 j = 0; j < nAryLen; ++j)
|
||||||
{
|
{
|
||||||
rIStm.ReadInt32( nTmp );
|
rIStm.ReadInt32( nTmp );
|
||||||
aDXAry.set(j, nTmp);
|
aDXAry[j] = nTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #106172# Add last DX array elem, if missing
|
// #106172# Add last DX array elem, if missing
|
||||||
@ -794,9 +794,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
|
|||||||
// difference to last elem and store
|
// difference to last elem and store
|
||||||
// in very last.
|
// in very last.
|
||||||
if( nStrLen > 1 )
|
if( nStrLen > 1 )
|
||||||
aDXAry.set(nStrLen-1, aDXAry[ nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ]);
|
aDXAry[nStrLen-1] = aDXAry[ nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ];
|
||||||
else
|
else
|
||||||
aDXAry.set(nStrLen-1, aTmpAry[ nStrLen-1 ]); // len=1: 0th position taken to be 0
|
aDXAry[nStrLen-1] = aTmpAry[ nStrLen-1 ]; // len=1: 0th position taken to be 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DBG_UTIL
|
#ifdef DBG_UTIL
|
||||||
|
@ -891,13 +891,13 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const OUString& rText, K
|
|||||||
{
|
{
|
||||||
if (!pDXArray.empty())
|
if (!pDXArray.empty())
|
||||||
{
|
{
|
||||||
aOwnArray.assign(pDXArray);
|
aOwnArray.assign(pDXArray.begin(), pDXArray.end());
|
||||||
pDX = aOwnArray;
|
pDX = aOwnArray;
|
||||||
}
|
}
|
||||||
const double fFactor = static_cast<double>(nWidth) / nNormWidth;
|
const double fFactor = static_cast<double>(nWidth) / nNormWidth;
|
||||||
|
|
||||||
for( i = 0; i < ( nLen - 1 ); i++ )
|
for( i = 0; i < ( nLen - 1 ); i++ )
|
||||||
aOwnArray.set(i, basegfx::fround(aOwnArray[i] * fFactor));
|
aOwnArray[i] *= fFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1204,8 +1204,9 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const double fAdjust = static_cast<double>(pA->GetWidth()) / nNormSize;
|
||||||
for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
|
for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
|
||||||
aDXAry.set(i, aDXAry[i] * static_cast<sal_Int32>(pA->GetWidth()) / nNormSize);
|
aDXAry[i] *= fAdjust;
|
||||||
if ( ( nLen <= 1 ) || ( static_cast<sal_Int32>(pA->GetWidth()) == nNormSize ) )
|
if ( ( nLen <= 1 ) || ( static_cast<sal_Int32>(pA->GetWidth()) == nNormSize ) )
|
||||||
aDXAry.clear();
|
aDXAry.clear();
|
||||||
aSrcLineInfo = LineInfo();
|
aSrcLineInfo = LineInfo();
|
||||||
|
@ -677,7 +677,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
|
|||||||
mnIndex ( nIndex ),
|
mnIndex ( nIndex ),
|
||||||
mnLen ( nLen )
|
mnLen ( nLen )
|
||||||
{
|
{
|
||||||
maDXAry.assign(pDXAry);
|
maDXAry.assign(pDXAry.begin(), pDXAry.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaTextArrayAction::MetaTextArrayAction(const Point& rStartPt, OUString aStr, KernArraySpan pDXAry,
|
MetaTextArrayAction::MetaTextArrayAction(const Point& rStartPt, OUString aStr, KernArraySpan pDXAry,
|
||||||
@ -693,7 +693,7 @@ MetaTextArrayAction::MetaTextArrayAction(const Point& rStartPt, OUString aStr, K
|
|||||||
, mnLayoutContextIndex(nLayoutContextIndex)
|
, mnLayoutContextIndex(nLayoutContextIndex)
|
||||||
, mnLayoutContextLen(nLayoutContextLen)
|
, mnLayoutContextLen(nLayoutContextLen)
|
||||||
{
|
{
|
||||||
maDXAry.assign(pDXAry);
|
maDXAry.assign(pDXAry.begin(), pDXAry.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaTextArrayAction::~MetaTextArrayAction()
|
MetaTextArrayAction::~MetaTextArrayAction()
|
||||||
@ -733,7 +733,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
|
|||||||
if ( !maDXAry.empty() && mnLen )
|
if ( !maDXAry.empty() && mnLen )
|
||||||
{
|
{
|
||||||
for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
|
for ( sal_uInt16 i = 0, nCount = mnLen; i < nCount; i++ )
|
||||||
maDXAry.set(i, basegfx::fround(maDXAry[i] * fabs(fScaleX)));
|
maDXAry[i] *= fabs(fScaleX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ OutputDevice::GetPartialTextArray(const OUString& rStr, KernArray* pKernArray, s
|
|||||||
nPartLen = rStr.getLength() - nPartIndex;
|
nPartLen = rStr.getLength() - nPartIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<sal_Int32>* pDXAry = pKernArray ? &pKernArray->get_subunit_array() : nullptr;
|
KernArray* pDXAry = pKernArray;
|
||||||
|
|
||||||
// do layout
|
// do layout
|
||||||
std::unique_ptr<SalLayout> pSalLayout;
|
std::unique_ptr<SalLayout> pSalLayout;
|
||||||
@ -885,16 +885,10 @@ OutputDevice::GetPartialTextArray(const OUString& rStr, KernArray* pKernArray, s
|
|||||||
if (pDXPixelArray)
|
if (pDXPixelArray)
|
||||||
{
|
{
|
||||||
assert(pKernArray && "pDXPixelArray depends on pKernArray existing");
|
assert(pKernArray && "pDXPixelArray depends on pKernArray existing");
|
||||||
int nSubPixelFactor = pKernArray->get_factor();
|
|
||||||
if (mbMap)
|
if (mbMap)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nPartLen; ++i)
|
for (int i = 0; i < nPartLen; ++i)
|
||||||
(*pDXPixelArray)[i] = ImplDevicePixelToLogicWidthDouble((*pDXPixelArray)[i] * nSubPixelFactor);
|
(*pDXPixelArray)[i] = ImplDevicePixelToLogicWidthDouble((*pDXPixelArray)[i]);
|
||||||
}
|
|
||||||
else if (nSubPixelFactor)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < nPartLen; ++i)
|
|
||||||
(*pDXPixelArray)[i] *= nSubPixelFactor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +896,7 @@ OutputDevice::GetPartialTextArray(const OUString& rStr, KernArray* pKernArray, s
|
|||||||
{
|
{
|
||||||
pDXAry->resize(nPartLen);
|
pDXAry->resize(nPartLen);
|
||||||
for (int i = 0; i < nPartLen; ++i)
|
for (int i = 0; i < nPartLen; ++i)
|
||||||
(*pDXAry)[i] = basegfx::fround((*pDXPixelArray)[i]);
|
(*pDXAry)[i] = (*pDXPixelArray)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
vcl::TextArrayMetrics stReturnValue;
|
vcl::TextArrayMetrics stReturnValue;
|
||||||
@ -919,7 +913,7 @@ OutputDevice::GetPartialTextArray(const OUString& rStr, KernArray* pKernArray, s
|
|||||||
return stReturnValue;
|
return stReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputDevice::GetCaretPositions( const OUString& rStr, KernArray& rCaretXArray,
|
void OutputDevice::GetCaretPositions( const OUString& rStr, KernArray& rCaretPos,
|
||||||
sal_Int32 nIndex, sal_Int32 nLen,
|
sal_Int32 nIndex, sal_Int32 nLen,
|
||||||
const SalLayoutGlyphs* pGlyphs ) const
|
const SalLayoutGlyphs* pGlyphs ) const
|
||||||
{
|
{
|
||||||
@ -930,7 +924,6 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, KernArray& rCaretXAr
|
|||||||
nLen = rStr.getLength() - nIndex;
|
nLen = rStr.getLength() - nIndex;
|
||||||
|
|
||||||
sal_Int32 nCaretPos = nLen * 2;
|
sal_Int32 nCaretPos = nLen * 2;
|
||||||
std::vector<sal_Int32>& rCaretPos = rCaretXArray.get_subunit_array();
|
|
||||||
rCaretPos.resize(nCaretPos);
|
rCaretPos.resize(nCaretPos);
|
||||||
|
|
||||||
// do layout
|
// do layout
|
||||||
@ -950,7 +943,7 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, KernArray& rCaretXAr
|
|||||||
for (i = 0; i < nCaretPos; ++i)
|
for (i = 0; i < nCaretPos; ++i)
|
||||||
if (aCaretPixelPos[i] >= 0)
|
if (aCaretPixelPos[i] >= 0)
|
||||||
break;
|
break;
|
||||||
tools::Long nXPos = (i < nCaretPos) ? aCaretPixelPos[i] : -1;
|
double nXPos = (i < nCaretPos) ? aCaretPixelPos[i] : -1;
|
||||||
for (i = 0; i < nCaretPos; ++i)
|
for (i = 0; i < nCaretPos; ++i)
|
||||||
{
|
{
|
||||||
if (aCaretPixelPos[i] >= 0)
|
if (aCaretPixelPos[i] >= 0)
|
||||||
@ -967,21 +960,15 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, KernArray& rCaretXAr
|
|||||||
aCaretPixelPos[i] = nWidth - aCaretPixelPos[i] - 1;
|
aCaretPixelPos[i] = nWidth - aCaretPixelPos[i] - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nSubPixelFactor = rCaretXArray.get_factor();
|
|
||||||
// convert from font units to logical units
|
// convert from font units to logical units
|
||||||
if( mbMap )
|
if( mbMap )
|
||||||
{
|
{
|
||||||
for (i = 0; i < nCaretPos; ++i)
|
for (i = 0; i < nCaretPos; ++i)
|
||||||
aCaretPixelPos[i] = ImplDevicePixelToLogicWidth(aCaretPixelPos[i] * nSubPixelFactor);
|
aCaretPixelPos[i] = ImplDevicePixelToLogicWidthDouble(aCaretPixelPos[i]);
|
||||||
}
|
|
||||||
else if (nSubPixelFactor)
|
|
||||||
{
|
|
||||||
for (i = 0; i < nCaretPos; ++i)
|
|
||||||
aCaretPixelPos[i] *= nSubPixelFactor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nCaretPos; ++i)
|
for (i = 0; i < nCaretPos; ++i)
|
||||||
rCaretPos[i] = basegfx::fround(aCaretPixelPos[i]);
|
rCaretPos[i] = aCaretPixelPos[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputDevice::DrawStretchText( const Point& rStartPt, sal_Int32 nWidth,
|
void OutputDevice::DrawStretchText( const Point& rStartPt, sal_Int32 nWidth,
|
||||||
@ -1266,12 +1253,11 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(
|
|||||||
{
|
{
|
||||||
// convert from logical units to font units without rounding,
|
// convert from logical units to font units without rounding,
|
||||||
// keeping accuracy for lower levels
|
// keeping accuracy for lower levels
|
||||||
int nSubPixels = pDXArray.get_factor();
|
|
||||||
for (int i = 0; i < nJustLen; ++i)
|
for (int i = 0; i < nJustLen; ++i)
|
||||||
{
|
{
|
||||||
stJustification.SetTotalAdvance(
|
stJustification.SetTotalAdvance(
|
||||||
nJustMinCluster + i,
|
nJustMinCluster + i,
|
||||||
ImplLogicWidthToDeviceSubPixel(pDXArray.get_subunit(i)) / nSubPixels);
|
ImplLogicWidthToDeviceSubPixel(pDXArray[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
nEndGlyphCoord = stJustification.GetTotalAdvance(nJustMinCluster + nJustLen - 1);
|
nEndGlyphCoord = stJustification.GetTotalAdvance(nJustMinCluster + nJustLen - 1);
|
||||||
@ -1280,7 +1266,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < nJustLen; ++i)
|
for (int i = 0; i < nJustLen; ++i)
|
||||||
{
|
{
|
||||||
stJustification.SetTotalAdvance(nJustMinCluster + i, pDXArray.get(i));
|
stJustification.SetTotalAdvance(nJustMinCluster + i, pDXArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
nEndGlyphCoord
|
nEndGlyphCoord
|
||||||
|
Loading…
x
Reference in New Issue
Block a user