ThinkingRockのver.1.2.3がリリースされました。 これで日本語でのpdfレポートの出力が可能となったわけです。 この機能を使って、日本語でのnextactionとか、contextによるlistを作って幸せになりましょう、という話です。
使ってみた結果は、こんな感じです。
beforeでは"####"と表示されてしまっているところが、ちゃんと日本語で表示されていますね。 これをできるような設定を記録しておきます。
用意するもの
- ttc font (e.g. mincho.ttc) 通常"C:\WINDOWS\Fonts\MSGOTHIC.TTC"とかにあります。
- ThinkingRock ver.1.2.3
- Java
手順
fopでフォントの設定に必要なxmlファイルを作ります。 ThinkingRockのlib/fopで以下のコマンドを入力します。
C:\Program Files\ThinkingRock\lib>java -cp fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "MS Gothic" C:\WINDOWS\Fonts\MSGOTHIC.TTC msgothic.xml java -cp fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "MS Gothic" C:\WINDOWS\Fonts\MSGOTHIC.TTC msgothic.xml TTF Reader for Apache FOP 0.92beta Parsing font... Reading C:\WINDOWS\Fonts\MSGOTHIC.TTC... This is a TrueType collection file with 3 fonts Containing the following fonts: MS Gothic <-- selected MS PGothic MS UI Gothic Number of glyphs in font: 20458 2 cmap tables CMAP format: 4 Creating xml font file... Creating CID encoded metrics... Writing xml font file msgothic.xml... This font contains no embedding license restrictions. XML font metrics file successfullly created. C:\Program Files\ThinkingRock\lib>
これでmsgothic.xmlがThinkingRock\libに作られました。
このmsgothic.xmlをThinkingRock\resource\fopに移動します。 ついでにmsgothic.ttcもThinkingRock\resource\fopにコピーしてください。 mvでもcopyでもD&Dでも好きにしてください。
で、ThinkingRock\resource\fop\fop.xconfを編集します。 以下のような情報を追加します。 追加するのは、下のExample Japanese fontsなところです。
<font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf"> <font-triplet name="Arial" style="normal" weight="normal"/> </font> <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf"> <font-triplet name="Arial" style="normal" weight="bold"/> </font> <font metrics-url="ariali.xml" kerning="yes" embed-url="ariali.ttf"> <font-triplet name="Arial" style="italic" weight="normal"/> </font> <font metrics-url="arialbi.xml" kerning="yes" embed-url="arialbi.ttf"> <font-triplet name="Arial" style="italic" weight="bold"/> </font>
<!-- -->
<!-- Example Japanese fonts -->
<font metrics-url="msgothic.xml" embed-url="MSGOTHIC.TTC" kerning="yes">
<font-triplet name="Gothic" style="normal" weight="normal"/>
<font-triplet name="Gothic" style="normal" weight="bold"/>
<font-triplet name="Gothic" style="italic" weight="normal"/>
<font-triplet name="Gothic" style="italic" weight="bold"/>
</font>
<!-- -->
</fonts>
これで準備は整ったはずです。 ThinkingRock ver.1.2.3を起動して、例えば、file->reports->nextactonと選び、次のフォントを選ぶウィンドウでfont familyをGothicと選べば日本語で吐き出されるはずです。 めでたしめでたし。
---
さて、万が一記述ミスしていたときのために。 この通り設定してもできなかった、という人は連絡をいただけると、更に調べてみる、かもしれません。 いや、僕がソースを書いているわけではないので、利用する立場なのですが。 ま、そのうちオフィシャルなhowto文書が出るのでそれを待つのも手かもしれません。


