CTeX-org/ctex-kit

default bold and italic fonts in windows

davidcarlisle opened this issue · 1 comments

This issue is caused by looking at

https://tex.stackexchange.com/questions/709358/pdflatexfile-simsun-ttc-in-wsl2-cannot-open-truetype-font-file-for-reading

If you have fontset=windows then as far as I understand the code ctex-fontset-windows.def ends up checking if msyh.ttc exists and if it does, does this (with ttf or ttc)

\setCJKmainfont { simsun.ttc }
          [ BoldFont = simhei.ttf, ItalicFont = simkai.ttf 

However a default European Windows 10 or 11 just has simsun and simsunb and not simhei or simkai

This means that the example in the question works with pdflatex but with lualatex it fails

luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "KaiTi" not found.

and if you add \textbf it also fails in pdflatex

\documentclass[fontset=windows, UTF8]{article}
%\documentclass[fontset=fandol, UTF8]{article}
\usepackage{ctex}

\begin{document}


好 \textbf{好}
\end{document}

produces

!pdfTeX error: pdflatex (file simhei.ttf): cannot open TrueType font file for r
eading
 ==> Fatal error occurred, no output PDF file produced!

Would it be possible to add a test for these fonts and have no bold or different bold (is simsunb usable?) in that case rather than hitting these low level errors.

(Sorry for writing in English)

Ah both Simkai.ttf and Simhei.ttf are part of the Chinese (Simplified) Supplemental Fonts. From this post Supplemental Font Packages can be installed through

Settings > Apps > Optional Features > Add a feature > Select the desired Supplemental Font Packages > Click install

but yes ctex can provide more helpful error messages.