Menu

#2048 kerning in vertical text of cairo-based terminals

open
nobody
cairo (8)
2019-02-09
2018-05-22
No

The letter kerning for vertical text in wxt and pngcairo (not pdfcairo) looks broken. The effect varies a bit when changing the terminal size, some letters are too close to each other, sometimes the upward stroke of a capital "N" vanishes completely. And it happens independent of the selected font.
Everything looks totally fine for horizontal text, text in odd angles can look really weird:

 set xlabel 'Next N n M|M| N|N| (N/N)'
 set ylabel 'Next n N M|M| N|N| (N/N)'

 set label 1 at -9,-8 "Textexample with four words" rotate by 90
 set label 2 at -9,8 "Textexample with four words" rotate by 325
 set label 3 at -8,-9 "Textexample with four words"
 set label 4 at -6,-5 "N NN N M MM MM NN4" rotate by 90
 set label 5 at -5,-6 "N NN N M MM MM NN5"
 set label 6 at -5,-5 "N NN N M MM MM NN6" rotate by 15
set label 7 at -3,-2 "NNNNN PPPPP plplppp nininnn" rotate by 90
set label 8 at -2,-3 "NNNNN PPPPP plplppp nininnn"
 plot -x

This looks the same in gp5.0pl6 and 5.2pl3, official windows build.
I also tried 5.0pl5 on linux (debian stretch stock build), pdfcairo OK, pngcairo distorted.
(see also https://stackoverflow.com/questions/50466261/part-of-capital-letter-n-is-missing-in-ylabel-in-pngcairo-format-in-gnuplot)

Discussion

  • Ethan Merritt

    Ethan Merritt - 2018-05-22

    So far as gnuplot is concerned, all of the cairo terminals are the same. The choice of output to pdf or png or svg or wxt is made at the very end after the entire plot has been constructed. So any difference you see is due to processing by the corresponding output modules in cairo (cairo calls the output mode a "surface"). In other words, It is not clear that we can do anything about this in the gnuplot code, it's all internal to the cairo libraries, or possibly libfreetype. Or I could believe there is a bad font, but that seems unlikely since you say the problem is not dependent on the chosen font.

    For what it's worth I can't reproduce the problem here in either wxt or pngcairo.
    I tried two machines, one with cairo 1.14.10 and one with cairo 1.10.0

    Anyhow, I suggest browsing for relevant bugs reported against cairo or freetype

     
  • Ethan Merritt

    Ethan Merritt - 2018-08-11

    See also #2052

     
  • Tatsuro MATSUOKA

    I tested on 5.2.6a on windows 64. (cairo 1.16.0, pango 1.43.0, freetype 22.1.16)
    If I do not specify font as set terminal pngcairo, the result outpuit is gp526awin_defaultfont.png.

    If I specify font a as set terminal pngcairo font 'Arial', the result outpuit is gp526awin_Arial.png.

    The different behaviour in default perpahs relies on Japanese locale.

     

    Last edit: Tatsuro MATSUOKA 2019-01-03
    • Karl Ratzsch

      Karl Ratzsch - 2019-01-02

      Both look broken in a similar way like what I get on my machine (win7, 5.2pl6a binary from sf.net). Also I think there is sth wrong with Ethan's output above, look at the letters x and a in the word "example" printed diagonally, they don't look right. It's just not so obvious as in the output with the Arial font.

      But, as the output from pdfcairo looks perfect, I assume Ethan is right that this is a bug in cairo/pango, only it has probably never been found/fixed.

      And from what it looks to me, it's a rounding error in the calculation of positions of rotated letters. Becomes more obvious at smaller font sizes.

       
  • Tatsuro MATSUOKA

    Cygwin and Ubuntu 18 on wsl on my PC can handle windows system fonts using fontconfig settig.
    Snapshots on cygwin and Ubuntu 18.04 on wsl is the almost are the same.

     
  • Tatsuro MATSUOKA

    As Bastian wrore in
    https://sourceforge.net/p/gnuplot/bugs/2121/#a5bb/3758/355d
    you can choice font handling system: win32 (windows font system) or fc (fontconfig system) in
    cairo based terminals by setteing "PANGOCAIRO_BACKEND" environments variable.
    If you set, PANGOCAIRO_BACKEND=fc, behaviors are almost the same as in those in linux.

     

    Last edit: Tatsuro MATSUOKA 2019-02-09

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.