6

I need to create a document using a few fonts. Two or three will be metafont fonts used for most of the document in a Latin-based language, and then I need to use another font for a SE Asian language (so probably a TrueType font or similar as I can't find any TeX-based fonts that work with SE Asian languages). As I understand it, I can combine fonts quite easily for Latin-based languages:

\documentclass{book}
\usepackage[T1]{fontenc}
\begin{document}
Regular {\fontfamily{pzc}\selectfont and special} fonts.
\end{document}

gives me the desired effect:

enter image description here

but as soon as I add fontspec, which is required by polyglossia, the Zapf Chancery (pzc) font no longer works:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{polyglossia}
\newfontfamily\thaifont{Norasi}
\setdefaultlanguage{english}
\setotherlanguage{thai}
\begin{document}
English regular {\fontfamily{pzc}\selectfont and special} fonts.\\
\begin{thai}ตัวพิมพ์ภาษาไทย\end{thai}
\end{document}

produces:

enter image description here

Is there any way to avoid this problem? To be clear, I think I must use polyglossia to use SE Asian languages, and I must use multiple metafont fonts as well.

Answer

As pointed out by Ulrike Fischer, and further elucidated by egreg, \fontencoding needs to be specified when using metafont fonts under fontspec because the latter expects EU1 whereas the former needs T1 (I'm summarising from what I understand about fontencoding, which is not much).

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{polyglossia}
\newfontfamily\thaifont{Norasi}
\setdefaultlanguage{english}
\setotherlanguage{thai}
\begin{document}
English regular {\fontencoding{T1}\fontfamily{pzc}\selectfont and special} fonts.\\
\begin{thai}ตัวพิมพ์ภาษาไทย\end{thai}
\end{document}

yields the correct output:

enter image description here

  • 2
    You must change the encoding too: {\fontencoding{T1}\fontfamily{pzc}\selectfont and special}. Be careful with non-ascii-chars: some of them will not map to the correct glyph. – Ulrike Fischer Mar 19 '14 at 11:02
  • Thanks, @UlrikeFischer. fontencoding is indeed the issue as @egreg points out, fontspec expects EU1. Since you answered first, if you want to convert your comment to an answer, I'll mark yours as the answer. Otherwise, I'll give it to @egreg. – user35260 Mar 19 '14 at 11:48
  • Note that you are almost certainly not using metafonts at all. You are probably using type1 fonts. – cfr Mar 19 '14 at 14:30
  • @cfr cmr and pzc are not Type1, but Norasi obviously is. – user35260 Mar 20 '14 at 8:54
  • @yhten You are using T1 so you are using type1 versions of the fonts unless you don't have them. I don't know if pzc is even available as metafont. – cfr Mar 20 '14 at 16:06
6

You often are able to find OpenType/TrueType substitutes for the fonts you need and this is the case with Zapf Chancery: a clone is available as TeX Gyre Chorus. But also native TeX/Metafont fonts can be used: an example with the Dürer font follows.

\documentclass{book}
\usepackage{fontspec}
\usepackage{polyglossia}

\newfontfamily\thaifont{Sathu} % I don't have Norasi
\newfontfamily\specialfont{TeX Gyre Chorus}

\setmainlanguage{english}
\setotherlanguage{thai}

\usepackage{duerer} % for a MF font

\begin{document}

English regular {\specialfont and special} fonts.\\
\begin{thai}ตัวพิมพ์ภาษาไทย\end{thai}

\textdurm{ABCDE} % duerer has only uppercase

\end{document}

What \textdurm{ABCDE} does is, essentially,

{\fontencoding{OT1}\fontfamily{durm}\selectfont ABCDE}

and \fontencoding{OT1} (or \fontencoding{T1}) is what you were missing, because the default encoding with XeLaTeX and fontspec is EU1.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy