vg: remove {Add,Make}Font
sbinet opened this issue · 3 comments
as #693 was proof, keeping vg.AddFont
and vg.MakeFont
is confusing.
they were kept because x/image/font/sfnt.Font
didn't have the ability to give back access to the original []byte
(or io.Reader
) raw TTF data.
that's no longer the case thanks to https://go-review.googlesource.com/c/image/+/291149
- remove
AddFont
- remove
MakeFont
- remove
FontMap
? - remove
vg/fonts
(used byvgpdf
) - remove use of
vg.{Add,Make}Font{,Map}
invg/vgpdf
- remove use of
vg.{Add,Make}Font{,Map}
invg/vggio
(AFAICT, vg.FontMap
is only used in plot/vg/vgpdf
to embed fonts. with the x/image
CL above being merged, we don't need vg.FontMap
there either.)
SGTM
JFYI: I've tried to have a plot rendered to SVG using another default font (plot.DefaultFont = font.Font{Typeface: "Arial"}
). This was incredibly painful to get going up to a certain point. Along the way it just crashes, because FontFaces are accessed without checking if they are nil
. To work around that, I needed to make font directories known to the vg
package, then use vg.MakeFont()
to obtain a Face
, then register this face with the DefaultFontCache
. Only to have it fail regardless, because the SVG renderer has a hard-coded, non-changeable map of type faces to CSS style strings. :-(