I am implementing SVG Tiny 1.1 and I am having trouble understanding the "user unit" concept.
SVG 1.1 specification defines every <length> with no specified unit (such as "mm", "cm", "pt", etc) to be in "user unit".
While implementing interface "SVGLength", I encountered 4 attributes related to the value of the length; value
, unityType
, valueInSpecifiedUnit
, valueAsString
. The last 3 attributes are clear enough for me.
valueInSpecifiedUnit
is in unit type unitType
.valueAsString
equals valueInSpecifiedUnit
+unitType
's string value. Eg: "10mm"However, the attribute value is said to be in user unit. So my questions are:
Regards,
So the "user unit" is defined in outmost svg element's width and heigth attributes. Examples: <svg width="20cm" heigth="10cm"> then user unit is "cm". <svg width="200px" heigth="100px"> then user unit is "px".
Unit User means an individual user of a Licensed Unit who is an officer, director, employee, contractor, representative, or agent of User or User's Affiliate. Sample 1.
The spec says:
user units
A coordinate value or length expressed in user units represents a coordinate value or length in the current user coordinate system. Thus, 10 user units represents a length of 10 units in the current user coordinate system.
Also:
if the ‘width’ or ‘height’ attributes on the outermost svg element are in user units (i.e., no unit identifier has been provided), then the value is assumed to be equivalent to the same number of "px" units
which means that user units are the units specified in the outermost svg element's width and height attributes, and if they are not specified, then user units are pixels.
Read the section on units in SVG.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With