Custom font on windows

Hi all,
i have been trying to use custom fonts in GMT6 on Windows 10.
I tried to use ex.31 and previous posts (e.g. Custom fonts on MacOS) to do it but so far no luck.

I am getting the following error
PSL: Warning: Selected font (44) out of range (0–1); reset to 0

trying gmt text -L gives me this
41 GothicBBB-Medium-EUC-H
42 GothicBBB-Medium-EUC-V
43 grktimp
44 GFSDidot

my PSL_custom_fonts.txt looks like this

#Fontname Fontheight Encoded
Ryumin-Light-EUC-H 0.700 1
Ryumin-Light-EUC-V 0.700 1
GothicBBB-Medium-EUC-H 0.700 1
GothicBBB-Medium-EUC-V 0.700 1
grktimp 0.7 1
GFSDidot 0.7 1

and my gmt batch file

gmtset MAP_FRAME_TYPE plain FORMAT_GEO_MAP D FONT_ANNOT_PRIMARY 12 FONT_ANNOT_SECONDARY 12 FONT_TITLE 14 FONT_LABEL 14
gmtset COLOR_NAN=2/0/0 MAP_FRAME_PEN = 1p MAP_TICK_LENGTH 0.12c MAP_TICK_PEN 1p
gmtset FONT GFSDidot PS_CHAR_ENCODING ISO-8859-7 MAP_DEGREE_SYMBOL degree

set file=A7z.ps

pscoast -R21.2/21.7/38.35/38.7 -JM19c -Df -N1/thick,black,-- -K -O -Slightgray -Ia/.6p -Lfx7/1/38.4/10+l -W.4p -B0.2::WseN >> %file%
pstext town3.txt -R -J -O -Gred -F+f7p,grktimp >> %file%

any hint ?

regards
thimios

Could you please attach the town3.txt file so we can check? I faked it with just a dummy text and the PS file contains at least the right PostScript setup, i.e.,

/F43 {/grktimp Y}!
/F44 {/GFSDidot Y}!

and later in the patent call this is written

117 F43

When you say GMT6, what version? I see GMT 4 syntax in part of the script.

Hello Paul,

i am switching between different versions of the GMT that’s why the old GMT 4 syntax. Anyway i tried with GMT6.0 using the above script …
i checked my ps file and i don’t see the entries you mention, i guess it is because it fails in my PC.
i am attaching the town3.txt file,

Thanks!
thimios

town3.txt (45 Bytes)

Sine I don’t have the fonts installed I cannot look at the final plot but the PostScript contains what I assume are the codes for the language. Perhaps @Joaquim knows if this fails on Windows?

I didn’t get any warnings but the text with the Greek letters showed only funny symbols.

Yes, because neither of us have those fonts installed. But if you look at the PS file you find those lines using F43 etc right? if so then the problem lies on his side.

Yes, I have

/F42 {/GothicBBB-Medium-EUC-V Y}!
/F43 {/grktimp Y}!
/F44 {/GFSDidot Y}!
/PSL_pathtextdict 26 dict def

Dear Paul and Joaquim,

first of all thank you very much for helping me with this.

i see that the font files create problems in resolving this so i suggest to stay with Windows fonts in order to be able to test the whole procedure.

