Guides positions not stored in user unit (precision)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
Alvin Penner |
Bug Description
Open the A4 template which defines user unit as mm or set mm as default unit in the default template. Drag a guide and explicitly set its absolute position to 10,10 (mm, of course; not worth specifying this as it's the default unit) entering the coordinates in the X and Y fields of the "Guideline" dialog with "Relative change" unchecked.
In the saved document the guide position is stored as:
position=
that corresponds to 10,10 mm calculated in px @ 90 DPI, arbitrary numbers unrelated to the document content.
The correct output should be:
position="10,10"
to be interpreted considering the user unit:
units="mm"
and coherently with the specified document extent:
width="210mm"
height="297mm"
viewBox="0 0 210 297"
without any additional conversion.
Among other annoyances, this discrepancy causes rounding errors during the conversions of guides' positions to user unit, affecting all objects that are subsequently snapped to them.
For example: in the A4 template manually place 2 guides at 200,297 and 210,287 (10x10 aligned to the upper right corner of the page), save the file, reload it, draw a rectangle between the two origins and save again; the rectangle is stored in the file as:
<rect
style="..."
id="rect..."
width="10"
x="200"
where 'height' should be "10" and 'y' should be "0".
This makes guides useless for snapping objects and have them getting exact coordinates in the final document, as is usually required in technical drawings. Lowering the output precision is not always a viable solution because it may affect nodes that really need more digits after the dot (e.g. a small complex symbol where only the origin is of interest to be "clean" or guides snapped to intersections where the highest available precision is expected).
If repeating the preceding example without saving and reloading the file before drawing the rectangle, the output is slightly better because 'height' is correctly stored as "10" but 'y' is still "wrong": this makes me think that there probably are also problems in managing objects' coordinates internally while storing and elaborating them in RAM. IMHO everything should be done in user unit, to always preserve the final output at best.
Results obtained with:
inkscape:
Related branches
tags: | added: guides precision units |
Changed in inkscape: | |
milestone: | none → 0.91 |
Changed in inkscape: | |
milestone: | 0.91 → 0.92 |
summary: |
- Guides positions not stored in user unit + Guides positions not stored in user unit (precision) |
Changed in inkscape: | |
assignee: | nobody → Alvin Penner (apenner) |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
Related/similar: bug #bug #1235279