12 そろそろ完全解決したい: MacPorts Ghostscript のヒラギノ・フォント

macOS 10.10 以前がインストールされていた Mac は、 OS のアップデートするときに、フォントを保存しておいて、 MacPorts で利用できる、とされている。 でも、もう無理ですね。

今度からは IPAex とか使う方法を採用する。

(当分工事中)

目標: 一発で直すスクリプトを作る。


1. Resource/CMap/{2004-H,2004-V}

/opt/local/share/ghostscript/9.2$ x$/Resource/CMap/2004-H,2004-V というファイルが必要そうだ。 これは Hironori KITAGAWA 氏が作成したもので、ファイルの先頭部分を見ると
head -16 2004-H
%!PS-Adobe-3.0 Resource-CMap
%%DocumentNeededResources: ProcSet (CIDInit)
%%IncludeResource: ProcSet (CIDInit)
%%BeginResource: CMap (2004-H)
%%Title: (2004-H Adobe Japan1 6)
%%Version: 0.001
%%Copyright: ------------------------------------------------------------
%%Copyright: Copyright (c) 2013 Hironori KITAGAWA.
%%Copyright:
%%Copyright: This software is free software.
%%Copyright: Unlimited permission is granted to use, copy, and distribute
%%Copyright: it, with or without modification, either commercially and
%%Copyright: noncommercially.
%%Copyright: THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY.
%%Copyright: ------------------------------------------------------------
%%EndComments

変更を加えなければ自由に使って良いということかな。ありがとうございます。

curl -O http://nalab.mind.meiji.ac.jp/~mk/misc/20190518/2004-H
curl -O http://nalab.mind.meiji.ac.jp/~mk/misc/20190518/2004-V
sudo cp -p 2004-H 2004-V /opt/local/share/ghostscript/9.27/Resource/CMap


2. Resource/Font/Hira某

