office-gobmx/include/drawinglayer/primitive2d
Mike Kaganski cc3663bbae tdf#160702: improve text positioning
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>
2024-04-20 11:28:34 +02:00
..
animatedprimitive2d.hxx
backgroundcolorprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
baseprimitive2d.hxx use more UNLESS_MERGELIBS 2024-02-12 20:25:54 +01:00
bitmapprimitive2d.hxx
borderlineprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
BufferedDecompositionGroupPrimitive2D.hxx use more UNLESS_MERGELIBS 2024-02-12 20:25:54 +01:00
BufferedDecompositionPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
CommonTypes.hxx
controlprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
discretebitmapprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
discreteshadowprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
drawinglayer_primitivetypes2d.hxx Provide tooling for EditView exclusive Primitives 2024-03-21 16:07:44 +01:00
embedded3dprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
epsprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
exclusiveeditviewprimitive2d.hxx Provide tooling for EditView exclusive Primitives 2024-03-21 16:07:44 +01:00
fillgradientprimitive2d.hxx loplugin:finalmethods 2024-03-26 17:16:47 +01:00
fillgraphicprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
fillhatchprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
glowprimitive2d.hxx
graphicprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
gridprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
groupprimitive2d.hxx loplugin:finalmethods 2024-03-26 17:16:47 +01:00
helplineprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
hiddengeometryprimitive2d.hxx
invertprimitive2d.hxx
markerarrayprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
maskprimitive2d.hxx
mediaprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
metafileprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
modifiedcolorprimitive2d.hxx
objectinfoprimitive2d.hxx
pagehierarchyprimitive2d.hxx
pagepreviewprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
patternfillprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
pointarrayprimitive2d.hxx
PolygonHairlinePrimitive2D.hxx use more UNLESS_MERGELIBS 2024-02-12 20:25:54 +01:00
PolygonMarkerPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolygonStrokeArrowPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolygonStrokePrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolygonWavePrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonColorPrimitive2D.hxx use more UNLESS_MERGELIBS 2024-02-12 20:25:54 +01:00
PolyPolygonGradientPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonGraphicPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonHairlinePrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonHatchPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonMarkerPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonSelectionPrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
PolyPolygonStrokePrimitive2D.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
Primitive2DContainer.hxx
Primitive2DVisitor.hxx
primitivetools2d.hxx loplugin:finalmethods 2024-03-26 17:16:47 +01:00
sceneprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
sdrdecompositiontools2d.hxx
shadowprimitive2d.hxx
softedgeprimitive2d.hxx
structuretagprimitive2d.hxx tdf#159067 drawinglayer: fix untagged form control (PDF/UA export) 2024-01-19 11:55:12 +01:00
svggradientprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
textbreakuphelper.hxx
textdecoratedprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
textenumsprimitive2d.hxx
texthierarchyprimitive2d.hxx Disable EditViewActive when Metafile output 2024-03-21 21:39:34 +01:00
textlayoutdevice.hxx tdf#160702: improve text positioning 2024-04-20 11:28:34 +02:00
textprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00
Tools.hxx
transformprimitive2d.hxx tdf#108037 Reduce time and memory consumed exporting to PDF 2024-02-05 12:10:58 +01:00
transparenceprimitive2d.hxx
unifiedtransparenceprimitive2d.hxx
wrongspellprimitive2d.hxx make BufferedDecompositionPrimitive2D store a Primitive2DReference.. 2024-02-12 11:36:05 +01:00