cc3663bbae
Opening an SVG with text in different elements (e.g., tspans) in the same text element performs calculations to position the parts properly (i.e., the next part will start where the previous part ended, unless the position in overridden explicitly). These calculations require to know the text widths. The first problem leas here: the text width was calculated for a typically small text size (numerically equal to the pixel size defined in the SVG), but these calculations aren't truly linear, because font rendering may change depending on font height. Additionally, the rounding gives much higher error in smaller sizes than in larger. There was already a workaround for a similar problem in ViewRedirector::createRedirectedPrimitive2DSequence, where a large font (with 100 times greater height) was used to increase correctness. This was also used here, with the same large height (50000) used as a reference. Then, at the time of wrawing the text at different zoom levels, the code in VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D creates a font of a calculated size, and uses it to output the text. But the font is always created with an integral height, which means, that for a wanted height of 2.5 (in a zoomed out view), the really used height will be 3, which is 20% larger; or for wanted height of 2.4, the actual height will be 2 (20% smaller). This resulted in odd jumps of the text widths, when the text may overlap the following part, or conversely, create a big gap before the next gap. To try to mitigate that, the function now takes the difference between the wanted and the actual font size into account, and adjusts the MapMode accordingly. This doesn't fix the jumping completely (e.g., because of the mentioned special handling of small font sizes in the fonts thenselves, like hinting), but still makes the calculations much more stable, decreasing the amount of jumping. Similar changes are made in TextLayouterDevice. Use of the functions that return text size as a double, not rounded value, should additionally help improving stability. Change-Id: I455845d8ca43ee9c06a0fc980947f35d8a25797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166238 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> |
||
---|---|---|
.. | ||
animatedprimitive2d.hxx | ||
backgroundcolorprimitive2d.hxx | ||
baseprimitive2d.hxx | ||
bitmapprimitive2d.hxx | ||
borderlineprimitive2d.hxx | ||
BufferedDecompositionGroupPrimitive2D.hxx | ||
BufferedDecompositionPrimitive2D.hxx | ||
CommonTypes.hxx | ||
controlprimitive2d.hxx | ||
discretebitmapprimitive2d.hxx | ||
discreteshadowprimitive2d.hxx | ||
drawinglayer_primitivetypes2d.hxx | ||
embedded3dprimitive2d.hxx | ||
epsprimitive2d.hxx | ||
exclusiveeditviewprimitive2d.hxx | ||
fillgradientprimitive2d.hxx | ||
fillgraphicprimitive2d.hxx | ||
fillhatchprimitive2d.hxx | ||
glowprimitive2d.hxx | ||
graphicprimitive2d.hxx | ||
gridprimitive2d.hxx | ||
groupprimitive2d.hxx | ||
helplineprimitive2d.hxx | ||
hiddengeometryprimitive2d.hxx | ||
invertprimitive2d.hxx | ||
markerarrayprimitive2d.hxx | ||
maskprimitive2d.hxx | ||
mediaprimitive2d.hxx | ||
metafileprimitive2d.hxx | ||
modifiedcolorprimitive2d.hxx | ||
objectinfoprimitive2d.hxx | ||
pagehierarchyprimitive2d.hxx | ||
pagepreviewprimitive2d.hxx | ||
patternfillprimitive2d.hxx | ||
pointarrayprimitive2d.hxx | ||
PolygonHairlinePrimitive2D.hxx | ||
PolygonMarkerPrimitive2D.hxx | ||
PolygonStrokeArrowPrimitive2D.hxx | ||
PolygonStrokePrimitive2D.hxx | ||
PolygonWavePrimitive2D.hxx | ||
PolyPolygonColorPrimitive2D.hxx | ||
PolyPolygonGradientPrimitive2D.hxx | ||
PolyPolygonGraphicPrimitive2D.hxx | ||
PolyPolygonHairlinePrimitive2D.hxx | ||
PolyPolygonHatchPrimitive2D.hxx | ||
PolyPolygonMarkerPrimitive2D.hxx | ||
PolyPolygonSelectionPrimitive2D.hxx | ||
PolyPolygonStrokePrimitive2D.hxx | ||
Primitive2DContainer.hxx | ||
Primitive2DVisitor.hxx | ||
primitivetools2d.hxx | ||
sceneprimitive2d.hxx | ||
sdrdecompositiontools2d.hxx | ||
shadowprimitive2d.hxx | ||
softedgeprimitive2d.hxx | ||
structuretagprimitive2d.hxx | ||
svggradientprimitive2d.hxx | ||
textbreakuphelper.hxx | ||
textdecoratedprimitive2d.hxx | ||
textenumsprimitive2d.hxx | ||
texthierarchyprimitive2d.hxx | ||
textlayoutdevice.hxx | ||
textprimitive2d.hxx | ||
Tools.hxx | ||
transformprimitive2d.hxx | ||
transparenceprimitive2d.hxx | ||
unifiedtransparenceprimitive2d.hxx | ||
wrongspellprimitive2d.hxx |