611 (and its fix #612 ) uncovered the fact we have a bit of code rot in vg's handling of fonts (and especially locating fonts)
originally, vg would load ttf files according to a list of directories (vg.FontDirs, optionally seeded from $VGFONTPATH) with some default pre-packaged fonts under vg/fonts directory.
nowadays, vg/fonts doesn't hold any ttf files, just a regular Go package with []byte of the content of ttf fonts.
we should probably revamp or at least consolidate a bit how fonts are handled in gonum/plot.
[x] drop completely the code that was at fault in #611
[x] expose an API that relies on either []byte as ttf fonts input or just on freetype/truetype.Font (or on x/image/font/sfnt.Font, when it's ready)
[x] consider relying on x/image/font.Face (so we can switch between truetype.Font and sfnt.Font more easily)
[x] consider exposing a fonts.Handler to gather a set of fonts (e.g.: normal, bold, italics, math). it could be passed to plot.New (and thus not require to return (*Plot, error) but just *Plot)
611 (and its fix #612 ) uncovered the fact we have a bit of code rot in vg's handling of fonts (and especially locating fonts)
originally,
vg
would load ttf files according to a list of directories (vg.FontDirs
, optionally seeded from$VGFONTPATH
) with some default pre-packaged fonts undervg/fonts
directory.nowadays,
vg/fonts
doesn't hold any ttf files, just a regular Go package with[]byte
of the content of ttf fonts.we should probably revamp or at least consolidate a bit how fonts are handled in gonum/plot.
[]byte
as ttf fonts input or just onfreetype/truetype.Font
(or onx/image/font/sfnt.Font
, when it's ready)x/image/font.Face
(so we can switch betweentruetype.Font
andsfnt.Font
more easily)fonts.Handler
to gather a set of fonts (e.g.: normal, bold, italics, math). it could be passed toplot.New
(and thus not require to return(*Plot, error)
but just*Plot
)