Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've been trying to get the Meiryo font to work with LaTeX CJK for quite a while now, but for some reason or other it's always refused to work. I gave it another go today, and managed to actually get some output, but it wasn't really what I expected.

For some reason, processing Hiragana results in characters that I've never seen before being produced in the PDF. A few of the Kanji that I've written are unscathed, but many are replaced by unexpected characters.

I've successfully used the guide at http://www-alg.ist.hokudai.ac.jp/~jan/japfonts.html to allow CJK to use the IPA fonts, but having followed the same tutorial with Meiryo doesn't result in anything usable. My suspicion is that the Unicode glyphs are in the wrong places, or something along those lines.

I've got the .tfm files produced by running ttf2tfm on meiryo.ttc in /usr/share/texmf-texlive/fonts/tfm/meiryo, and the .td files in /usr/share/texmf-texlive/tex/latex/CJK fonts.

The contents of the relevant .td and .map files are as follows:

c70meiryo.td:

\DeclareFontFamily{C70}{meiryo}{\hyphenchar \font\m@ne}
\DeclareFontShape{C70}{meiryo}{m}{n}{<-> CJK * meiryo}{}
\DeclareFontShape{C70}{meiryo}{bx}{n}{<-> CJKb * meiryo}{\CJKbold}

ttfonts.map (only relevant bits)

ipam@UJIS@ ipam.ttf
ipam-uni@Unicode@ ipam.ttf
meiryo@Unicode@ meiryo.ttc
msjh@Unicode@ unicode msjh.ttf

Also, here's a part of the document that I'm trying to make with this font - I'm using the flashcards package, but I feel that it's unlikely that that has much of an impact on the font problem. I'm using an a4 paper size for the cards, and there's no default .cfg file for that, so if necessary you can either change the paper type to avery5371 in the documentclass, or make a file a4paper.cfg in your flashcards directory (mine is /usr/share/texmf-texlive/tex/latex/flashcards), and put in the following:

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesFile{a4paper.cfg}
\newcommand{\cardpapermode}{portrait}
\newcommand{\cardpaper}{a4paper}
\newcommand{\cardrows}{5}
\newcommand{\cardcolumns}{2}
\setlength{\cardheight}{2.126in}
\setlength{\cardwidth}{3.346in}
\setlength{\topoffset}{0.5in}
\setlength{\oddoffset}{1.0in}
\setlength{\evenoffset}{1.0in}

\endinput

A LaTeX document to use for any testing, if required (it throws up some other errors that I haven't worked around yet). Currently uses meiryo encoding. Default for CJK is min, I think:

\documentclass[a4paper,grid]{flashcards}
\usepackage{verbatim}
\usepackage{CJK}
\usepackage{ruby}

\renewcommand{\rubysize}{0.4}
\renewcommand{\rubysep}{-0.8}

\cardfrontstyle[\fontsize{90pt}{0.2cm}\slshape]{headings}
\cardbackstyle{plain}

\newcommand{\df}[3]{#1 -- #2 -- #3}
\newcommand{\rdf}[3]{\ruby{#1}{#2} -- #3}
\newcommand{\md}{\fontsize{18pt} \selectfont}

\begin{document}

\begin{CJK}{UTF8}{meiryo}
  \begin{flashcard}{映}
    \begin{tabular}{cc}
      \begin{minipage}[b]{0.5\linewidth}\centering
        \begin{tabular}{c}
          \textbf{Reflect}\\
        \end{tabular}
      \end{minipage}
      \hspace{-1cm}
      &\begin{minipage}[b]{0.5\linewidth}\centering
        \md
        \begin{tabular}{c}
          うつ--る\\
          うつ--す\\
          えい
        \end{tabular}
      \end{minipage}
      \vspace*{0.1cm}
    \end{table}
    \fontsize{12pt} \selectfont
    \begin{tabular}{l}
      \rdf{映画}{えいが}{Movie}\\
      \rdf{上映}{じょうえい}{Show a movie}\\
      \rdf{放映}{ほうえい}{Televising}
    \end{tabular}
  \end{flashcard}

\end{document}

Here are some pictures of what I'm talking about:

Compiling the above using meiryo as the font:

with ipam as the font:

Any ideas as to what the problem may be, and how I should go about fixing it?

share|improve this question
    
I think this problem is likely to have been caused by the way that I had installed the font. I had converted it to .enc and .tfm, rather than purely .tfm. Once I converted to just tfm, the font displayed properly. –  heuristicus Jan 29 '11 at 21:46

1 Answer 1

I don't suppose you could consider using XeTeX or LuaTeX instead to compile your document? For example, here's a modified version of your minimal example (which for some reason seems to have lots of errors in it):

\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Hiragino Mincho Pro}
\usepackage{ruby}
\renewcommand{\rubysize}{0.7}
\renewcommand{\rubysep}{-0.8pt}
\newcommand{\rdf}[3]{\ruby{#1}{#2} -- #3}
\begin{document}
    \begin{tabular}{l}
      \rdf{映画}{えいが}{Movie}\\
      \rdf{上映}{じょうえい}{Show a movie}\\
      \rdf{放映}{ほうえい}{Televising}
    \end{tabular}
\end{document}
share|improve this answer
    
I've tried compiling your example with LuaTeX and XeTeX. Both of them just give me a ton of undefined control sequence errors. Is it possible to use LaTeX packages in either of those, because this document has effectively no use without that package. –  heuristicus Dec 10 '10 at 10:30
    
@heuristicus — almost all LaTeX packages work fine with xelatex and lualatex. You'll have to be more specific about the errors you're facing. –  Will Robertson Jan 1 '11 at 16:40
    
Here's the output I get when attempting to compile the example with XeTeX:pastebin.com/rXwmu1YS. LuaTeX gives me almost exactly the same errors. –  heuristicus Jan 9 '11 at 15:59
    
@heuristicus use xelatex not xetex. –  Will Robertson Jan 9 '11 at 22:23
    
@heuristicus using xelatex and saving the file as utf-8. –  Ma Ming Mar 29 '11 at 21:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.