[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] Using Japanese in FOP
George, I've been able to generate a Japanese PDF using FOP. I've only done this for a few short files just to prove it could be done, but it seems to work ok. At a high level, what I did was to create font metrics for the MS Gothic font, which is a unicode font, link things up so that fop can access the font and its metrics, then use a file with UTF-8 encoding. I don't know how to print Japanese directly from Shift-JIS, but it's pretty easy to get utf-8 from Shift-JIS. Here is the environment I used: - fop 0.93 - Saxon 6.5.3 - MS Gothic font (C:\WINDOWS\Fonts\MSGOTHIC.TTC on XP systems) - OS is irrelevant as far as I can tell, but beware that MS Gothic may be legally restricted to Windows, so if you use another OS, you may want to check out a unicode font page like http://wazu.jp, which lists a bunch of choices, some open source, some not. Here are the steps: - Follow the instructions on the following page for getting a font metrics file from MSGOTHIC.TTC: http://xmlgraphics.apache.org/fop/0.93/fonts.html MSGOTHIC.TTC is a font collection file with three font I used MS Gothic and haven't tried the others. - This step will yield an xml file that I'll call MSGothic.xml. - Put this file somewhere convenient; in this example it's in C:\myfonts\MSGothic.xml. - Edit your fop.conf file to include a reference to the metrics file and font file. E.g., <font metrics-url="file:///C:/myfonts/MSGothic.xml" kerning="yes" embed-url="file:///C:/WINDOWS/Fonts/MSGOTHIC.TTC"> <font-triplet name="MSGothic" style="normal" weight="normal"/> <font-triplet name="MSGothic" style="normal" weight="bold"/> </font> - Specify the font MSGothic in your XSL customization layer. Here is a stripped down stylesheet that just imports the standard and sets the body and title font families. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> <xsl:import href="/path-to-styles/1.72.0/fo/docbook.xsl"/> <xsl:param name="body.font.family">MSGothic</xsl:param> <xsl:param name="title.font.family">MSGothic</xsl:param> </xsl:stylesheet> - Convert the content from Shift-JIS to UTF8. I use iconv on Linux to do this; I don't know if there's an equivalent on Windows. - Run the transforms using the customization layer that specifies the font, then run fop using the fop.conf file that contains the code described above. That should do the trick. There may be other gotchas with larger examples, but I hope this gets you headed in the right direction. Dick Hamilton rlhamilton@frii.com -----Original Message----- From: Eckel, George [mailto:geckel@amazon.com] Sent: Wednesday, May 16, 2007 1:57 AM To: docbook-apps@lists.oasis-open.org Subject: [docbook-apps] Using Japanese in FOP I have a docbook book that has been translated into Japanese. FOP will not produce a PDF. Seems like encoding="Shift_JIS" would do the trick but no. I've fiddled with a lot of other changes without success. Has anyone made docbook files in Japanese go through FOP? If so, can you please send me either an example file or the steps you took to make FOP work with the JP character set? Thanks, George.. Amazon, Inc.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]