本文记录了GMT使用中出现的一些问题及解决方法:
GMT安装
源码安装
pass
yum安装
pass
GMT的中文支持
参考seisman博客中对GMT中文支持的介绍,这里详细说明了CentOS 7系统下GMT 5.4的中文支持解决方法。
中文字体导入
添加中文字体来自
C:\Windows\Fonts
:- 仿宋simfang.ttf
- 黑体simhei.ttf
- 楷体simkai.ttf
- 扩展宋体simsunb.ttf
将上述四种字体从Windows中复制到Linux目录
/usr/share/fonts/winfonts/
下,如果没有winfonts
目录,则手动创建。ghostscript中文配置
中文支持的安装
yum -y install ghostscript-chinese-zh_CN
安装之后,gs的中文配置文件为/usr/share/ghostscript/conf.d/cidfmap.zh_CN
。
在文件中追加如下内容:
/STSong-Light <</FileType /TrueType /Path (/usr/share/fonts/winfonts/simsunb.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
/STFangsong-Light <</FileType /TrueType /Path (/usr/share/fonts/winfonts/simfang.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
/STHeiti-Regular <</FileType /TrueType /Path (/usr/share/fonts/winfonts/simhei.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
/STKaiti-Regular <</FileType /TrueType /Path (/usr/share/fonts/winfonts/simkai.ttf) /SubfontId 0 /CSI [(GB1) 4] >> ;
GMT中文配置
假定GMT 5的安装路径为
/opt/gmt
,字体配置文件路径为/opt/gmt/share/postscriptlight/PSL_custom_fonts.txt
,
如果yum安装,文件路径应该是/usr/share/gmt/postscriptlight/PSL_custom_fonts.txt
在文件中追加如下内容:
STSong-Light--UniGB-UTF8-H 0.700 1
STFangsong-Light--UniGB-UTF8-H 0.700 1
STHeiti-Regular--UniGB-UTF8-H 0.700 1
STKaiti-Regular--UniGB-UTF8-H 0.700 1
中文支持使用
gmt pstext -L
查看GMT当前支持的字体:
$ gmt pstext -L
Font # Font Name
------------------------------------
0 Helvetica
1 Helvetica-Bold
2 Helvetica-Oblique
3 Helvetica-BoldOblique
.. .......
37 GothicBBB-Medium-EUC-H
38 GothicBBB-Medium-EUC-V
39 STSong-Light--UniGB-UTF8-H
40 STFangsong-Light--UniGB-UTF8-H
41 STHeiti-Regular--UniGB-UTF8-H
42 STKaiti-Regular--UniGB-UTF8-H
GMT 5的字体格式为40p,Helvetica,black
,也可写作40p,0,black
,因此在GMT 5中设置字体样式为仿宋一般写作40p,40,black
,在pstext
中可以写做@%40%仿宋@%%
。
中国省市地图
pass
格网数据处理
pass