
Am Freitag, 19. Februar 2016, 15:49:59 schrieb Tavmjong Bah:
Hi,
Hi,
I'll try to give a short summary of font-size and line-height in Inkscape (and SVG).
thank you very much for your explanation. Most of which I already figured out, but the part about pt being non-fixed wasn't clear to me (and as others wrote, I think it's a bad decision).
[...]
Inkscape specifies 'font-size' internally in terms of user units (for the reason given above). What is shown in the GUI depends on the setting of the "Text unit" preference found in the Inkscape Preference dialog under the Text tool tab. The default value was changed to "pt"
Actually it isn't in all places, see below.
from "px" so by default the numerical value stored in the SVG file is 4/3 the value displayed in the Text tool tool bar. This creates rounding errors (I do not like this change).
Me neither. :)
SVG/CSS dictate that the font size ('font-size' property) is based on the 'em box' which is the 'accent' value + the 'decent' value as given in the font. This is NOT the Cap Height (the green line in your PNG). Some fonts include a value for 'leading'. This is ignored.
I know, no idea why I got that confused there.
The interline spacing is given by the 'line-height' property. Line height is the distance from one baseline to the next baseline. The Inkscape GUI currently allows setting this value only based on a percentage of the 'font-size'.
That is fine, however, the Inkscape GUI doesn't mention line height but line spacing. So it's actually off by 1. The look of the default "1" setting should be achieved by setting the GUI value to "0". Either that, or the tooltip should be changed to mention line height instead of spacing.
[...]
So, besides the wrong tooltip that caused much of my confusion there is also the status bar which shows the font name and size of selected objects. However, it
- uses the default display unit and not the font unit and - doesn't take the document's view box scaling (as described by you above) into account.
Attached you will find a patch to fix both. I am not sure if it's the right way to do it, it feels as if I mixed old C and new C++ API, but I couldn't find a pure C++ way to handle it.
Tav
Tobias
[...]