xpdfで日本語が表示されない [解決]

たった,いま気がついた.

エラーの情報.

% xpdf ~/doc/univ/2009/rinko.pdf
Error: Couldn't open cidToUnicode file '/usr/share/xpdf/Adobe-Japan1.cidToUnicode'
Error: Unknown character collection 'Adobe-Japan1'
Error: Couldn't find a mapping to Unicode for font 'Ryumin-Light-Identity-H'
Error: Couldn't create a font for 'Ryumin-Light-Identity-H'

設定等.

% grep "^[^#]" /etc/xpdfrc
include /etc/xpdf/xpdf-japanese
% grep "^[^#]" /etc/xpdf/xpdf-japanese
cidToUnicode    Adobe-Japan1    /usr/share/xpdf/Adobe-Japan1.cidToUnicode
unicodeMap      ISO-2022-JP     /usr/share/xpdf/ISO-2022-JP.unicodeMap
unicodeMap      EUC-JP          /usr/share/xpdf/EUC-JP.unicodeMap
unicodeMap      Shift-JIS       /usr/share/xpdf/Shift-JIS.unicodeMap
cMapDir         Adobe-Japan1    /usr/share/xpdf/CMap
toUnicodeDir                    /usr/share/xpdf/CMap
displayCIDFontTT        Adobe-Japan1    /usr/share/fonts/TTF/Vera.ttf
displayCIDFontTT        GothicBBB-Medium-H      /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        GothicBBB-Medium-Identity-H     /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        HeiseiKakuGo-W5 /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        HeiseiKakuGo-W9 /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        ShinGo-Bold     /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        FutoGoB101-Bold /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        GothicBBB-Meidum        /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        MS-Gothic       /usr/share/fonts/TTF/VeraSe.ttf
displayCIDFontTT        Kochi-Gothic    /usr/share/fonts/TTF/VeraSe.ttf

そして,/usr/share/xpdfを覗いてみると…

% ls /usr/share/xpdf
CMap  EUC-JP.unicodeMap  ISO-2022-JP.unicodeMap  Shift-JIS.unicodeMap

見事にAdobe-Japan1.cidToUnicodeが無い!ナンテコッタイ /(^o^)

ところでVeraSe.ttfってなんぞ?

% ls /usr/share/fonts/TTF/VeraSe.ttf
ls: cannot access /usr/share/fonts/TTF/VeraSe.ttf: そのようなファイルやディレクトリはありません

貴様もか! (^o^)/

これで表示されたら奇跡.

という訳で,自分でパッケージつくるYO!

ABSのやつを流用させて頂く.

% cp -r /var/abs/extra/xpdf-japanese .

PKGBUILDを次のように編集.ほとんど,そのまま.Adobe-Japan1.cidToUnicodeとフォントだけ変更.

pkgname=xpdf-japanese
pkgver=20040727
pkgrel=5
pkgdesc="Adds support for Japanese fonts to xpdf"
arch=('any')
url="http://www.foolabs.com/xpdf/"
license=('GPL2' 'custom')
depends=('xpdf')
install=$pkgname.install
source=(ftp://ftp.foolabs.com/pub/xpdf/$pkgname.tar.gz LICENSE)
md5sums=('a11ee6476d0f381983664fc614f7a95e' '80107f7a1cb3e6c7f2cbd1875a57b430')
build() {
cd $srcdir/$pkgname
install -dm755 $pkgdir/usr/share/xpdf/CMap
install -m644 -t $pkgdir/usr/share/xpdf *.unicodeMap
install -m644 -t $pkgdir/usr/share/xpdf Adobe-Japan1.cidToUnicode
install -m644 -t $pkgdir/usr/share/xpdf/CMap CMap/*
 # relocate language specific files
sed -i 's|/usr/local/share/xpdf/japanese|/usr/share/xpdf|' add-to-xpdfrc
 # X-Fonts are no longer supported by xpdf
sed -i 's|^displayCIDFontX.*$||' add-to-xpdfrc
cat >> add-to-xpdfrc << END_OF_RC_TWEAK
displayCIDFontTT  Adobe-Japan1    /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  GothicBBB-Medium-H  /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  GothicBBB-Medium-Identity-H /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  HeiseiKakuGo-W5 /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  HeiseiKakuGo-W9 /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  ShinGo-Bold /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  FutoGoB101-Bold /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  GothicBBB-Meidum    /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  MS-Gothic   /usr/share/fonts/TTF/ipag.ttf
displayCIDFontTT  Kochi-Gothic    /usr/share/fonts/TTF/ipag.ttf
END_OF_RC_TWEAK
install -Dm644 add-to-xpdfrc $pkgdir/etc/xpdf/$pkgname
install -Dm644 $srcdir/LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

とりあえずフォントはIPAゴシック.IPA明朝でも,もちろん良いのだけれど,ゴシック体のほうが

自分はなんとなくだが,見やすい気がする.

そして,

% makepkg
% pac -U xpdf-japanese-20040727-5-any.pkg.tar.gz

で完了.

めでたし,めでたし.

f:id:jeneshicc:20091122225150p:image

# 修正後に気がついたのだが,自分,xpdfなんて使わなくね? epdfviewだよねいつも.

More Reading
Newer//
Older// 下向き矢印