-
Notifications
You must be signed in to change notification settings - Fork 765
Add style to support CJK fonts. #29
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
Conversation
- the example codes are commented because it need to install certain fonts to run
…pace in setup.py file
Hi @Hsins Thank you very much for your contribution. Following your instructions in I'll create a new release of SciencePlots soon to add your changes to the PyPI version. |
Hi @garrettj403 It's really glad to hear that you successfully run example 14 with that instructions. :) By the way, the little trouble I mentioned is about the difference between example 14 and example 15.
Although the Example 15 works fine in my machine (as you see the result I uploaded that fig15.pdf before). It always gives the error with the message It seems that there was not a missing glyphs problem because Example 15 works fine and the Guidelines for Using Noto page said each font supports all four languages:
So I'm sorry to say that I can't guarantee the |
I get this error as well when I include the Korean characters. Example 14 works for me with the TC/SC/JP characters. I can run example 15, but the Korean characters don't render (they just appear as boxes) and I have to use your PGF preamble: import matplotlib
matplotlib.use('pgf') # switch backend to pgf
matplotlib.rcParams.update({
"pgf.preamble": [
"\\usepackage{fontspec}",
'\\usepackage{xeCJK}',
r'\setmainfont{Times New Roman}', # EN fonts Romans
r'\setCJKmainfont{SimHei}', # set CJK fonts as SimSun
r'\setCJKsansfont{SimHei}',
r'\newCJKfontfamily{\Song}{SimSun}',
]
}) |
I don't think it's a problem with the setting of style params but the problem with the font file or even the LaTeX Engine. So just leave the issue for anyone who needs to use Korean in their plots. 😂😂😂😂😂 |
I forgot to explain what the PGF preamble does.
The fonts are given to
|
This pull request is about the issue #16.
"Noto Serif CJK {TC, SC, JP, KR}"
is not pre-installed in any operating systems. Users need to install those fonts before using thecjk-fonts
style.backend='pgf'
instead ofno-latex
. I got into some trouble with theno-latex
option although there are no missing glyphs in the font.Finally, the result:
jpg
format)