Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

{/Symbol w} chooses letter omega fom DejaVu font, not Symbol

1,135 views
Skip to first unread message

Giacomo Boffi

unread,
Jun 24, 2011, 6:01:57 AM6/24/11
to
this happens when i use the pdfcairo terminal, that uses the pango
library to render text

# cat test.gp
set term pdfcairo enhanced font "Utopia"
set out 'test.pdf'
set xlabel "{/Symbol w}t"
plot sin(x) t "sin({/Symbol w}t)"
set out
# fc-match symbol ; fc-match utopia
Symbol.pfb: "Symbol" "Regular"
putr8a.pfb: "Utopia" "Regular"
# pdffonts test.pdf
name type emb sub uni object ID
---------------------------- ----------------- --- --- --- ---------
TPHAFU+Utopia Type 1 yes yes yes 5 0
KKVWMP+DejaVuSans CID TrueType yes yes yes 6 0
#

is this a problem with gnuplot or a problem with pango? please help as
the symbol font that is used in my plots doesn't match very well with
the text font
--
termy prende per fatica, attento. -- PLS, in IFQ

James Waldby

unread,
Jun 24, 2011, 11:19:11 AM6/24/11
to
On Fri, 24 Jun 2011 12:01:57 +0200, Giacomo Boffi wrote:
[re letter omega being taken from DejaVu font, not Utopia]

> this happens when i use the pdfcairo terminal, that uses the pango
> library to render text
>
> # cat test.gp
> set term pdfcairo enhanced font "Utopia" set out 'test.pdf'
> set xlabel "{/Symbol w}t"
> plot sin(x) t "sin({/Symbol w}t)"
> set out
> # fc-match symbol ; fc-match utopia
> Symbol.pfb: "Symbol" "Regular"
> putr8a.pfb: "Utopia" "Regular"
> # pdffonts test.pdf
> name type emb sub uni object ID
> ---------------------------- ----------------- --- --- --- ---------
> TPHAFU+Utopia Type 1 yes yes yes 5 0
> KKVWMP+DejaVuSans CID TrueType yes yes yes 6 0 #
>
> is this a problem with gnuplot or a problem with pango?

Apparently neither. From following link it appears that Utopia doesn't
include Greek letters.
<http://code.google.com/p/evristika/issues/detail?id=5>

> please help as the symbol font that is used in my plots doesn't
> match very well with the text font

True. I see that output from
set term pdfcairo enhanced font "DejaVu"
is self-consistent, but perhaps you don't like that font.

--
jiw

James Waldby

unread,
Jun 24, 2011, 12:10:04 PM6/24/11
to
On Fri, 24 Jun 2011 12:01:57 +0200, Giacomo Boffi wrote:
[re letter omega being taken from DejaVu font, not Symbol]

Please ignore my earlier reply; because the omega should have been
drawn from the Symbol font, it apparently shouldn't matter that
Utopia doesn't have Greek letters. (It might be better to be able to
specify within gnuplot the name of a symbols font, rather than that
name being externally specified -- eg, gnuplot's help pdfcairo seems
to say to use 'usual fonts subsystems' for Symbol font control.)

Anyhow, as a work-around for the specific omega problem, if you
scale the omega to be a little smaller it may look good enough.
For example:
set xlabel "{/Symbol=5 w}t"
plot sin(x) t "sin({/Symbol=5 w}t)"

--
jiw

Giacomo Boffi

unread,
Jun 25, 2011, 8:44:07 AM6/25/11
to
James Waldby <n...@valid.invalid> writes:

>> # fc-match symbol ; fc-match utopia
>> Symbol.pfb: "Symbol" "Regular"
>> putr8a.pfb: "Utopia" "Regular"

> It might be better to be able to specify within gnuplot the name of


> a symbols font, rather than that name being externally specified --
> eg, gnuplot's help pdfcairo seems to say to use 'usual fonts
> subsystems' for Symbol font control.

for libcairo/libpango the usual fonts subsystem is, on linux,
fontconfig and fontconfig (see above the quoted text from my OP) knows
that symbol is a reference to (the URW clone of) the Adobe font

is it possible that my problem is a utf8 vs ascii problem? gnuplot
pdfcairo's help say something about utf8 but, i must confess, a
chicken has a better understanding of utf8 than mine

thank you for the (omitted) workaround

James Cloos

unread,
Jul 2, 2011, 2:39:02 PM7/2/11
to
If you look at gnuplot/src/wxterminal/gp_cairo.c (which is called not
only by the wxt terminal but also by the pdfcairo and pngcairo terminals),
you find this:

,----
| #ifdef MAP_SYMBOL
| /* we have to treat Symbol font as a special case */
| if (!strcmp(plot->fontname,"Symbol")) {
| FPRINTF((stderr,"Parsing a Symbol string\n"));
| string_utf8 = gp_cairo_convert_symbol_to_unicode(plot, string);
| strncpy(plot->fontname, gp_cairo_default_font(), sizeof(plot->fontname));
| symbol_font_parsed = TRUE;
| } else
| #endif /*MAP_SYMBOL*/
`----

where gp_cairo_default_font() is:

,----
| const char *
| gp_cairo_default_font(void)
| {
| #ifdef WIN32
| return "Tahoma";
| #else
| return "Sans";
| #endif
| }
`----

On most fontconfig installs Sans maps to DejaVu Sans.

Without changing the gnuplot src, the only way to get pdfcairo to use
something other than Sans (or Tahoma on doze) for Symbol is to do the
Symbol→utf8 conversion yourself. Eg:

,----
| set term pdfcairo enhanced font "DejaVu Serif,18"
| set out 'test.pdf'
| set xlabel "ωt"
| plot sin(x) t "sin(ωt)"
| set out
`----

Note the use of U+03C9 GREEK SMALL LETTER OMEGA instead of {/Symbol w}.

You still have to choose a font which contains glyphs for all of the
characters you want to use, and you will need to have your $LANG set
to a UTF-8 locale, such as LANG=en_US.UTF-8 (adjusted as appropriate
for your language and country).

The funtion gp_cairo_convert_symbol_to_unicode() in that src file
shows the conversion the cairo-based terms use for /Symbol.

Or, if you compile gnuplot yourself, you can edit gp_cairo_default_font().
PanGo, though, probably will still fall back to Sans for any characters
not supported by your chosen font.

-JimC
--
James Cloos <cl...@jhcloos.com> OpenPGP: 1024D/ED7DAEA6

Giacomo Boffi

unread,
Jul 25, 2011, 4:44:34 PM7/25/11
to
James Cloos <cl...@jhcloos.com> writes:

> [...] The funtion gp_cairo_convert_symbol_to_unicode() in that src


> file shows the conversion the cairo-based terms use for /Symbol.

thank you very much James, yours is the explanation i was looking for;
i'll probably use epslatex + epspdf in the future

again, thank you very much

0 new messages