Implementing SVG attribute "stroke-miterlimit" ( tdf#48066)

Regina Henschel rb.henschel at t-online.de
Wed Mar 30 19:54:37 UTC 2016


Hi all,

I have started now and come immediately to the next design decision:

The svg attribute stroke-miterlimit is of type <number> in SVG, which is 
in context of SVG attributes essentially a 'double'. The meaning of this 
attribute is a ratio. Therefore in SVG is has no unit.
[https://www.w3.org/TR/SVG/painting.html#StrokeMiterlimitProperty]
[https://www.w3.org/TR/SVG/types.html#DataTypeNumber]

But LO imports it into the member 'SvgNumber maStrokeMiterLimit' of an 
object of class SvgStyleAttributes. And class SvgNumber has a member 
'SvgUnit meUnit'. In the ctor of SvgNumber the member meUnit defaults to 
'Unit_px', if not given. But any unit is wrong for stroke-miterlimit.

Possible solutions
(1) Change the type of maStrokeMiterLimit' to 'double' and change its 
name to 'mfStrokeMiterLimit'. That would loose the ability to track, 
whether the value was found in the file or set by LO. In case not set in 
the SVG file, it would be set to 4.0, as specified as initial value in 
SVG spec.
(2) Extend the enum SvgUnit by an item 'Unit_none'. This likely requires 
changes in places where SvgUnit is used. The member mfNumber of class 
SvgNumber is already a 'double' and would fit.

My favorite is (2). What do you think?

Kind regards
Regina


More information about the LibreOffice mailing list