Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1747 > unrolled thread

pdfcairo terminal and spaces/hyphens in font names

Started by"Ed Bennett" <ed.bennett@ntlworld.com>
First post2013-04-06 22:58 +0100
Last post2013-04-09 02:05 +0100
Articles 2 — 1 participant

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  pdfcairo terminal and spaces/hyphens in font names "Ed Bennett" <ed.bennett@ntlworld.com> - 2013-04-06 22:58 +0100
    Re: pdfcairo terminal and spaces/hyphens in font names "Ed Bennett" <ed.bennett@ntlworld.com> - 2013-04-09 02:05 +0100

#1747 — pdfcairo terminal and spaces/hyphens in font names

From"Ed Bennett" <ed.bennett@ntlworld.com>
Date2013-04-06 22:58 +0100
Subjectpdfcairo terminal and spaces/hyphens in font names
Message-ID<op.wu43b6cbzrz2e1@aluminiumdreams.local>
Greetings,

I've been trying to generate plots for a paper in gnuplot 4.6
  (upgraded to 4.6.2 to double-check). I'm using the enhanced
  pdfcairo terminal on OS X.

I've not been able to consistently set fonts with it when the fonts
have spaces or hyphens in the name. To set the main plot font
I've been using set term pdfcairo enhanced font "[fontname],[size]",
which works for fonts with spaces in their name. However, if the
font has a hyphen in its name (e.g. BKM-cmr12) then the hyphen
is replaced with a space, and Pango complains it can't find the font.
Meanwhile for setting fonts locally in text elements, I've been using
{/[fontname] text}, which works for fonts with hyphens in their
name but not spaces. I've tried using spaces, hyphens, spaces
escaped with a backslash, and omitting the spaces; all results give
Pango warnings for missing fonts, and with both the space and
escaped-space versions only the first word (with or without
backslash) is looked for.

This means, among other things, that all bold and italic variants
are unavailable as they are supposed (I think) to be accessed by
putting " Italic"/" Bold" after the font name; the space breaks things.
I've worked around this in part by using FontForge to create versions
of italic fonts I need that have no spaces in their names, but that is
time-consuming and irritating.

Is this a known bug, or is there some way to work around it?

Thanks

Ed

[toc] | [next] | [standalone]


#1751

From"Ed Bennett" <ed.bennett@ntlworld.com>
Date2013-04-09 02:05 +0100
Message-ID<op.wu81byw0zrz2e1@aluminiumdreams.local>
In reply to#1747
On Sat, 06 Apr 2013 22:58:44 +0100, Ed Bennett <ed.bennett@ntlworld.com>  
wrote:
> However, if the
> font has a hyphen in its name (e.g. BKM-cmr12) then the hyphen
> is replaced with a space, and Pango complains it can't find the font.
> Meanwhile for setting fonts locally in text elements, I've been using
> {/[fontname] text}, which works for fonts with hyphens in their
> name but not spaces. I've tried using spaces, hyphens, spaces
> escaped with a backslash, and omitting the spaces; all results give
> Pango warnings for missing fonts, and with both the space and
> escaped-space versions only the first word (with or without
> backslash) is looked for.

Hi again,

I've delved into the source, and solved part of the problem; the  
substitution for - was occurring in gp_cairo_set_font, but not in  
enhanced_recursion, where I've added a similar substitution (but changed  
both cases to "|" to avoid the breaking of hyphenated fonts; I've never  
seen a font with a pipe in) -- this now works, allowing fonts with spaces  
in their names. Unfortunately, Bold and Italic fonts still can't be  
specified in enhanced text, since the parsing of the specifiers is also  
carried on in gp_cairo_set_font (and this time can't be done in  
enhanced_recursion as it's terminal-dependent). From what I can see (since  
I don't completely understand the code), gnuplot should be calling  
gp_cairo_set_font to set the font from the enhanced text, but obviously  
that's not what's going on since the - substitution was not working, and  
neither is the Bold/Italic one. So the question is how is the font being  
changed at all given that it's not being done through gp_cairo_set_font...

Any answers would be much appreciated!

Cheers

Ed

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web