LuaTeX를 사용하여 트루타입 컬렉션에서 글꼴을 선택하는 문제

LuaTeX를 사용하여 트루타입 컬렉션에서 글꼴을 선택하는 문제

/Library/Fonts/GillSans.ttc내 Mac에 설치된 Gill Sans 글꼴을 사용하고 싶습니다 . 설명서 에 따르면 fontspec글꼴 색인을 지정하면 트루타입 컬렉션을 사용할 수 있다고 합니다. 문서에서는 이것이 LuaTeX에서 작동해야 한다고 주장하지만 작동시키는 데 문제가 있습니다.

트루타입 컬렉션 지원은 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

Extensionttc 파일로 작업할 때 이름을 사용하지 말고 이름에 직접 추가하면 안 됩니다 . 그렇지 않으면 너무 늦게 감지되어 / / 수동으로 .ttc설정해야 합니다 .ItalicFontBoldFontBoldItalicFont

\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}

관련 정보