Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xeCJK: No fallback for punctuations #515

Closed
cykerway opened this issue May 30, 2020 · 4 comments
Closed

xeCJK: No fallback for punctuations #515

cykerway opened this issue May 30, 2020 · 4 comments
Assignees

Comments

@cykerway
Copy link

Code:

\documentclass[]{article}
\usepackage[AutoFallBack=true]{xeCJK}

\setmainfont{DejaVu Serif}
\setCJKmainfont{FreeSerif}
\setCJKfallbackfamilyfont{\CJKrmdefault}{
    {AR PL UMing CN},
    {Noto Serif CJK KR},
}

\begin{document}

にほんご?한국어!简体中文:繁體中文;English。

\CJKfamilydefault == rm

\end{document}

Result:

CJK and English characters are displayed corrrectly, but all punctuations are tofu.

a

@qinglee
Copy link
Member

qinglee commented May 30, 2020

FreeSerif is not a valid CJK font. So please replace it by AR PL UMing CN in your code.

\documentclass[]{article}
\usepackage[AutoFallBack=true]{xeCJK}

\setmainfont{DejaVu Serif}
\setCJKmainfont{AR PL UMing CN}
\setCJKfallbackfamilyfont{\CJKrmdefault}{Noto Serif CJK KR}

\begin{document}

にほんご?한국어!简体中文:繁體中文;English。

\CJKfamilydefault == rm

\end{document}

You can also assign the font of punctuations individually via option PunctFamily.

@cykerway
Copy link
Author

No, you didn't get my point. I know FreeSerif is not a CJK font and that is the reason I put it there.

My point is, I have installed 2 fallback fonts in case FreeSerif is not enough. But these fallback fonts are not working as expected. In practice, the CJK main font is set by my users, and my job is to provide sane fallbacks in case my users misconfigure. As you can see, these fallbacks didn't successfully guard my users, giving them tofu.

I may consider PunctFamily but I hope puncts can go along with main font fallbacks, so that users don't feel discrepancy between language characters and puncts.

@qinglee
Copy link
Member

qinglee commented May 30, 2020

I did know your point. But I won't fix this issue since it is an edge case. You can raise a warning to your users in that case.

@qinglee qinglee added wontfix and removed invalid labels May 30, 2020
@cykerway
Copy link
Author

God. This isn't an edge case but a true bug. The problem happens because AutoFallBack only redefines \CJKsymbol but not \CJKpunctsymbol. It is the latter one that is being used to output punctuations. It is safe to say the current implementation doesn't have fallbacks for punctuations. That would surprise users.

After I duplicated some functions from \CJKsymbol to \CJKpunctsymbol, the problem disappears. Result from the same program:

image

I already made a patch for this. Not necessarily optimized at its best, but I believe is solving the problem in the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants