#1086 Plot margins incorrect for cairolatex

Drivers (161)


the plot margins for cairolatex are incorrect. The bottom margin is far too big for the default settings, and the offset of the xtic labels is too small. See the following script which creates plots with:
1. cairolatex and default settings
2. pdfcairo and default settings
3. pdfcairo with fontscale 0.95 which gives the same h_char and v_char values as cairolatex with the default settings.

set xlabel 'xlabel'
set ylabel 'ylabel'

set terminal cairolatex pdf standalone
set output 'cairolatex.tex'
plot sin(x)**2

set terminal pdfcairo
set output 'pdfcairo.pdf'

set terminal pdfcairo fontscale 0.95
set output 'pdfcairo-scaled.pdf'

It seems like cairolatex has the same bottom margin like the 'pdfcairo fontscale 0.95', but they differ with respect to the left margins.

I tried to figure out what the problem is, but got stuck in graphics.c figuring out what determines the margin settings and where the difference between pdfcairo and cairolatex pdf is.



  • Ethan Merritt

    Ethan Merritt - 2012-01-24

    This seems to be the result of two bugs that almost, but not quite counteract each other.
    1) The cairo.trm registers PS_set_font rather than cairotrm_set_font in the TERM_TABLE. I don't know what the logic for this was, but it has effect that the allowance for the font size is multiplied by 1/2 (actually it's 0.5 in the vertical and 0.6 in the horizontal).
    2) To counteract that, but only partially, the default fontscale is set to 1.0 rather than 0.5, which is the value that would have been used for eps or pdf output.

    So changing PS_set_font to cairotrm_set_font and initializing fontscale to 0.6 rather than 1.0 (both in cairo.trm) fixes things for the default case. Setting the font size or fontscale to anything else, however, doesn't seem to work quite correctly. So I will look at it some more.

  • Ethan Merritt

    Ethan Merritt - 2012-01-24

    Fixes things for the default case

  • Christoph Bersch

    The patch fixes the problem for me (on Linux), thank you!

  • Ethan Merritt

    Ethan Merritt - 2012-01-30
    • status: open --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks