From: Jae-Joon Lee <lee.joon@gm...> - 2008-12-18 23:34:08
This post is related with a bug reported in
John assigned this to me, and I thought it is better to discuss with others.
First of all, I actually don't know much about the svg, so others
(someone who wrote the svg backend?) may give much better answer than
Anyhow, I guess there are two issues related.
1) As Jacob said, all the text in MPL is actually left-aligned. MPL
internally calculates the needed offset according to the alignment,
and make all the text left-aligned.
2) The resulting texts have wrong alignment If svg renderer picks up
different font than what MPL used to calculate the offset. This does
not happen if embed_char_paths=True.
I'm not sure whether we need to concern about the first issue. We may
delegate alignment of text to svg renderer as Jacob suggested. This
may be useful when one wants to edit the output svg file using tools
like inkscape. MPL still need to calculate the offset due to different
alignment to support things like (fancy)box around the text. I'm
personally happy with the way it is, though.
The second issue may need some work. The best way I can think of is to
embed the font inside the svg file (but this has a license issue,
although we're doing it now anyway). As of now, when embed_char_paths
is True, the glyphs of each character are embedded as paths, not as a
font. It will be relatively easy to change the current code to make
the embed path as a font, although handling of kerning and such will
be quite difficult. We may include svg font with kerning information
in the mpl distribution (as we do for some ttf and other fonts now)
and embed these fonts to the ouput file.
I guess, it all depends on how strongly we want to support the
post-editing of the output svg file.
So, how others think?