Comment 38 for bug 168164

Revision history for this message
su_v (suv-lp) wrote :

> Inkscape welcome to the world on text points !

A. Hard-coding the units (r11608) in the style attribute of text objects potentially does cause trouble if the SVG file is rendered by other viewers (e.g. web browsers). Text with units other than 'px' apparently may scale differently than the rest of the objects in the same drawing.

Attached sample SVG file contains 5 basic text objects with different units for font size (file is based on the default template, no transforms or viewBox atrtibutes involved, all texts use explicitly set font family 'DejaVu Sans'):
- On top are the text objects with a black fill.
- Stacked beneath is a copy of the text converted to path in Inkscape, with a red fill.
- Stacked at the bottom is a rectangle with the dimensions of the bounding box of the text as rendered in Inkscape.
Each text object (and its outlined copy as well as the bounding box rectangle) was created with a different preference setting for the font size unit:
1) In Inkscape, all text objects are rendered in the same size (even though the units differ).
2) In tested web browsers (Firefox, Chromium, Opera, Safari) and in Squiggle (Batik 1.7) on OS X 10.7.4, the text objects except the one with 'px' font size are rendered in different sizes and no longer match the outlined copy (group of paths) below nor the bounding box rectangle.

B. Hard-coding the units (r11608) in the style attribute may also cause trouble when using a viewBox attribute for the top-level <svg> node (recommended way in SVG to define real units/dimensions of the drawing content), which requires that everything in the actual drawing content is based on SVG user units (px) only.

An alternative solution would be to use the font size units only for the GUI (as it is handled elsewhere in Inkscape when a different unit is chosen), so that the SVG content itself does not mix different units.