For this purpose i did the following.

  1. i selected the Arial font (found in c:\windows\fonts) file is arial.ttf (i attach it also)arial.zip (515.3 KB)
  2. copied the file in a folder
  3. i switched to GMT 6.2 (batch file is attached) test_gr.txt (451 Bytes)
  4. i added arial in PSL_custom_fonts.txt (this file is in same folder with the batch file and the font file)
  5. script runs ok (i get only this warning “gmt [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.”)
  6. i checked ps file and has the following lines

/F46 {/arial Y}!
/F47 {/greek Y}!

  1. but the pdf shows “funny” symbols

i went back to manual and i agree that the GMT part seems ok so my guess is that it is related to Ghostscript (?). I think it is Ghostscript that does this conversion .?

Anyway i took the ps file from the above script and gave it to Ghostscript using the following
gswin64 -q -dNOCACHE -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sFONTPATH=“C:\test_greek” -sOutputFile=tttest.pdf tt.ps
the result was the same … it seems that Ghostscript is not directed correctly to proper file or there is some other problem e.g. specifying the Greek characters (i am using the ISO-8859-7 which seems ok!)

Best Regards
thimios

Hmm, I get strange warnings about aria (not arial) font not being found

gmt begin tt ps

gmtset FONT arial  FONT_TITLE  18p,arial   PS_CHAR_ENCODING  ISO-8859-7      MAP_DEGREE_SYMBOL degree
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Length <unit> l not supported - revert to default unit [point]
gmtset [WARNING]: aria not a valid number and may not be decoded properly.
gmtset [WARNING]: Representation of font size not recognized. Using default.
gmtset [WARNING]: Representation of font type not recognized. Using default.

gmt coast -R21.2/21.7/38.35/38.7   -JM19c -Df  -N1/thick,black,--  -Slightgray -Ia/.6p  -Lfx7/1/38.4/10+l -W.4p  -B.5
coast [WARNING]: Changing to PostScript landscape orientation based on your plot and paper dimensions, but we cannot be 100% sure.
coast [WARNING]: Use PS_MEDIA and/or PS_PAGE_ORIENTATION to specify correct paper dimensions and/or orientation if our guesses are inadequate.

gmt text town3.txt -F+f17p,arial+jBL -Dj0.1c -Gwhite  -Qu
text [WARNING]: Representation of font type not recognized. Using default.

echo 21.5 38.5 αξηλξκηκλξ   | gmt text -F+f17p,arial+jBL -Dj0.1c -Gwhite  -Qu
text [WARNING]: Representation of font type not recognized. Using default.

gmt end show

Sorry, it looks that the font name is case sensitive in PSL_custom_fonts.txt. I had it Arial instead of arial. Now I get basically no warnings, but still the funny symbols (normal since it doesn’t know how to write Greek with arial fonts)

gmt begin tt ps

gmtset FONT arial  FONT_TITLE  18p,arial   PS_CHAR_ENCODING  ISO-8859-7      MAP_DEGREE_SYMBOL degree

gmt coast -R21.2/21.7/38.35/38.7   -JM19c -Df  -N1/thick,black,--  -Slightgray -Ia/.6p  -Lfx7/1/38.4/10+l -W.4p  -B.5
coast [WARNING]: Changing to PostScript landscape orientation based on your plot and paper dimensions, but we cannot be 100% sure.
coast [WARNING]: Use PS_MEDIA and/or PS_PAGE_ORIENTATION to specify correct paper dimensions and/or orientation if our guesses are inadequate.

gmt text town3.txt -F+f17p,arial+jBL -Dj0.1c -Gwhite  -Qu

echo 21.5 38.5 αξηλξκηκλξ   | gmt text -F+f17p,arial+jBL -Dj0.1c -Gwhite  -Qu

gmt end show

@Joaquim
Sorry Joaquim i don’t understand this " (normal since it doesn’t know how to write Greek with arial fonts)" what does it mean .? i need to use another file ? there is something wrong with settings? encoding etc.?
could you please be more specific ?

Thank you,
thimios

Well, since your example is selecting the Arial font, I’m expecting that this font cannot print Greek letters (I may be wrong on this, though). That was the sense of my comment.

The problem seems to be that one need to load a (installed) font that can print Greek letters. Which font is that? (sorry, don’t know)

@Joaquim
i see, but this is the reason that i selected this font, it is installed in my pc and i can write Greek with this.
What about Ghostscript ? I think it is not using the windows fonts ? maybe fonts should be installed there also ?

I am pretty sure (but not 100%) that we have had other Greek users successfully doing this. The step done in ex31 should be similar for you, but as Joaquim says, the fonts need to support the character set. If you are able to figure it out, or have specific questions, let us know. Once we have a solution we can use it to improve the documentation.

I think ghostscript only uses the fonts it comes with. You may be able to tell ghostscript via one of the options to consider some other directory with fonts. Suggest you google that (can ghostscript use Windows fonts).

Hi, @esokos, I configured the arial font as a CIDFont for Ghostscript, I run you scrpit, it seems to work. Is this what you want?

Yes this looks fine !! I will check the CIDFont for Ghostscript
Thanks a lot

thimios

Hi @leeyupeng , i have problems configuring the CID fonts for ghostscript (in windows). Could you please share some info on this.?