How to add a greek character in png file created by gnuplot

前端 未结 3 1339
后悔当初
后悔当初 2021-01-14 09:09

I am using a commercial sever with FreeBSD system without root account. I install gnuplot with my account. But, I can not set up fonts. So, I copy the fonts files in my home

相关标签:
3条回答
  • 2021-01-14 09:58

    The plot definition file itself needs to be encoded in UTF-8.

    Here are all prerequisites for printing UTF-8 characters with gnuplot:

    • The file needs to contain a line set encoding utf8
    • The option enhanced must be available and set for the chosen terminal type: set terminal … enhanced …
    • The glyph of the UTF-8 character must be available in the chosen font.
    • The plot definition file itself needs to be encoded in UTF-8.

    Failing to observe the last point, results in the following gnuplot error:

    Unable to convert "…�…": the sequence is invalid in the current charset (UTF-8),
    falling back to iso_8859_1
    

    This situation may occur when transferring plot files from Microsoft Windows™ to GNU/Linux.

    The character encoding of the plot definition file can be checked with the following GNU/Linux command:

    $ file -bi bad.plt
    text/plain; charset=iso-8859-1
    

    To correct the character encoding of the plot definition file, use this command:

    $ iconv -f iso-8859-1 -t utf-8 -o good.plt bad.plt
    
    0 讨论(0)
  • 2021-01-14 10:02

    You can use "/Symbol" . Simply add to your file the line "set encoding utf8" At least, it works with arial font.

    0 讨论(0)
  • 2021-01-14 10:15

    Do not use /Symbol. That will not use the Verdana font.

    According to this page, the Verdana font includes greek letters.

    Use UTF-8 encoding by adding set encoding utf8 to your gnuplot file. Then insert the unicode symbol (according to this page: θ, greek small letter theta, U+03B8) into the label string using your favorite text editor.

    0 讨论(0)
提交回复
热议问题