GhostScript?でMSゴシックを出力する方法。 標準のままではエラーになってしまう。

F:\temp>@"C:\Program Files\gs\gs8.71\bin\gswin32c.exe" -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -r300 -sOutputFile="test.png"  "test.pdf"
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Can't find CID font "MSゴシック".
Substituting CID font /Adobe-Japan1 for /MSゴシック, see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Japan1" is not provided either. Will exit with error.
Error: /undefined in findresource
Operand stack:
  --dict:7/16(L)--   F28   44.0   --dict:6/6(L)--   --dict:6/6(L)--   MSゴシック   --dict:11/12(ro)(G)--   --nostringval--   CIDFontObject   --dict:7/7(L)--   --dict:7/7(L)--   Adobe-Japan1
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3 
   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--
   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   --nostringval--   --nostringval--   
   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %loop_continueDictionary stack:
   --dict:1166/1684(ro)(G)--   --dict:1/20(G)--   --dict:77/200(L)--   --dict:77/200(L)--   --dict:108/127(ro)(G)--   --dict:288/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:10/15(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.71: Unrecoverable error, exit code 1

そこで、 gs\gs8.71\lib配下にある、cidfmapに以下を追加。

%!
% cidfmap generated automatically by mkcidfm.ps from fonts found in
%   C:/Windows/fonts

% Substitutions
/Gungsuh << /CSI [(Korea1) 3] /Path (C:/Windows/fonts/batang.ttc) /FileType /TrueType /SubfontID 2 >> ;
/MS-PMincho << /CSI [(Japan1) 3] /Path (C:/Windows/fonts/msmincho.ttc) /FileType /TrueType /SubfontID 1 >> ;
/MS-UI-Gothic << /CSI [(Japan1) 3] /Path (C:/Windows/fonts/msgothic.ttc) /FileType /TrueType /SubfontID 2 >> ;
~~~割愛 ~~~
/Dotum << /CSI [(Korea1) 3] /Path (C:/Windows/fonts/gulim.ttc) /FileType /TrueType /SubfontID 2 >> ;
/PMingLiU << /CSI [(CNS1) 2] /Path (C:/Windows/fonts/mingliu.ttc) /FileType /TrueType /SubfontID 1 >> ;
/SimSun << /CSI [(GB1) 2] /Path (C:/Windows/fonts/simsun.ttc) /FileType /TrueType /SubfontID 0 >> ;

<826C8272835383568362834E>cvn << /Path (C:/WINDOWS/Fonts/msmincho.ttc) /FileType /TrueType /SubfontID 0 /CSI [(Japan1) 3] >> ; ←ここに追加(終端のセミコロンまで。「>> ;」のスペースは必要)

% Aliases
/MSung-Medium /MingLiU ;
/MSung-Light /MingLiU ;
/HeiseiKakuGo-W5 /MS-Gothic ;
~~~割愛 ~~~
/STSong-Light /SimSun ;
/MKai-Medium /MingLiU ;
/MHei-Medium /MingLiU ;

"<>"部分はフォント名をUTF-8・16進数で変換したのをセットする必要がある。

  • MSゴシック ⇒ 826C8272835383568362834E
  • MS明朝   ⇒ 826C827296BE92A9

※日本語で、「/MSゴシック」や「/MSゴシックのUTF-8・16進数」はエラーになるので注意!


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-07-05 (火) 11:46:08 (2842d)