- cd /usr/share/fonts/truetype/arphic
- ls
-
我们可以看到,麒麟版的中文系统已经安装了两个字体文件:
ukai.ttc
uming.ttc
为使用更多字体,首先自己建立一个目录/usr/share/fonts/truetype/winfonts我们可以将windows下的字体文件(NOTE: ttf或ttc格式)拷贝到/usr/share/fonts/truetype/winfonts目录下
windows的字体一般在C盘Windows\Fonts目录下:
msyh.ttf 微软雅黑
msyhbd.ttf 微软雅黑(粗体)
simfang.ttf 标准仿宋
simhei.ttf 标准黑体
simkai.ttf 标准楷体
simsun.ttf 标准宋体
STHUPO.TTF 标准琥珀
STXINGKA.TTF 标准行楷
原始语句中包含几行设置中文字体的语句,如下:
- /Song-Medium /GBZenKai-Medium ;
- /STSong-Light /BousungEG-Light-GB ;
- /STFangsong-Light /BousungEG-Light-GB ;
- /STHeiti-Regular /BousungEG-Light-GB ;
- /STKaiti-Regular /BousungEG-Light-GB ;
-
删除上述语句,增加:
- /STSong-Light <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/simsun.ttc) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /STKai-Light <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/simkai.ttc) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /STHeiTi <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/simhei.ttc) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /STHuPo <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/STHUPO.TTF) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /STXingKai <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/STXINGKA.TTF) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /STFangSong-Light <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/simfang.ttc) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /MSYaHei <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/msyh.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
- /MSYaHei-Bold <</FileType /TrueType /Path (/usr/share/fonts/truetype/winfonts/msyhbd.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
-
·sudo update-gsfontmap·
sudo vim PSL_custom_fonts.txt
增加如下几行,把新加入ghostscript中的中文字体加进来
- STSong-Light--UniGB-UTF8-H 0.700 1
- STKai-Light--UniGB-UTF8-H 0.700 1
- STHeiTi--UniGB-UTF8-H 0.700 1
- STHuPo--UniGB-UTF8-H 0.700 1
- STXingKai--UniGB-UTF8-H 0.700 1
- STFangSong-Light--UniGB-UTF8-H 0.700 1
- MSYaHei--UniGB-UTF8-H 0.700 1
- MSYaHei-Bold--UniGB-UTF8-H 0.700 1
-
gmt pstext -L
- #!/bin/sh
- JX="3i/2.7i"
- R="0/100/0/30"
- oumap="testFont"
-
- gmt psbasemap -R$R -JX$JX -BWeSn -Bxa10f5 -Bya10f2.5 -V -K >${oumap}.ps
- echo "40 5" | gmt psxy -R -J -Sc1.1c -G250/128/114 -V -O -K >>${oumap}.ps
- echo "40 5" | gmt psxy -R -J -Sc1.3c -G20@80 -V -O -K >>${oumap}.ps
- gmt pstext -R -J -F+f12p,STKai-Light--UniGB-UTF8-H,red --PS_CHAR_ENCODING=ISOLatin1+ -V -O >>${oumap}.ps <<EOF
- 20 12.4 楷体
- EOF
-
- # convert to pdf
- gmt psconvert ${oumap}.ps -Tf -F${oumap}.pdf
-