Adding font attributes is inconsistent across terminals (and is not very well documented). Also error messages from the font handling libraries are not passed on the console, which i think would be desireable. (only the non-graphic gnuplot.exe windows version does, in some cases)
I´d advocate feeding the string with the font specification to a terminal-independant function, that then returns the separated informations to the terminal driver.
I guess the standard way should be to separate font, attribute(s) and size by comma, as commas do not (one hopes) appear in font names (as opposed to hyphens and spaces). Everything case-insensitive.
For backward compatibility, the size should be first removed from the back of the font string, then "Bold",bold,"Italic","italic" (from the back, including
"-" and "," before them), and the rest be fed to pango et al. This should take care that no font name gets damaged, and catch all parameters.
Also there would be no need to escape hyphens in font names, then, as was recently proposed on c.g.a.gnuplot.
And fonts can end on a number, so removing the size needs to check if there is a space or comma before it.
i found out this for current terminals:
X11 must use comma, but accepts lowercase attribute.
wxt(cairo), windows and pdf enforces space, and first letter must be uppercase.
windows expects a font size after a comma, and then switches to font size 1 if no number follows
wxt accepts "Bold-Italic", windows ignores the -Italic.
postscript allows hyphen both between font name and attribute and two attributes, also accepts spaces
gp was 463 official windows build, x11 terminal on gp443/debian_lenny
Log in to post a comment.