Skip to content

Support for numeric units #1639

Description

@MewPurPur

Feature Description

Numeric attributes often have units: https://www.w3.org/TR/SVG11/coords.html

In GodSVG, units are not only not handled, but they outright break without warning, since numeric fields do expect a specific format. I'm shocked not to have received any reports about this yet, so let's get ahead of that.

I have no concrete implementation details yet. I'll add things below as I learn:

Percentages are a wild card

The SVG's width and height can be defined in centimeters. In that case, percentages use real world units.

Also, attributes already have 4 different percentage handlings, but they seem to closely align with what units are allowed too, so the percentage handling and number ranges may be merged into a single setting. But probably not. I don't know--

Units are not accepted universally

Accepts \ Range Any Only positive Fraction
Units
% and units x1, x2, x, cx, fx, y1, y2, y, cy, fy stroke-dashoffset rx, ry, r, width, height, stroke-width
% opacity, fill-opacity, stroke-opacity, stop-opacity, offset
None stroke-miterlimit

(some of the above might not be implemented yet, they are for future reference)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions