James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.66k stars 530 forks source link

Chinese Fonts Can't Display in PDF Previewer #231

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello James,

Thanks a lot for your work on the Extension, but recently I got some trouble with displaying Chinese fonts in the PDF previewer.

As an example, I build the following .tex file in the editor \documentclass{ctexart}

\usepackage{fontspec} \setCJKmainfont{AdobeSongStd-Light}

\title{中文字体预览}

\begin{document} \maketitle

\section{测试} 测试

\end{document}

The PDF file generated has no problem in Adobe Acrobat Reader, but the Chinese characters just remain as blank space in the PDF previewer. However, when I comment out the font-setting command in the .tex file, those characters display properly in the previewer, though in some kind of default fonts which do not look very nice. capture

I have TeX Live 2016 Installed on Windows 10 Enterprise, and I set the LaTeX Workshop as well as VS Code in this way: capture

Looking forward to your reply

James-Yu commented 7 years ago

I suspect this is an upstream problem from pdf.js. You may want to double check if the referenced font is available in your system font folder. All-in-all, this extension relies on pdf.js for PDF rendering and display. I will close this issue for now, though feel free to re-open it if anyone think it actually is an extension-related problem.

James-Yu commented 7 years ago

Does this issue appear with today's update? Or it also won't work in previous versions?

On Tue, Aug 8, 2017, 12:22 PM mathada notifications@github.com wrote:

Hello James,

Thanks a lot for your work on the Extension, but recently I got some trouble with displaying Chinese fonts in the PDF previewer.

As an example, I build the following .tex file in the editor \documentclass{ctexart}

\usepackage{fontspec} \setCJKmainfont{AdobeSongStd-Light}

\title{中文字体预览}

\begin{document} \maketitle

\section{测试} 测试

\end{document}

The PDF file generated has no problem in Adobe Acrobat Reader, but the Chinese characters just remain as blank space in the PDF previewer. However, when I comment out the font-setting command in the .tex file, those characters display properly in the previewer, though in some kind of default fonts which do not look very nice. [image: capture] https://user-images.githubusercontent.com/24775214/29056095-3625c762-7c33-11e7-8a8b-2d5a81dd8e22.PNG

I have TeX Live 2016 Installed on Windows 10 Enterprise, and I set the LaTeX Workshop as well as VS Code in this way: [image: capture] https://user-images.githubusercontent.com/24775214/29056197-d4474e8e-7c33-11e7-9cff-a950066fd89f.PNG

Looking forward to your reply

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/James-Yu/LaTeX-Workshop/issues/231, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA-pjf8ZwoO3itogoj9y-TOQebFd7Epks5sV-KIgaJpZM4OwOpy .

-- James Jian Qiao YU, PhD, BEng, MIEEE. Postdoctoral Fellow, The University of Hong Kong. http://www.eee.hku.hk/~jqyu/

ghost commented 7 years ago

This issue did not seem to occur here until recent updates of the latex workshop and vs code. The PDF file itself has no problem, but previewer just doesn't display Chinese fonts properly. Meanwhile, previewing in the TeXWorks editor is fine.

James-Yu commented 7 years ago

Are there anything suspicious in the developer console? It can be accessed from Help->Toggle Developer Tools.