ThinkingRock是一款用Java编写的跨平台的GTD工具,我试用过很多GTD工具,在线的、单机的、自架服务器的,转了好几个圈,最后又转回来用它了,主要理由就是方便,该复杂的功能就要复杂,该简单的功能就要简单,可以用Project/Action来组织复杂事务,支持任务分配(当然只是给自己看的,没有协作功能),还算方便够用的报表功能。说到报表就到本文的主题了,软件自带的几个字体都无法显示中文,生成pdf报表之后里面的中文都会变成井字号#,所以需要自己安装中文字体。
参照官方的字体安装说明,核心意思是该软件的字体读取使用了FOP,而这个FOP需要Font Metrics文件才能工作。FOP是Apache中的一个项目,我没有深入去研究,不过网站上也有一篇比较清楚的文章教人如何生成这个Font Metrics文件。
但文章中的例子,使用库文件的位置和形式有点小问题,-cp后面是各个库文件,要能访问到才行,文中的路径显然不合适;文中各个库文件之间是用分号;间隔,这是在Windows中的写法,放nix下就错了,可以换成冒号:。所以,命令就变成了这个样子,注意所在路径的变化和相对路径:
$ cd /big2/tools/tr-2.0.1/tr/resource/fop $ ln -s /big2/fonts/xpfonts/simsun.ttf $ java -cp ../../modules/ext/fop-0.93.jar:../../modules/ext/avalon-framework-4.2.0.jar:../../modules/ext/commons-logging-1.0.4.jar:../../modules/ext/commons-io-1.1.jar org.apache.fop.fonts.apps.TTFReader -ttcname "SimSun" simsun.ttf simsun.xml 如果字体文件中包含多个字体,而你指定了错误的字体名称,系统会给出提示:
TTF Reader for Apache FOP 0.93 Parsing font... Reading simsun.ttf... This is a TrueType collection file with 2 fonts Containing the following fonts: SimSun NSimSun Error while building XML font metrics file. java.io.IOException: Name does not exist in the TrueType collection: Simsun 看到没,SimSun和NSimSun俨然就是宋体和新宋体啊。生成成功之后,simsun.xml就是我们得到的Font Metrics文件,所以接下来只需要再修改一下fop.xconf,把新字体的设置加进去就可以了:
好了,现在ThinkingRock的Tools -> Options -> Miscellaneous -> Action Screens中,就可以选择中文字体SimSun了,各种报表pdf中的中文也都会正常显示。
参考
Tags: font, fop, GTD, ThinkingRock, ToolsRelated posts
- 选择Eclipse PHP Development Tools(PDT)作为PHP开发工具 (5)
- 我的email客户端软件选择历程 (5)
- 发现fcitx也很不错嘛 (4)
- 保存网页为单个文件/Save webpages All-in-one file (3)
- 个人信息管理软件——todo/任务/日程表 (1)
![[Bloglines]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/bloglines.png)
![[co.mments]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/comments.png)
![[del.icio.us]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/diigo.png)
![[Facebook]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Rojo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/rojo.png)
![[Slashdot]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/technorati.png)
![[Windows Live]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/email.png)