gs文字化けmoto


LaTeXのpsファイルを開いたら文字化けしました。これを解決します。

 エラーメッセージは以下の通り。

$ gs test.ps 

GPL Ghostscript 9.20 (2016-09-26)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.20/Resource/Font/IPAexMincho-H.
Can't find (or can't open) font file IPAexMincho-H.
Didn't find this font on the system!
Substituting font Courier for IPAexMincho-H.
Can't find (or can't open) font file /usr/share/ghostscript/9.20/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Loading NimbusMonL-Regu font from /usr/share/fonts/default/Type1/n022003l.pfb... 4323596 2925392 7830164 6437044 1 done.
Can't find (or can't open) font file /usr/share/ghostscript/9.20/Resource/Font/IPAexGothic-H.
Can't find (or can't open) font file IPAexGothic-H.
Didn't find this font on the system!
Substituting font Courier for IPAexGothic-H.

といわれました。IPAexフォントが見つからないと言ってますね。

まずはIPAexフォントをインストールします。

sudo dnf install ipa-ex*

これだけだとまだ文字化けします。ghostscriptにIPA-exフォントの場所をしています。

cidfmap.localをテキストエディタで新規に開いて。

/ipaexm << /FileType /TrueType /Path (/usr/share/fonts/ipa-ex-mincho/ipaexm.ttf) /SubfontID 0 /CSI [(Japan1) 6] >> ;
/ipaexg << /FileType /TrueType /Path (/usr/share/fonts/ipa-ex-gothic/ipaexg.ttf) /SubfontID 0 /CSI [(Japan1) 6] >> ;
/Ryumin-Light /ipaexm ;
/GothicBBB-Medium /ipaexg ;
/IPAexGothic /ipaexg ;
/IPAexMincho /ipaexm ;

と編集して保存します。

sudo cp ~/cidfmap.local /etc/ghostscript/9.20/cidfmap.local

Fedora31,Fedora32(もしくはFedora30以前も?)では、こちら

として設定ファイルを/etc以下にコピーします。 これで文字化け解決!!

gs文字化け

texファイル編集例

ここで使用したファイルは以下のとおり。 test.texとして保存します。

\documentclass{jarticle}
%\usepackage[utf8x]{inputenc}

%opening
\title{タイトル}
\author{けんけんけんけん漢字}

\begin{document}

\maketitle

\begin{abstract}
概要
\end{abstract}
%\chapter{はじめに}
\section{見出し}
本文
\end{document}
platex test.tex
dvips test.dvi