Mismatch between view in notebook and Inkscape
Opened this issue · 3 comments
Thanks for reporting this issue with how text is displayed. Unfortunately, the dominant-baseline
attribute might be poorly supported by Inkscape (related bug, discussion). Drawsvg is generating the requested SVG but Inkscape is rendering it incorrectly. Interestingly, I see also this when I view it in Firefox (with the Mac Firefox default font_family='Helvetica'
):
More evidence that the dominant-baseline
is not well supported while selecting the text in Inkscape:
I've found the most reliable and portable way to align text in an SVG is by specifying the font with font-family
(so different viewers don't pick different default fonts) and manually offsetting the y-position. Avoid using dominant-baseline
or other advanced attributes. For example:
dw.Text('HELLO', 25, 100, 100+(25*0.8), font_family='Arial', ...)
where 0.8 depends on your font. Either measure this or use some font inspection tool to determine the appropriate value.
Thank you for your reply,
If that's the case maybe it should be mentioned in the 'Quick Reference'
that use of dominant-baseline
is not well supported and discouraged.
I'll create PR to change the docs.
Please do. Your issue really exemplified this.