Font mapping not setting "w:eastAsia" attribute

55 views
Skip to first unread message

Marvin Lau

unread,
Oct 6, 2023, 1:52:30 PM10/6/23
to okapi-users
It looks like font mapping only change the font name in a run. E.g. mapping from "Arial" to "SimSun" for target locale "zh-CN" for a DOCX document:
  • Original run has this: <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial" />
  • Generated document changes to this: <w:rFonts w:ascii="SimSun" w:hAnsi="SimSun" w:cs="SimSun" />
The generated document is not rendered correctly in MS Word or LibreOffice. The English text is rendered with "SimSun" font. The Chinese text is rendered with default font instead of "SimSun". I think this is because the "<w:rFonts>" element does not have the "w:eastAsia" attribute. If every instance of  

<w:rFonts w:ascii="SimSun" w:hAnsi="SimSun" w:cs="SimSun" />

is changed to

<w:rFonts w:ascii="SimSun" w:eastAsia="SimSun" w:hAnsi="SimSun" w:cs="SimSun" />

then the document is rendered correctly in MS Word with the "SimSun" font being used for English and Chinese text.

I used the following font mapping

fontMappings.0.sourceLocalePattern=.*
fontMappings.0.targetLocalePattern=zh-CN
fontMappings.0.sourceFontPattern=Arial.*
fontMappings.0.targetFont=SimSun

And the following tikal command:

tikal.sh -m -fc okf_openxml@custom-font-mapping -sl en -tl zh-CN hello-world.docx.xlf

Are there any settings that will make Okapi add the "w:eastAsia" attibute?

Thanks,
Marvin
Reply all
Reply to author
Forward
0 new messages