#1240 bold font in enhanced terminals broken

5.0
closed-fixed
nobody
None
5
2014-09-04
2013-05-09
Andrew Rasmussen
No

This is a copy of this SO post.

I am having difficulty getting gnuplot to create labels with bold and enhanced text in non-postscript terminals. The following script


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env gnuplot

reset

set terminal pdfcairo enhanced color lw 3 size 3,2 font 'Arial-Bold'
set output 'output.pdf'

set tics scale 0

plot -x title 'normal text', \
-2*x t 'enhanced_{text}', \
-3*x t '{/Arial-Bold attempt to specify_{font}}'

set terminal pngcairo enhanced color lw 3 size 400,300 font 'Arial-Bold'
set output 'output.png'
replot

set terminal postscript enhanced color lw 3 size 6,4 font 'Arial-Bold'
set output 'output.eps'
replot

reset

Produces the following eps (converted to png with convert output.eps -rotate 90 outputeps.png):

eps image

which is fine. However, when I use the pdf (or png) terminal the result looks like this:

pdf image

Note that while all the label text should be bold, only the label without any enhanced text is bold. In addition, when I try to manually specify the font (last line title) the font is different (reverts to the default?).

Is this behavior I should expect when not using the postscript terminal? Is there another way to specify fonts (i.e. is the naming scheme different outside of postscript)?

(If the images don't show up, check the SO link at the top of this ticket.)

Discussion

  • Karl Ratzsch
    Karl Ratzsch
    2013-06-02

    A similar problem turned up to me (i think it was discussed on c.g.a.gnuplot newsgroup a month ago). The reason for this behaviour is that the font handling is done by the terminal drivers, and the *cairo terminals don´t handle font attributes at the moment.

    See also https://sourceforge.net/p/gnuplot/feature-requests/363/

     
  • Ethan Merritt
    Ethan Merritt
    2014-03-13

    Revamped bold/italic markup in enhanced text strings is now in 4.7 cvs. Please give it a try, since the run-up to version 5rc1 is a good time to tweak it if there are still problems.

    The syntax is now
    "normal text {/Times:Bold boldface-newfont} {/:Italic slanted-default-font } back to normal text"

     
  • Ethan Merritt
    Ethan Merritt
    2014-03-13

    • status: open --> pending-fixed
     
  • Ethan Merritt
    Ethan Merritt
    2014-03-23

    • status: pending-fixed --> closed-fixed