diary/Kojima

・ghostscript-8.60

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

基本的には, Ghostscript 8.60 を CentOS4.0 にインストールghostscript 8.54 をインストールの解説に従えばいいのだけど, それらを整理した手順.

これを指定しないと,コンパイル時に初期化情報が埋め込まれて,次の 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
/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 等に送った時とかにエラーになる模様

 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

に置いたので興味ある人は試してみてください.



トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-12-17 (金) 16:35:41