Menu

#801 Certain fonts don't show at all

closed-works-for-me
nobody
5
2009-09-23
2009-09-11
Nik Kol
No

Hi,

Generating text with "set encoding cp1250" and "set terminal png small" (but "font Arial" have same problem) does not show at all characters š and ž (Š Ž), but characters č,ć and đ have good representation.

I have Win XP SP3, and can't see version of wgnuplot.exe (1,933,312 bytes).

Discussion

  • Ethan Merritt

    Ethan Merritt - 2009-09-17

    Gnuplot does not do any font/encoding mapping itself. The png driver uses the external library libgd to create png images. But libgd does not support cp1250 explicitly, nor do the underlying freetype font libraries. Nothing we can do about it, sorry. Your best bet is to convert the input file to UTF8.

     
  • Ethan Merritt

    Ethan Merritt - 2009-09-17
    • status: open --> pending-wont-fix
     
  • Nik Kol

    Nik Kol - 2009-09-18
    • status: pending-wont-fix --> open-wont-fix
     
  • Nik Kol

    Nik Kol - 2009-09-18

    Hi,

    First of all thanks for reply.
    I saved script file in UTF-8, but it does not work. It don't work at all if file contains BOM, so i think the UTF-8 support does not work at all, becouse the file without BOM is not interpreted as it should (all wide characters are wrong).

     
  • Nik Kol

    Nik Kol - 2009-09-18

    Sample UTF8 script file

     
  • Ethan Merritt

    Ethan Merritt - 2009-09-18

    > It don't work at all if file contains BOM, so i think the UTF-8 support does not work at all
    >, becouse the file without BOM is not interpreted as it should (all wide characters are wrong).

    This is simply not true. Many of us are using UTF8 in gnuplot for daily use.
    But yes, you should remove the BOM mark from your files.
    It is hard to diagnose your exact problem remotely, but I suggest to start by confirming in another program that the font you are using is in fact in an appropriate encoding. You say the characters are "wrong", which I think means that gnuplot is working correctly but the font uses the wrong encoding..

    Please also tell us what gnuplot version you are using (use the command "show version" in gnuplot)

     
  • Nik Kol

    Nik Kol - 2009-09-21

    HI,

    Gnuplot is Version 4.2 patchlevel 3.

    I don't understand comment about encoding. Sample file is included in my last response, and that's about it. In the last row you have some non ANSI characters, and when gnu produces png, each wide character is shown with 2 strange characters, totaly wrong ;-)

    As far i can tell it's UTF8, Notepad++ says it to...

     
  • Ethan Merritt

    Ethan Merritt - 2009-09-21

    Your script has at least 2 problems.

    1) It is indeed a UTF8 encoded script, but it contains the command "set encodingcp 1250". This will in generatl cause an error because you are tell the terminal driver that the characters are 1250, but this is not true.

    2) You did not specify any font in your "set term " command, and from your description you also do not have a default font set in the environmental variables GDFONTPATH and GNUPLOT_DEFAULT_GDFONT. Because of this, the terminal falls back to a primitive bit-mapped font that contains only a subset of ascii characters.

    Try again using something like
    set term png font "arial,12"

    On a unix/linux system you might also need to set the environmental variable GDFONTPATH. I don't know about Windows. If you see a "can't find font" error, then look at the documentation for libgd.

     
  • Nik Kol

    Nik Kol - 2009-09-22

    First of all thanks for your effort.

    I already tried what you suggested before even posting anything.

    1. You didn't specified what to use for set encoding command? From help specification there is no utf8 or any unicode specification. I tried with "set encoding default" and "set encoding cp1250" , which is the code page that i need.

    2. Ofcours "set term png font "arial,12"" was my first option. The arial font is shown, but not the characters that i need.

    If you look closely at my first post, you can see that characters č,ć and đ are correctly shown. Тhese characters does not exist in ASCII code page, so i don't think you are right about primitive fonts.

    What i read here is what i already found in help and comments on web.

     
  • Nik Kol

    Nik Kol - 2009-09-23
    • status: open-wont-fix --> closed-works-for-me
     
  • Nik Kol

    Nik Kol - 2009-09-23

    I found 2 solutions:

    1. You can use UTF8, but you must have real UTF8 font installed on computer. I found ARIALUNI.TTF which works, and it is about 22Mb large.

    2. Like other outputs "set term png small", with default integrated font, accepts special charaters encoded like \123 so you can input larger set of special and non ASCII characters. I didn't find any specification of this on the web, but it works, and should be well documented.

     

Log in to post a comment.