|
From: Maxim N. <m.a...@gm...> - 2013-04-26 16:53:35
|
On 26.04.2013 10:51, sfeam (Ethan Merritt) wrote:
> On Thursday, 25 April 2013, Maxim Nikulin wrote:
>> Handle font style and weight in enhanced strings
>> (e.g. "sin({/Serif:Italic x})") for cairo-based terminals.
>
> So in a nutshell, the basic idea in your patch is to set the font using
> pango_font_description_from_string(). That does seem like a
> promising approach, although it would only address the cairo terminals.
The problem is that gp_cairo_add_attr() function is not aware of font
attributes. gp_cairo_set_font() knows about italic and bold fonts but
it can not be directly employed. I was trying to avoid writing a special
function for parsing of font attributes or reorganizing of
gp_cairo_set_font() for more general case. The benefit of
pango_font_description_from_string() is the ability to omit font family
retaining only an attribute and, perhaps, support of condensed and small
caps variants. The limitations are that font size is ignored in the font
string and that in gnuplot comma is used to separate font and size in
the term and label options. Pango supports comma-separated list of font
families for the cases of missed fonts. Personally I do not like that
there no special values "unspecified" for style, weight, etc. in pango
text attributes, however font family can be null and font size can be
zero if there are no explicit values ("{/Bold {/Italic is not bold
italic}}").
I was looking for a function having functionality similar to fc-match
fontconfig utility and I found pango_font_description_from_string().
Concerning other terminal, I faced the problem when my old script,
written for the postscript eps terminal, produced worse figure with
pdfcairo. I am not an active user of SVG and EMF, so I do not know the
level of enhanced text support there. I suppose, special font for a part
of a label is worth only for the plots intended for publications.
In the previous message I forgot to mention that font family can be
written without spaces (and must be for "{/TimesNewRoman f}" strings).
It can be not obvious to users.
--
Maxim Nikulin
|