[[diary/Kojima]]

・ghostscript-8.60

CUPSが使っている ESP Ghostscript をマージしたバージョンが公開されていた
のでビルド.ビルド自体は問題なかったんだけど,日本語のフォントの設定ま
わりで結構ハマったので備忘録.

基本的には,
[[Ghostscript 8.60 を CentOS4.0 にインストール:http://d.hatena.ne.jp/k3k1/20070812/1186924788]]や
[[ghostscript 8.54 をインストール:http://centos.it-cafe.jp/kankyou/kan003.html#ghost]]の解説に従えばいいのだけど,
それらを整理した手順.

- configure 時に --disable-compile-inits を指定

これを指定しないと,コンパイル時に初期化情報が埋め込まれて,次の
gs_res.ps の修正とかも読まれないらしい.

- lib/gs_res.ps の修正

gs_res.ps で /FontResoueceDir を指定している部分に日本語フォントの情報
を置くディレクトリを指定

 *** ./ghostscript-8.60/lib/gs_res.ps	2007-02-21 08:54:19.000000000 +0900
 --- ./gs_res.ps	2007-10-25 22:51:08.000000000 +0900
 ***************
 *** 317,326 ****
   } if
   pssystemparams begin
     .default_resource_dir
 !   /FontResourceDir (Font) .resource_dir_name
 !      readonly .forcedef	% pssys'params is r-o
 !   /GenericResourceDir () .resource_dir_name
 !      readonly .forcedef	% pssys'params is r-o
     pop % .default_resource_dir
     /GenericResourcePathSep
     	.file_name_separator readonly .forcedef		% pssys'params is r-o
 --- 317,326 ----
   } if
   pssystemparams begin
     .default_resource_dir
 !   /FontResourceDir (/usr/share/ghostscript/8.60/Resource/CIDFont/) .resource_dir_name
 !      readonly .forcedef % pssys'params is r-o
 !   /GenericResourceDir (/usr/share/ghostscript/8.60/Resource/) .resource_dir_name
 !      readonly .forcedef % pssys'params is r-o
     pop % .default_resource_dir
     /GenericResourcePathSep
     	.file_name_separator readonly .forcedef		% pssys'params is r-o

- lib/cidfmap に日本語のフォントの情報を追加

 /Ryumin-Light        << /FileType /TrueType /Path (ipam.ttf) /CSI [(Japan1) 6] >> ;
 /GothicBBB-Medium    << /FileType /TrueType /Path (ipag.ttf) /CSI [(Japan1) 6] >> ;
 /Ryumin-Medium         /Ryumin-Light;
 /HeiseiMin-W3          /Ryumin-Light;
 /HeiseiKakuGo-W5       /GothicBBB-Medium;
 /Kochi-Mincho      /Ryumin-Light;
 /Kochi-Gothic      /GothicBBB-Medium;
 /Adobe-Japan1      /Ryumin-Light;
 /Adobe-Japan2      /Ryumin-Light;
 /FutoMinA101-Bold  /Ryumin-Light ;
 /FutoGoB101-Bold   /GothicBBB-Medium ;
 /GothicMB101-hea   /GothicBBB-Medium ;
 /ShinGo-Bold       /GothicBBB-Medium ;

ここで,ipa{m,g}.ttf はフルパスではなくフォント名だけで指定しているので,
/usr/share/ghostscript/fonts にリンクを作成する必要あり.

# フルパスだと CUPS 等に送った時とかにエラーになる模様

- gs_res.ps に指定した
FontResouceDir(/usr/share/ghostscript/8.60/Resource/CIDFont) に Font
Spec ファイルを用意

  drwxr-xr-x  kojima/users         0 CIDFont/
  -rw-r--r--  kojima/users       298 CIDFont/GothicBBB-Medium-EUC-H
  -rw-r--r--  kojima/users       298 CIDFont/GothicBBB-Medium-EUC-V
  -rw-r--r--  kojima/users       282 CIDFont/Ryumin-Light-EUC-H
  -rw-r--r--  kojima/users       282 CIDFont/Ryumin-Light-EUC-V

このファイルの中身は

 %! Font Specification
 %%Title: GothicBBB-Medium-EUC-H
 %%CreationDate: 06/xx/xx
 %%ModificationDate: 06/xx/xx
 %%EndComments
 %%BeginResource: font GothicBBB-Medium-EUC-H
 (GothicBBB-Medium-EUC-H)
 (EUC-H) /CMap findresource
 [(GothicBBB-Medium) /CIDFont findresource]
 composefont pop
 %%EndResource
 %%EOF

こんな感じで,EUC-H のコーディングと GothicBBB-Medium という cidfmap で
指定したフォント名とのマッチングを示してやればいいらしい.


だいたいこれ位の設定で日本語も表示できるようになる模様.

 kojima@athlon64[~/Sample]% gs -sDEVICE=x11alpha texdemo.ps 
 GPL Ghostscript 8.60 (2007-08-01)
 Copyright (C) 2007 Artifex Software, Inc.  All rights reserved.
 This software comes with NO WARRANTY: see the file PUBLIC for details.
 Loading a TT font from /usr/share/ghostscript/fonts/ipam.ttf to emulate a CID font Ryumin-Light ... Done.
 Loading a TT font from /usr/share/ghostscript/fonts/ipag.ttf to emulate a CID font GothicBBB-Medium ... Done.
 Loading NimbusSanL-Regu font from /usr/share/ghostscript/fonts/n019003l.pfb... 4437156 2951851 2427896 972747 3 done.
 >>showpage, press <return> to continue<<

一応,手元でパッケージ化したものを

ftp://plamo.linet.gr.jp/pub/Plamo-test/for-5.0/ghostscript-8.60-i586-P1.tgz 

に置いたので興味ある人は試してみてください.
-パッケージの位置が違うようです。ダウンロードできません。 pubが抜けている感じ? -- [[名倉]] &new{2007-10-27 (土) 07:21:37};
-おっと失礼、修正しておきました。なお、このパッケージでは /usr/share/ghostscript/fonts/ipa{m,g}.ttf というシンボリックリンクは作らないので、このリンクは手動で作ってくださいませ。 -- [[kojima]] &new{2007-10-27 (土) 16:14:03};
---disable-compile-inits と「s」が必要なのではないでしょうか。 -- [[やまぐち]] &new{2007-10-27 (土) 22:37:05};
-へい、そうでした > --disable-compile-inits  とりあえず記述は直しておきました。 -- [[kojima]] &new{2007-10-28 (日) 17:47:17};

#comment

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS