LuaTeX で TrueType コレクションからフォントを選択する際の問題

LuaTeX で TrueType コレクションからフォントを選択する際の問題

/Library/Fonts/GillSans.ttcMac にインストールされている Gill Sans フォントを使用したいと思います。fontspecドキュメントによると、フォント インデックスを指定することで TrueType コレクションを使用できるはずです。ドキュメントでは、これは LuaTeX でも機能するはずだと記載されていますが、うまく機能しません。

TrueType コレクションのサポートは XeTeX でのみテストされていますが、最新バージョンの LuaTeX およびパッケージでも動作するはずですluaotfload

次の最小限のドキュメントは、Gill Sansを使用している限りは機能し、新しいフォントファミリーを定義することでフォントの特定の太さ/形状を使用することも可能であるようですが、、など\setmainfontのコマンドを使用することはできません\textbf{}\textit{}このドキュメントをコンパイルした出力のスクリーンショットに見られるように。

\documentclass{article}

\usepackage{fontspec}
\setmainfont[
  Ligatures=TeX,
  Extension=.ttc,
  UprightFeatures={FontIndex=0},
  BoldFeatures={FontIndex=4},
  ItalicFeatures={FontIndex=2},
  BoldItalicFeatures={FontIndex=5}]{GillSans}

\newfontfamily\SemiBold[
  Ligatures=TeX,
  Extension=.ttc,
  UprightFeatures={FontIndex=4}]{GillSans}

\begin{document}
\textbf{asdf}
\textit{asdf}
asdf
\textbf{\textit{asdf}}

{\SemiBold asdf}
\end{document}

\SemiBold フォントに切り替えた場合を除いて、"asdf" が同じフォントで表示されるコンパイル ドキュメントからの出力

問題が何であるか、またそれをどのように解決するかを知っている人はいますか? ログには次のように表示されます:

LaTeX Font Warning: Font shape `TU/GillSans(0)/b/n' undefined
(Font)              using `TU/GillSans(0)/m/n' instead on input line 18.

LaTeX Font Warning: Font shape `TU/GillSans(0)/m/it' undefined
(Font)              using `TU/GillSans(0)/m/n' instead on input line 19.

LaTeX Font Warning: Font shape `TU/GillSans(0)/b/it' undefined
(Font)              using `TU/GillSans(0)/b/n' instead on input line 21.

さらに、シェルで次のコマンドを実行すると

luaotfload-tool --find 'Gill Sans SemiBold' -i

次のように返されます。これは、上記のドキュメントがインデックス 4 を介して BoldFont として半太字フォントを選択するように機能することを示しています。

luaotfload | resolve : Font "Gill Sans SemiBold" found!
luaotfload | resolve : Resolved file name "/Library/Fonts/GillSans.ttc", subfont nr. 4


** 1 Gill Sans SemiBold ********************************************************

        ascender: 1487
    averagewidth: 1154
     boundingbox: <table>
                   1: -1162
                   2: -512
                   3: 2279
                   4: 1931
       capheight: 1397
  defaultvheight: 0
       descender: -561
          family: Gill Sans
        fontname: GillSans-SemiBold
        fullname: Gill Sans SemiBold
     italicangle: 0.0
      monospaced: false
    panoseweight: demi
     panosewidth: normal
       pfmweight: 600
        pfmwidth: 5
   platformnames: <table>
           macintosh: <table>
                  family: Gill Sans
                fullname: Gill Sans SemiBold
          postscriptname: GillSans-SemiBold
               subfamily: SemiBold
             windows: <table>
                  family: Gill Sans
                fullname: Gill Sans SemiBold
          postscriptname: GillSans-SemiBold
               subfamily: SemiBold
       subfamily: SemiBold
    subfontindex: 4
           units: 2048
         version: 13.0d1e4
          weight: semibold
           width: normal
         xheight: 934

私は MacTeX 2020、の v3.14/2020-05-06 luaotfload-tool、およびの v2.7iを使用していますfontspec

答え1

ttc ファイルで作業する場合は、 を使用せず、名前に直接Extension追加する必要があります。そうしないと、検出が遅れて、 / / を手動で設定する必要があります。.ttcItalicFontBoldFontBoldItalicFont

\documentclass{article}

\usepackage{fontspec}
\setmainfont[
  Ligatures=TeX,
  UprightFeatures={FontIndex=0},
  BoldFeatures={FontIndex=4},
  ItalicFeatures={FontIndex=2},
  BoldItalicFeatures={FontIndex=5}]{GillSans.ttc}

\newfontfamily\SemiBold[
  Ligatures=TeX,
  Extension=.ttc,
  UprightFeatures={FontIndex=4}]{GillSans}

\begin{document}
\textbf{asdf}
\textit{asdf}
asdf
\textbf{\textit{asdf}}

{\SemiBold asdf}
\end{document}

関連情報