sudo kanji-config-updmap-sys -jis2004 hiragino-pron あるいは sudo kanji-config-updmap-sys -jis2004 hiragino-highsierra-pron とした場合

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/HiraKakuProN-W6-2004-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: 2004-H (CMap)
%%IncludeResource: 2004-H (CMap)
%%BeginResource: Font (HiraKakuProN-W6-2004-H)
(HiraKakuProN-W6-2004-H)
(2004-H) /CMap findresource
[(HiraKakuProN-W6) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/HiraMinProN-W3-2004-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: 2004-H (CMap)
%%IncludeResource: 2004-H (CMap)
%%BeginResource: Font (HiraMinProN-W3-2004-H)
(HiraMinProN-W3-2004-H)
(2004-H) /CMap findresource
[(HiraMinProN-W3) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

sudo kanji-config-updmap-sys -jis2004 hiragino-pro とした場合

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/HiraKakuPro-W6-2004-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: 2004-H (CMap)
%%IncludeResource: 2004-H (CMap)
%%BeginResource: Font (HiraKakuPro-W6-2004-H)
(HiraKakuPro-W6-2004-H)
(2004-H) /CMap findresource
[(HiraKakuPro-W6) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

HiraKakuProN-W6-2004-H HiraMinProN-W3-2004-H HiraKakuPro-W6-2004-H HiraMinPro-W3-2004-H

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/HiraMinPro-W3-2004-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: 2004-H (CMap)
%%IncludeResource: 2004-H (CMap)
%%BeginResource: Font (HiraMinPro-W3-2004-H)
(HiraMinPro-W3-2004-H)
(2004-H) /CMap findresource
[(HiraMinPro-W3) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

3. Resource/Font/{Ryumin-Light-H,GothicBBB-Medium-H}

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/Ryumin-Light-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: H (CMap)
%%IncludeResource: H (CMap)
%%BeginResource: Font (Ryumin-Light-H)
(Ryumin-Light-H)
(H) /CMap findresource
[(HiraMinPro-W3) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

/opt/local/share/ghostscript/9.2$ x$/Resource/Font/GothicBBB-Medium-H
%!PS-Adobe-3.0 Resource-Font
%%DocumentNeededResources: H (CMap)
%%IncludeResource: H (CMap)
%%BeginResource: Font (GothicBBB-Medium-H)
(GothicBBB-Medium-H)
(H) /CMap findresource
[(HiraKakuPro-W3) /CIDFont findresource]
composefont
pop
%%EndResource
%%EOF

あれ W3 なのか?


4. Resource/CIDFont/Hira某

(ここはまだ自信がない。)

#!/bin/sh
echo /opt/local/share/ghostscript/9.2x/Resource/CIDFont にいるとして、
echo /opt/local/share/fonts/otf/Hiragino にあるフォントへのリンクを張る
export POS=/opt/local/share/fonts/otf/Hiragino
sudo ln -s "${POS}/ヒラギノ明朝 Pro W3.otf" HiraMinPro-W3
sudo ln -s "${POS}/ヒラギノ明朝 Pro W6.otf" HiraMinPro-W6
sudo ln -s "${POS}/ヒラギノ角ゴ Pro W3.otf" HiraKakuPro-W3
sudo ln -s "${POS}/ヒラギノ角ゴ Pro W6.otf" HiraKakuPro-W6
sudo ln -s "${POS}/ヒラギノ角ゴ Std W8.otf" HiraKakuStd-W8
sudo ln -s "${POS}/ヒラギノ丸ゴ Pro W4.otf" HiraMaruPro-W4
sudo ln -s "${POS}/ヒラギノ明朝 ProN W3.otf" HiraMinProN-W3
sudo ln -s "${POS}/ヒラギノ明朝 ProN W6.otf" HiraMinProN-W6
sudo ln -s "${POS}/ヒラギノ角ゴ ProN W3.otf" HiraKakuProN-W3
sudo ln -s "${POS}/ヒラギノ角ゴ ProN W6.otf" HiraKakuProN-W6
sudo ln -s "${POS}/ヒラギノ角ゴ StdN W8.otf" HiraKakuStdN-W8
sudo ln -s "${POS}/ヒラギノ丸ゴ ProN W4.otf" HiraMaruProN-W4
sudo mktexlsr

(2019/7/23) 面倒なので、設定ファイルもこちらで用意するか。
curl -O http://nalab.mind.meiji.ac.jp/~mk/misc/20190518/2004-H
curl -O http://nalab.mind.meiji.ac.jp/~mk/misc/20190518/2004-V
sudo cp -p 2004-H 2004-V /opt/local/share/ghostscript/9.27/Resource/CMap

curl -O http://nalab.mind.meiji.ac.jp/~mk/misc/20190723/fontset-v1.tar.gz
tar xzf fontset-v1.tar.gz
cd fontset-v1
sudo cp -p * /opt/local/share/ghostscript/9.27/Resource/Font/

cd /opt/local/share/ghostscript/9.2x/Resource/CIDFont
export POS=/opt/local/share/fonts/otf/Hiragino
sudo ln -s "${POS}/ヒラギノ明朝 Pro W3.otf" HiraMinPro-W3
sudo ln -s "${POS}/ヒラギノ明朝 Pro W6.otf" HiraMinPro-W6
sudo ln -s "${POS}/ヒラギノ角ゴ Pro W3.otf" HiraKakuPro-W3
sudo ln -s "${POS}/ヒラギノ角ゴ Pro W6.otf" HiraKakuPro-W6
sudo ln -s "${POS}/ヒラギノ角ゴ Std W8.otf" HiraKakuStd-W8
sudo ln -s "${POS}/ヒラギノ丸ゴ Pro W4.otf" HiraMaruPro-W4
sudo ln -s "${POS}/ヒラギノ明朝 ProN W3.otf" HiraMinProN-W3
sudo ln -s "${POS}/ヒラギノ明朝 ProN W6.otf" HiraMinProN-W6
sudo ln -s "${POS}/ヒラギノ角ゴ ProN W3.otf" HiraKakuProN-W3
sudo ln -s "${POS}/ヒラギノ角ゴ ProN W6.otf" HiraKakuProN-W6
sudo ln -s "${POS}/ヒラギノ角ゴ StdN W8.otf" HiraKakuStdN-W8
sudo ln -s "${POS}/ヒラギノ丸ゴ ProN W4.otf" HiraMaruProN-W4
sudo mktexlsr

桂田 祐史
2020-04-20