Hi all,
perhaps someone has an idea how to solve the problems with round dashes.
The problems are
(1)
LibreOffice applies the linecap not only to the true line ends, but to
the dashes too. That might result in contradiction between DashStyle and
LineCap (UNO enums). LibreOffice ignores the draw:style attribute of
draw:stroke-dash element in ODF file format, it depends rounding of
dashes on linecap. I see such behavior too in other application, which
all do not have a special rounding attribute for the dashes. That
includes MS Office, Corel Draw, Scribus and Browsers(SVG). But
LibreOffice uses the DashStyle enum in several switches in the code and
DashStyle is a published enum.
(2)
LibreOffice adds the linecap to the dash length and reduces the space
between the dashes. I see that behavior in Browser(SVG), CorelDraw and
Scribus too. But MS Office rounds the dashes themselves without taken
any part of the space between the dashes.
You can skip the description below. It is only if you need some details.
Kind regards
Regina
ODF defines the dash pattern in the styles.xml file. For example
<draw:stroke-dash draw:name="Var3Dot2Dash" draw:style="rect"
draw:dots1="3" draw:dots1-length="100%"
draw:dots2="2" draw:dots2-length="300%" draw:distance="150%"/>
or
<draw:stroke-dash draw:name="Fix1Dash2Dot" draw:style="round"
draw:dots1="1" draw:dots1-length="0.5cm"
draw:dots2="2" draw:dots2-length="1.5cm" draw:distance="0.3cm"/>
The line style itself has in its graphic-properties (relevant attributes
only) for example
draw:stroke="dash"
draw:stroke-dash="Var3Dot2Dash"
svg:stroke-width="0.6cm"
svg:stroke-linecap="round
Or
draw:stroke="dash"
draw:stroke-dash="Fix1Dash2Dot"
svg:stroke-width="0.6cm"
svg:stroke-linecap="flat"
Possible values of draw:style attribute in the pattern are "rect" and
"round".
Possible values of svg:stroke-linecap in the line style are "flat",
"square" and "round".
From this definition, you would expect, that rounding of dashes is only
defined by the pattern and rounding of the line ends is defined by the
linecap.
UNO has the enum DashStyle in com::sun::star::drawing with values
{ RECT, ROUND, RECTRELATIVE, ROUNDRELATIVE }
RELATIVE corresponds to the ability to have dash length relative to line
width or not. That exists in ODF too as you see in the examples.
And UNO has the struct LineDash with its components
DOTS, DOTLEN, DASHES, DASHLEN, DISTANCE.
The naming DOT and DASH is misleading, because always DOT corresponds to
'dots1' of ODF, and DASH corresponds to 'dot2', regardless of the length
given in DOTLEN and DASHLEN.
For linecaps exists the enum LineCap { BUTT, ROUND, SQUARE }. BUTT means
the same as "flat".
OOXML has the line attribute cap, with values rnd (round), sq (square),
flat. OOXML describes the dashing pattern with a sequence of Dash Stops
elements, each with Dash length and Space length, all length values
relative to line width. Despite of 'dot' in the names od prstDash
presets, there exists no special pattern element 'dot'.
SVG describes the line cap in the stroke-linecap attribute and the
pattern in a stroke-dasharray attribute, which too has dash&space pairs.
SVG uses length with unit and percent values.
VML (Fallback in Word) uses the stroke element with attributes dashstyle
and endcap. The pattern is a series of number pairs for dash length and
space length, relative to line width. VML has some preset names with
'dot', but here too the pattern does not provide a special 'dot' item.
Context
- Relationship between linecap and dashes · Regina Henschel
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.