GMTver5で中国简体字フォントを使用する

まず、uming フォントと ukai フォントをインストールしました。

sudo apt install fonts-arphic-uming  fonts-arphic-ukai

つづいて、お馴染みの PSL_custom_fonts.txt にSTSong-LightとSong-Midium を追加しました。環境にもよりますが、パスの一例は /usr/local/gmt5/share/postscriptlight です。

#	$Id: PSL_custom_fonts.txt 14657 2015-07-30 21:26:18Z pwessel $
#
#	Listing of additional PostScript fonts than those found on most PS printers.
#	Add your extra font information there.  This is the only required change as
#	far as GMT goes.  However, you most likely will have to modify GhostScript
#	font tables, place font files in certain system directories, and possibly
#	upload purchased fonts to a PostScript printer.  Search for help on how
#	to install new fonts on your particular system.
#
#	The fontheight below is the height of A for unit fontsize.
#	Encoded = 0 if we may reencode this font as needed.
#
#Fontname			Fontheight	Encoded

#Ryumin-Light-EUC-H              0.700           1
#Ryumin-Light-EUC-V              0.700           1
Ryumin-Light-UniJIS-UTF8-H              0.700           1
Ryumin-Light-UniJIS-UTF8-V              0.700           1
Ryumin-Light-RKSJ-H              0.700           1

#GothicBBB-Medium-EUC-H          0.700           1
#GothicBBB-Medium-EUC-V          0.700           1
GothicBBB-Medium-UniJIS-UTF8-H          0.700           1
GothicBBB-Medium-UniJIS-UTF8-V          0.700           1
GothicBBB-Medium-RKSJ-H          0.700           1

MS-Gothic-90ms-RKSJ-H	          0.700           1
MS-Mincho-90ms-RKSJ-H	          0.700           1

STSong-Light--UniGB-UTF8-H      0.700       1
Song-Medium--UniGB-UTF8-H       0.700       1

実行結果です。一見 GothicBBBでも大丈夫なようにも見えますが、所々表示できていない文字が有ります。一方、Songフォントは句読点がやけに高い位置に表示されますね。まだまだ色々チューニングの必要は有りそうです。

f:id:S_E_Hyphen:20191230180827j:plain

 

 

#!/bin/bash

gmt psbasemap -P -JX18c/25c \
 -R0/18/-25/0 \
 -Bwesn \
 -Bxg6 \
 -Byg1 \
 -K > test.ps

y=-1.5
cat << + |
圣诞节
平安夜
圣诞快乐
新年快乐。
提前祝你,新年快乐。
春节
生日快乐。
”重“的反面是”轻“。
你懂不懂英文?不太懂。懂一点。
在中国,英文开始小学三年级。
高考有英文考试。
高考时间是六月七号和八号。
语文
作文
数学
综合
理科。文科。
”容易“的反面是”难“。
”容易“的同义词是”简单“。
这是重要的资料。
这是重要的文件。
+

while read phrase
do 
# 日本語フォント BBBゴチック
 printf "0.2 ${y} ${phrase}" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,GothicBBB-Medium-UniJIS-UTF8-H,0/0/0 -O -K >> test.ps

# 汉语フォント STSong-Light
 printf "6.2 ${y} ${phrase}" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,STSong-Light--UniGB-UTF8-H,0/0/0 -O -K >> test.ps

# 汉语フォント Song-Medium
 printf "12.2 ${y} ${phrase}" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,Song-Medium--UniGB-UTF8-H,0/0/0 -O -K >> test.ps

y=`bc -l << _BC_
 $y - 1
_BC_`

done

printf "0.2 -0.5 GothicBBB" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,GothicBBB-Medium-UniJIS-UTF8-H,0/0/0 -O -K >> test.ps
printf "6.2 -0.5 STSong-Light" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,GothicBBB-Medium-UniJIS-UTF8-H,0/0/0 -O -K >> test.ps
printf "12.2 -0.5 Song-Medium" |\
 gmt pstext -J -R -F+jBL+a0.0+f10p,GothicBBB-Medium-UniJIS-UTF8-H,0/0/0 -O >> test.ps

convert -density 150 test.ps test.jpg