Fonts problem while transforming to PDF

Here should go questions about transforming XML with XSLT and FOP.
Nikky_zhang
Posts: 17

Fonts problem while transforming to PDF

Mon May 23, 2016 6:45 am

Hi,

My problem is about the Fonts of Simsun.

My working environment is DITA-OT 1.8.5 ,Oxygen is 17.0 Author.

I am working on the transformation from DITA file to PDF output with plugin is org.dita.pdf2. And the language is in Chinese. we are working on the transofrm from ditamap tp PDF.


As I set the format of output for <uicontrol> and <wintitle> tag as <font-weight>bold</font-weight> in ui-domain attribute file.

But in the windows/Fonts, we only have normal character for Simsum. So in the PDF output file, the character only shown as normal, not bold.

What can I do to show the character in bold except downloading the Simsun bold character set to Windows.
Simsun no bold can be downloaded.


I have got one warning regarding to the "bold" issue, the warning is :

Font "simsum, normal ,700" not found, substituting with "Simsum,normal,400"

Another one warning is very simliar to this one:

Font "Simsum, italic,400" not found, substituting with "Simsum,normal,400"

After searching online, it seems like one file fop.xconf needs to be updated for simsun, but I don't know how to take this configuration effect in oxygen with DITA-OT build in.

Any help?
Thanks
Last edited by Nikky_zhang on Tue May 24, 2016 12:08 pm, edited 2 times in total.
Nikky_zhang
Posts: 17

Re: Fonts problem while transforming to PDF

Tue May 24, 2016 6:59 am

Hi,

I did some modification in the ui domain attribute file for <uicontrol> tag.

I add the color <xsl:attribute name="color">red</xsl:attribute> for the <unicontrol> tag, and the change takes effecitve to the tag <unicontrol>

but the bold value does not take effect at all for Chinese I mean.

Any help?
radu_pisoi
Posts: 328
Location: Craiova

Re: Fonts problem while transforming to PDF

Tue May 24, 2016 12:00 pm

Hi,

I've tested with oXygen 18.0, DITA-OT 2.2.3, Apache FOP processor and SimSun font that comes installed on Windows 10 platform.

Unfortunately, I was not able to find any Apache FOP configuration to get the bold style for a certain text. It seems to be an Apache FOP limitation.

However, there are two possible solutions:

1. Download and install the bold variant of SimSun font. You can search for 'SimSun-Bold.ttf' font on Google.
2. Use a commercial FOP processor like Antenna House. You can test it using an evaluation license
https://www.antennahouse.com/antenna1/f ... /download/
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Nikky_zhang
Posts: 17

Re: Fonts problem while transforming to PDF

Wed May 25, 2016 12:57 pm

Hi,

I have download the simsun-bold-0.ttf and added it into c:\windows\Fonts\. It solves the bold issue for chinese character. But it causes a big issue to Oxygen.

That is when I eidt file in "author" mode with oxygen, and the Chinese characters put in <titl> tag of each topic are shown as unrecognizable code. They are shown correctly in text mode and in other tages, such as <p>. And the transform to PDF are working fine.

What can I do then ?

Thanks
radu_pisoi
Posts: 328
Location: Craiova

Re: Fonts problem while transforming to PDF

Thu May 26, 2016 2:31 pm

Hi,

A solution is to uninstall the font from your system and modify the Apache FOP configuration file to use it. In this way the font will be used only when you publish to PDF.

For DITA-OT 1.8, open the 'fop.xconf' Apache configuration file from:
{oXygenInstallDir}/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/fop/conf/fop.xconf

and add the next font configuration in 'fonts' section for PDF renderer (<renderer mime="application/pdf">)

Code: Select all

<font kerning="yes" embed-url="file:/D:\workspace\test-fonts\SimSun-Bold.ttf">
  <font-triplet name="SimSun" style="normal" weight="bold"/>
</font>
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Nikky_zhang
Posts: 17

Re: Fonts problem while transforming to PDF

Fri May 27, 2016 4:35 am

Hi

I have done some seach online, and they mentioned a file called font metrics which produced by using one class in fop.jar. After that , we need to add the whole stuff you mentioned in the fop configuration file.

But here you didn't mention the font metrics file. Can you confirm if we need it or not in oxygen environment?

By the way, I tried to uninstall the simsun-bold.fft. But I can not uninstall it from windows it says it is used by other applications. But in fact, I didn't run any applications on my computer.

Hi,

After the test I have done in the morning, I have achieved the following big processes.

1) The fop built in with DITA-OT does not need the font metrics file while you are using the fop.xconf file.
The setting in the file is as same as you mentioned :
[Codebox=]<font kerning="yes" embed-url="file:/D:\workspace\test-fonts\SimSun-Bold.ttf">
<font-triplet name="SimSun" style="normal" weight="bold"/>
</font>[/Codebox]

2) I still can not uninstall the simsun-bold Font in Windows, but my colleague helped me solve the chinese character showing in <title> with author edit mode.

go to Control Panel > personalization >window color > message window (and active window). In both of the pagn, change the Font from simsun to microsoft Yahei.

After that, run the Oxygen, and you will see the chinese character shown in <title> with author mode.

3) So now, the <uicontrl> shown with simsun Bold, and other tags shown with simsun normal.

Up to now, everything is good.

a minor question is the character with simsun bold is too wide.How could I set them slimmer? I mean I don't want to set the <font-size> to 9pt , the size is ok, just too wide.

Thank you for your help!

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests