Forum


Replies: 2   Views: 1469
Chinese font is not applied to chinese characters
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by tjchen  · 03-12-2020 - 09:28

Please see the following code.

Both Font A and Font B are built-in Chinese fonts in Windows.

Font A is the default Chinese font in Word.

If I set "Font B" as the default font in php, "Font B" is only applied to "Some English characters" but not applied to "Some Chinese characters". 

$docx = new Phpdocx\Create\CreateDocx();
$docx->setDefaultFont('Font B');
$docx->addText('Some English characters');
$docx->addText('Some Chinese characters');
$docx->addText('Some Chinese characters', ['font'=>'Font B']);
$docx->createDocx('hello_world');

 

Because I can not type Chinese in the forum, please also see the result in the following screenshot.

https://drive.google.com/file/d/15_nAXQQZnQn65ROFzlTW-Y3rDJPOJC47/view?usp=sharing