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

The Chinese character can't be rendered in PDF file. #81

Open
zhangzq71 opened this issue Nov 20, 2021 · 7 comments
Open

The Chinese character can't be rendered in PDF file. #81

zhangzq71 opened this issue Nov 20, 2021 · 7 comments

Comments

@zhangzq71
Copy link

Expected Behavior

Renders the Chinese character as English.

Actual Behavior

All the Chinese character in PDF leave blank.

Steps to reproduce the behavior

Versions

pandoc 2.5
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.7.7
Default user data directory: /home/zzq01/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

mtx-context | ConTeXt Process Management 1.02
mtx-context |
mtx-context | main context file: /usr/share/texmf/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2019.03.21 21:39

@mszep
Copy link
Owner

mszep commented Nov 29, 2021

I believe this might be a fonts issue? It sounds to me like the correct unicode sequences are being used (in any case ConTeXt should be able to handle that without problems), but perhaps the output font does not have a way to show the characters?

Are you able to test with another font which definitely does have the right glyphs to render Chinese characters?

@zhangzq71
Copy link
Author

My system can render the Chinese characters with many fonts, where is the statement to specify the font?

@mszep
Copy link
Owner

mszep commented Dec 1, 2021

It will be in the template.tex file, and you may have to enable certain fonts in ConTeXt. Unfortunately I can't help you with that as I've never done it before.

@hgye
Copy link

hgye commented Dec 16, 2021

I'm also face the same situation. After some google. I think should use \definefontfamily in style files.

refer:
https://tex.stackexchange.com/questions/461295/how-to-use-otf-files-in-context
https://blog.csdn.net/weixin_39518396/article/details/78769632

And this is official documents:
https://wiki.contextgarden.net/index.php?title=Chinese_Japanese_and_Korean&mobileaction=toggle_view_desktop

file diff, please refer.

@ styles/chmduquesne.tex:33 @ $endif$

%\setuppagenumbering[location={footer,center}]

\setupbodyfont[11pt, helvetica]
%% \definefontfamily [mainface] [sans] [Latin Modern Sans]
%% \definefontfamily [mainface] [mono] [Latin Modern Mono] [features=none]
%% \definefontfamily [mainface] [math] [Latin Modern Math]
%% \setupbodyfont [11pt, mainface]
%% \setupbodyfont[11pt, helvetica]
\definefallbackfamily[mainface][serif][Dejavu Serif][range=0x000-0x0400]
\definefontfamily[mainface][serif][STSong]
\definefontfamily[mainface][sans][STSong]
\definefontfamily[mainface][mono][STSong]
% 设置正文字体默认尺寸
\setupbodyfont[mainface,11pt]

% 中文断行
\setscript[hanzi]

\setupwhitespace[medium]

@hgye
Copy link

hgye commented Dec 16, 2021

btw:
Here is better solution for font callback only for chinese fonts, please refer:
https://jeangjs.wordpress.com/2017/04/07/context-%E7%9A%84%E4%B8%AD%E6%96%87%E6%94%AF%E6%8F%B4%EF%BC%9A%E6%A0%B8%E5%BF%83/

@zhangzq71
Copy link
Author

Thank you very much! I will try.

@hgye
Copy link

hgye commented Dec 17, 2021

FYI
In my mbp, following style is suite for chinese & english interweave editing.

@ styles/chmduquesne.tex:33 @ $endif$

%\setuppagenumbering[location={footer,center}]

\setupbodyfont[11pt, helvetica]
%% \setupbodyfont [11pt, mainface]

\definefallbackfamily [mainface] [rm] [STSong] [range=cjkunifiedideographs,force=yes]
\definefontfamily     [mainface] [rm] [DejaVu Serif]

\definefallbackfamily [mainface] [ss] [STSong] [range=cjkunifiedideographs,force=yes]
\definefontfamily     [mainface] [ss] [DejaVu Sans]

\definefallbackfamily [mainface] [tt] [STSong] [features=none,range=cjkunifiedideographs,force=yes]
\definefontfamily     [mainface] [tt] [DejaVu Sans Mono] [features=none]

\definefontfamily     [mainface] [mm] [DejaVu Math]

\setupbodyfont[mainface, 11pt]

% 中文断行
\setscript[hanzi]

\setupwhitespace[medium]

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

No branches or pull requests

3 participants