CTeX-org / ctex-kit

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

Make fallbacks also guard \CJKpunctsymbol. #516

Closed cykerway closed 4 years ago

cykerway commented 4 years ago

Currently some punctuations would become tofu if user supplies a non-CJK font as main font, even if CJK font fallbacks are properly set. That is, fallbacks failed to guard some punctuations. This problem occurs because AutoFallBack does not implement fallbacks for \CJKpunctsymbol. Fixed the problem in this patch.

Fix https://github.com/CTeX-org/ctex-kit/issues/515

qinglee commented 4 years ago

Unfortunately, your patch will introduce a new serious bug. The kerning between punctuations will be lost.

\documentclass{article}

\usepackage[AutoFallBack]{xeCJK}

\setCJKmainfont{FreeSerif.otf}

\setCJKfallbackfamilyfont{\CJKrmdefault}{
  {Noto Serif CJK SC},
  {Noto Serif CJK KR},
}

\begin{document}

测试:(测试 %% Kerning lost

\xeCJKsetup{AutoFallBack=false}
\CJKfontspec{Noto Serif CJK SC}

测试:(测试 %% Expected result

\end{document}

image

cykerway commented 4 years ago

Looks like a problem with \xeCJK_aftergroup_reset_Boundary:N for a previous bug. I haven't really looked into this one but I think it's irrelevant to the problem with punctuation fallbacks.

cykerway commented 4 years ago

Looks like the most recent commit has fixed the new bug you raised.