Hello,
Thanks for sending the requested files. The problem comes from one missing attribute support when using the font option with addText: w:eastAsia is not being applied and your font needs it.
We recommend you to use custom paragraph styles (and custom character styles if needed), both methods createParagraphStyle and createCharacterStyle support w:eastAsian attributes:
// style options
$style = array(
'font' => 'fontname',
);
// create custom style
$docx->createParagraphStyle('myStyle', $style);
If you want to add support for w:eastAsian attribute in addText method with the font option without using custom paragraph/character styles, please edit CreateElement.php, and go to generateRFONTS method, instead of:
protected function generateRFONTS($font)
{
$xml = '<' . CreateElement::NAMESPACEWORD .
':rFonts ' . CreateElement::NAMESPACEWORD .
':ascii="' . $font . '" ' . CreateElement::NAMESPACEWORD .
':hAnsi="' . $font . '" ' . CreateElement::NAMESPACEWORD .
':cs="' . $font . '"></' . CreateElement::NAMESPACEWORD .
':rFonts>__GENERATERPR__';
$this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
}
replace it by:
protected function generateRFONTS($font)
{
$xml = '<' . CreateElement::NAMESPACEWORD .
':rFonts ' . CreateElement::NAMESPACEWORD .
':ascii="' . $font . '" ' . CreateElement::NAMESPACEWORD .
':hAnsi="' . $font . '" ' . CreateElement::NAMESPACEWORD .
':eastAsia="' . $font . '" ' . CreateElement::NAMESPACEWORD .
':cs="' . $font . '"></' . CreateElement::NAMESPACEWORD .
':rFonts>__GENERATERPR__';
$this->_xml = str_replace('__GENERATERPR__', $xml, $this->_xml);
}
The same change has been included in the current development branch and will be added to the next release of phpdocx.
Regards.