question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set Chinese character font typeface

See original GitHub issue

I tried set set Chinese character font typeface, but failed. it works for English characters, but not for Chinese characters although they are at the same line.

from docx import Document
from docx.shared import Pt

document = Document()
p = document.add_paragraph('A plain paragraph having some ')
run = p.add_run("\n中文字体设置。Character formatting is applied at the Run level. Examples include font typeface and size, bold, italic, and underline.")
font = run.font
font.name = '宋体' #simSong
font.size = Pt(20)

2017-01-09_153840

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
scannycommented, Jan 9, 2017

Check out this existing issue and see of that solves your problem: #154

0reactions
joaokhocommented, Sep 12, 2019

Bugs I think it’s never success, it’s success to change to font name before the chinese character, but on chinese character always using ‘MS 明朝’ font.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Font Problem with Typing Chinese in Word
No matter I set Asian text font family using "Style" or "Font" -> "Set As Default", whenever I type new Chinese characters, it...
Read more >
The font has chinese characters but I can't type it out?
I am using a font, Kievit for a design project. It is an English font however it says it supports Chinese characters. By...
Read more >
font-face does not work with Chinese font - Stack Overflow
Unfortunately the 'normal' fonts do not support Chinese, so the characters will stay unaffected. Both fonts are located in the same folder as ......
Read more >
Chinese Fonts not properly selected
This happens because the browser tries to find installed fonts based on what language it suspects the characters are. And for some reason ......
Read more >
Chinese Fonts & Related Issues
There are three major encodings for Chinese fonts, two legacy encodings and Unicode. (As the Chinese characters are intimately related to the Japanese...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found