Menu

#2512 pngcairo: uppermost pixel in key, label etc missing

None
open-duplicate
nobody
None
2023-03-13
2022-03-17
Frank Bok
No

Dear gnuplot developers,
first, many thanks for this great tool!
Running gnuplot 5.4 pl 3 (gp543-win64-mingw.exe) on Windows 10, I found a strange behaviour when using pngcairo terminal: In Key, labels and numbers on x and y axis, the uppermost pixel is missing. So a "T" looks like a "I".
Find attached a minimal demo script and its output file.
The effect can also be seen here:
https://sourceforge.net/p/gnuplot/bugs/2048/#5e0c/80c2/fe06 in the "gp467win_Arial.png" (see ylabel)
Many thanks in advance,
Frank

2 Attachments

Discussion

  • Tatsuro MATSUOKA

    I can reproduce the same effect on the gnuplot 5.4.3 on windows but do not reproduce on 5.4.3 on cygwin. On 5.5.0 on windows (development snapshot on 2022-03-16). the result is slightly different but the effect remains.

     

    Last edit: Tatsuro MATSUOKA 2022-03-17
  • Ethan Merritt

    Ethan Merritt - 2022-03-17

    Gnuplot and many other applications are innocent bystanders suffering from a development meltdown in the pango project, which cairographics uses (or at least used to, I'm not sure what the plan is going forward). Basically pango versions 1.44 and onwards have lost the ability to render many old fonts correctly. The exact symptoms depend on screen dpi, antialiasing settings, hinting level, and the nature of the font involved. Too complicated for me to sort out other than to suggest trying a different font or a different version of your pango library.

    See extensive set of links with more information attached to Bug #2397
    https://sourceforge.net/p/gnuplot/bugs/2397/

     
    • Tatsuro MATSUOKA

      Ethan
      Basically pango versions 1.44 and onwards have lost the ability to render many old fonts correctly.

      I have tested on gnuplot-5.5.0 (2022-03-16) with pango-1.43.0 (built myself) on windows. Snapshot is attached. The pango version is less than 1.44 but upper left "T" of "Test" is lack of top and "-0.2" , "-10", "-5" and "10" were not represented properly.

      Representation is surely affected by the pango version but mere downgrade pango version may not be a work around.

       

      Last edit: Tatsuro MATSUOKA 2022-03-21
  • Ethan Merritt

    Ethan Merritt - 2022-03-17
    • status: open --> open-duplicate
    • Group: -->
    • Priority: -->
     
  • Frank Bok

    Frank Bok - 2022-03-18

    Dear Ethan,
    many thanks for the explanation. My Win-Laptop does not suffer from this problem, only my desktop PC does. Maybe I can find a difference between the two installations.
    Dear Tatsuro,
    thanks for your support!
    Best wishes,
    Frank

     
    • Tatsuro MATSUOKA

      After some googling I found the setting of the PANGOCAIRO_BACKEND enviroment variable. If I set PANGOCAIRO_BACKEND=fc , Figure.png by your script on gnuploy 5.4.3 on windows gives the attached one (seem to be good). This is one of the work around at the moment.

      (By default pangocairo on windows uses the win32 backend but not the fontconfig backend. PANGOCAIRO_BACKEND enviroment variable can chage the backend on windows. On linux and mac(?), fontconfig backend is used .
      see https://sourceforge.net/p/gnuplot/bugs/2121/#a5bb/3758/355d)

       
      • Frank Bok

        Frank Bok - 2022-03-21

        Dear Tatsuro,
        thank you very much! The workaround works perfect fine!
        Best wishes,
        Frank

         
  • Dandy Eschricht

    Dandy Eschricht - 2023-03-10

    Thank you Tatsuro for this workaround.
    I noted more issues with both variants, while using gnuplot 5.4.6.

    I am using:

    dpi = 96
    versionOut = system('gnuplot --version')
    version = word(versionOut, 2).'.'.word(versionOut,4)
    backend = "`echo %PANGOCAIRO_BACKEND%`"
    if ( strstrt(backend,"PANGOCAIRO_BACKEND") ) backend = "none"
    
    scale = dpi/96.0
    sizeX = 640.0*scale
    sizeY = 480.0*scale
    fontSize=sprintf("%f", 11.0*scale)
    
    set terminal pngcairo size sizeX, sizeY font "Arial,".fontSize linewidth scale
    set output 'figure_dpi-'.dpi.'_'.backend.'_v'.version.'.png'
    
    set title 'gnuplot version '.version.', PANGOCAIRO\_BACKEND='.backend
    set key bottom right
    set label 1 "Test" at graph .05,.95
    plot sin(x) w l lc 1 t "Test"
    

    The dpi=96 output for set PANGOCAIRO_BACKEND=win32(aka figure_dpi-96_win32_v5.4.6.png) looks similar to those posted above, having cut-off errors in the labels. Note that the title is affected as well, while the key (or legend) seems to be fine.

    The dpi=96 output for set PANGOCAIRO_BACKEND=fc(aka figure_dpi-96_fc_v5.4.6.png) looks good at the labels, but note the cut off in the legend and in the title as well.

    At higher resolutions, dpi=240, these errors become less evident. I only see a cut off in the title when using set PANGOCAIRO_BACKEND=win32 (which is the same as the default set PANGOCAIRO_BACKEND=).

    PS: An annoying error message appears beginning with gnuplot version 5.4.4 when using set PANGOCAIRO_BACKEND=fc:

    Fontconfig error: Cannot load default config file: No such file: (null)
    

    which should be a warning instead of error, since it seems to work properly, or does not appear at all.

     
  • Tatsuro MATSUOKA

    I have confirmed what you showed.

    On Cygwin and Ubuntu, even if dpi is 96, output has no cut off.
    I attached the file.
    Windows specific treatment should be required.

    Fontconfig error: Cannot load default config file: No such file: (null)
    

    For the warning, the config file and related files for fontconfig is not attached to the binary pacakge even if qt anf gd uses fontconfig

    Please use etc.zip, place "etc" folder at the same level as "bin" folder.
    I will consider I will inciude etc folder and its content to the binary package.

    BTW, the easilst way to get the verion in gnuplot sciprt is to use GPVAL_VERSION and GPVAL_PATCHLEVEL.

    version = sprintf("%.1f.%s", GPVAL_VERSION, GPVAL_PATCHLEVEL)
    
     

    Last edit: Tatsuro MATSUOKA 2023-03-11
  • Dandy Eschricht

    Dandy Eschricht - 2023-03-13

    Thanks at lot, your etc.zip works fine.

    BTW: I am aware of sprintf(), but decided not to use sprintf("%.1f", GPVAL_VERSION), since it will break when the minor version becomes greater 10, i.e. 5.11+.

     
    • Ethan Merritt

      Ethan Merritt - 2023-03-13

      The minor version will not get that high; the next major release will be 6.0 rather than 5.6

       
  • Dandy Eschricht

    Dandy Eschricht - 2023-03-13

    For the warning, the config file and related files for fontconfig is not attached to the binary pacakge even if qt anf gd uses fontconfig

    I tested qt and the gd terminals png, jpeg and gif without the etc/ directory, they do not produce the error message "Fontconfig error: Cannot load default ...".

    However, as etc/ seems to remove the error message for the other terminals when the pango/cairo backend is changed, please include etc/ in the next windows binary package.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.