mszep / pandoc_resume

The Markdown Resume
http://mszep.github.io/pandoc_resume/
MIT License
1.65k stars 758 forks source link

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

Open zhangzq71 opened 3 years ago

zhangzq71 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

mszep commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Thank you very much! I will try.

hgye commented 2 years ago

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]