XeLaTeX のフォントファミリー

XeLaTeX のフォントファミリー

私は Latex ドキュメントに Agenda というカスタム フォント ファミリをインストールしようとしています。XeLatex を使用しているので、\fontspec でフォントをロードしようとしました。

このコードを使用すると、フォントは正常に動作します。

\documentclass{scrartcl}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage[german]{babel} 
\usepackage[a4paper]{geometry} 
\geometry{verbose,tmargin=10mm,bmargin=10mm,lmargin=10mm,rmargin=5mm} 

\usepackage{fontspec}

\begin{document}
\newfontfamily\bodyfont[]{Agenda}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Agenda Medium}
 hello \textbf{world}
\end{document}

「Änderung」や「Anderung」のように、ウムラウト付きの単語をテキストに追加すると、次のエラーが発生します: Type2 Charstring Parser: charstring の解析に失敗しました: (stataus=-1、stack=5)。

フォントを Arial などの Windows システム フォントに変更すると、次のようになります。

\newfontfamily\bodyfont[]{Arial}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Arial Regular}

...このエラーが発生します:

! fontspec error: "font-not-found"
! The font "Arial Regular" cannot be found.

答え1

\newfontfamily追加のフォントにのみ使用され、メインのフォントには使用されません。

\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Arial}
\newfontfamily\TGPagella[Mapping=tex-text]{TeX Gyre Pagella}
\newfontfamily\Agenda[Mapping=tex-text]{Agenda-Medium}

\begin{document}
hello \textbf{world}

\TGPagella
hello \textbf{world}

\Agenda
hello \textbf{world}
\end{document}

ここに画像の説明を入力してください

関連情報