[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: {pdf,}LaTeX, Japanese and UTF-8



On Tue, Mar 11, 2003 at 02:36:07AM +1100, Paul Hampson wrote:
> On Thu, Feb 27, 2003 at 11:21:28PM +1100, Paul Hampson wrote:
> > Hi! I'm trying to make the 'Unicode Support for Latex (ucs.sty)
> > work with Japanese and either latex or pdflatex.
[trim]
> Although it uses the bitmapped font in hbf-kanji48... I've
> not succeeded in making it use a different font, as seen in
> the commented out DeclareFont* lines. :-)

I've now gotten both the ucs.sty and CJK-Latex UTF-8 solutions
to work, and can use different fonts. However, the two solutions
draw from a disjoint sets of fonts..

ucs.sty reconverts the UTF-8 characters back to their normal
encoding (In Japanese, C40) and so can only use a JISX208-encoded
font, like hbf-kanji48, ttf-xtt-watanabe-mincho and ttf-xtt-wadalab-gothic.

CJK-latex uses encoding C70 (UTF-8) directly, so it uses fonts
encoded in Unicode, like Cyberbit, MS's Arial Unicode,
ttf-kochi-wadalab-gothic and ttf-kochi-watanabe-mincho (w/ and
without naga10 hinting)

In all cases, the .ttf was copied to
/usr/local/share/texmf/fonts/truetype
and then a directory in /usr/local/share/texmf/fonts/tfm/
was created for that font. In that directory,
ttf2tfm <ttffile> -q <6letters>@<Encoding>@
was run, where <ttffile> is obviously the font file,
<6letters> is the latex-visible font name, and it prolly
should be the same as the directory name. <Encoding> is
SJIS for fonts destined for ucs.sty and Unicode for fonts
heading for CJK-latex C70 mode. For fonts heading for
ucs.sty, you may need to put -P 3 -E 2 (For MS SJIS TT, the
default is -P 3 -E 1 for MS Unicode2 TT) before the <6letters>
or it will complain of an unsupported Provider/Encoding pair.
(The meanings of the -P and -E numbers are in the ttf2tfm man page)

This command will output a line like:
ariuni@Unicode@     arialuni.ttf
for the C70 fonts and
wadago@SJIS@     wadalab-gothic.ttf Pid=3 Eid=2
for the C40 fonts.

This line should be added to:
/usr/share/texmf/ttf2pk/ttfonts.map
Get rid of the ..'s and such on the filename.

Anyway, now run mktexlsr and you should be able to use
those fonts, like in the files below:

(Oh, I noticed that with both of the below files, pdflatex
didn't give as good results as latex then dvipdfm. At 1000%
zoom, though, but it's worth noting)

Now, if only I could get it to use the local fonts, like the
ISO-8859-1 fonts do, rather than including the used glyphs in
the PDF file...

Comments, suggestions and corrections are both welcome and
actively sought. I haven't seen any of this information
gathered in the once place so I figure this is usefule for
someone apart from me. :-)

(This is the version with CJK-latex)
% This is the file UTF8.tex of the CJK package
%   for testing UTF 8 encoding.
%
% written by Werner Lemberg <wl@gnu.org>
%
% Version 4.5.1 (17-Jun-2002)

\documentclass[12pt]{article}

\usepackage{CJK}
\usepackage[T1]{fontenc}

\DeclareFontFamily{C70}{gothic}{}
\DeclareFontShape{C70}{gothic}{m}{n}{<-> CJK * kochig}{}
\DeclareFontShape{C70}{gothic}{bx}{n}{<-> CJKb * kochig}{\CJKbold}
% we want the Unicode font for normal text also
\DeclareFontFamily{T1}{gothic}{}
\DeclareFontShape{T1}{gothic}{m}{n}{<-> kochig00}{}

\DeclareFontFamily{C70}{mincho}{}
\DeclareFontShape{C70}{mincho}{m}{n}{<-> CJK * kochim}{}
\DeclareFontShape{C70}{mincho}{bx}{n}{<-> CJKb * kochim}{\CJKbold}
% we want the Unicode font for normal text also
\DeclareFontFamily{T1}{mincho}{}
\DeclareFontShape{T1}{mincho}{m}{n}{<-> kochim00}{}

\DeclareFontFamily{C70}{arial}{}
\DeclareFontShape{C70}{arial}{m}{n}{<-> CJK * ariuni}{}
\DeclareFontShape{C70}{arial}{bx}{n}{<-> CJKb * ariuni}{\CJKbold}
% we want the Unicode font for normal text also
\DeclareFontFamily{T1}{arial}{}
\DeclareFontShape{T1}{arial}{m}{n}{<-> ariuni00}{}

% we want the Unicode font for normal text also
\DeclareFontFamily{T1}{song}{}
\DeclareFontShape{T1}{song}{m}{n}{<-> cyberb00}{}


\begin{document}

\begin{CJK}{UTF8}{song}

\noindent Hello World!

\noindent Καλημέρα κόσμε

\CJKnospace
\noindent こんにちは 世界

\end{CJK}

\begin{CJK}{UTF8}{arial}

\noindent Hello World!

\noindent Καλημέρα κόσμε

\CJKnospace
\noindent こんにちは 世界

\end{CJK}

\begin{CJK}{UTF8}{mincho}

\noindent Hello World!

%\noindent Καλημέρα κόσμε

\CJKnospace
\noindent こんにちは 世界

\end{CJK}

\begin{CJK}{UTF8}{gothic}

\noindent Hello World!

%\noindent Καλημέρα κόσμε

\CJKnospace
\noindent こんにちは 世界

\end{CJK}


\end{document}

%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-master: t
%%% End:


(This is the version with ucs.sty)
\documentclass[12pt]{article}
\usepackage{a4}
\usepackage[cjkjis]{ucs}
\usepackage[utf8]{inputenc}
\usepackage[C40,T1]{fontenc}

%\DeclareFontFamily{T1}{song}{}
%\DeclareFontShape{T1}{song}{m}{n}{<-> ariuni00}{}
%\DeclareFontShape{T1}{song}{bx}{n}{<-> ariuni00}{}
\DeclareFontFamily{C40}{song}{}
\DeclareFontShape{C40}{song}{m}{n}{<-> CJK * jsso12}{}
\DeclareFontShape{C40}{song}{bx}{n}{<-> CJKb * jsso12}{\CJKbold}
\DeclareFontFamily{C40}{cmr}{}
\DeclareFontShape{C40}{cmr}{m}{n}{<-> CJK * wadago}{}
\DeclareFontShape{C40}{cmr}{bx}{n}{<-> CJKb * wadago}{\CJKbold}
\DeclareFontFamily{C40}{mincho}{}
\DeclareFontShape{C40}{mincho}{m}{n}{<-> CJK * watami}{}
\DeclareFontShape{C40}{mincho}{bx}{n}{<-> CJKb * watami}{\CJKbold}
%\renewcommand\rmdefault{song}

\begin{document}
%\begin{CJK}{UTF8}{song}

%\fontencoding{C40}
%\fontfamily{song}
%\selectfont
wadago\\
テスト 書く物

jsso12\\
\fontfamily{song}
\selectfont
テスト 書く物

watami\\
\fontfamily{mincho}
\selectfont
テスト 書く物
\end{document}
-- 
-----------------------------------------------------------
Paul "TBBle" Hampson, MCSE
6th year CompSci/Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson@Anu.edu.au

Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
 -- Kristian Wilson, Nintendo, Inc, 1989

This email is licensed to the recipient for non-commercial
use, duplication and distribution.
-----------------------------------------------------------

Attachment: pgpRnu4kVkdWf.pgp
Description: PGP signature


Reply to: