CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
966 stars 124 forks source link

lualatex + ctex:Font shape undefined (but not on xelatex) #635

Closed Firestar-Reimu closed 1 year ago

Firestar-Reimu commented 1 year ago
\documentclass{article}

\usepackage[fontset=none]{ctex}
\setCJKmainfont{Adobe Song Std}

\begin{document}
\textit{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\end{document}

xelatex 编译:没有问题

lualatex 编译:

LaTeX Font Warning: Font shape `LTJY3/AdobeSongStd(0)/m/it' undefined
(Font)              using `LTJY3/AdobeSongStd(0)/m/n' instead on input line 7.

[1{/home/firestar/.texlive/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./sample.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

)
 1241 words of node memory still in use:
   4 hlist, 1 vlist, 1 rule, 2 glue, 5 kern, 1 glyph, 348 attribute, 60 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 2:1145,3:4,4:15,5:23,6:2,7:86,9:18,11:6
</usr/share/fonts/lmroman10-regular.otf></usr/share/fonts/lmroman10-italic.otf>

Output written on sample.pdf (1 page, 7308 bytes).
Transcript written on sample.log.
Firestar-Reimu commented 1 year ago

I found that define a italic font will fix:

\setCJKmainfont{Adobe Song Std}[ItalicFont=Adobe Song Std]

And this bug is seen on not only Adobe Song but also Noto Serif CJK and other CJK fonts.

Sinofine commented 1 year ago

@Firestar-Reimu should it be infringement to put that font file here?

qinglee commented 1 year ago

这个谈不上 bug,字形没有定义就给出警告是个正常行为。用 xelatex 编译没有警告,是因为还没有实际使用到中文字体,把例子换成 \textit{一二三abc} 就可以给出同样的警告。

ctex 包用 xelatex 编译时,底层依赖 xeCJK,lualatex 则依赖 LuaTeX-ja,这两者机制完全不一样,行为也不完全一致。