oXygen 14のDITA-OT 1.5.4で日本語出力させる方法
前回のDITA-OT 1.5.3から1.5.4で日本語の出力方法が若干変わったので,再掲。
default.languageの変更
%DITA-OT/lib/configuration.propertiesのdefault.languageをjaに変更。
#DITA-OT configuration properties
default.language = ja
# PDF2 defaults
org.dita.pdf2.index.frame-markup = false
org.dita.pdf2.i18n.enabled = true
org.dita.pdf2.use-out-temp = false
1.5.3から1.5.4への変更で一番変わったところがここです。まさかマイナーバージョンでここを変えてくるとは思わなかったです。
catalog.xmlの変更
%DITA-OT/demo/fo/Customization/catalog.xml.origを%DITA-OT/demo/fo/Customization/catalog.xmlにコピーします。
そして,font-mappings.xmlを有効にするようにコメントを外します。
<?xml version="1.0" ?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> ... <!-- FontMapper configuration override entry.--> <uri name="cfg:fo/font-mappings.xml" uri="fo/font-mappings.xml"/> ... </catalog>
font-mappings.xmlの変更
相変わらず,adobeのフォントをデフォルトにしているので変更します。
%DITA-OT/demo/fo/cfg/fo/font-mappings.xmlを%DITA-OT/demo/fo/Customization/foへコピーします。
そしてphysical-fontを修正します。
<font-mappings> <font-table> <!-- Backwards compatibility aliases --> <aliases> <alias name="serif">Serif</alias> </aliases> <aliases> <alias name="sans-serif">Sans</alias> </aliases> <aliases> <alias name="monospace">Monospaced</alias> </aliases> <aliases> <alias name="Helvetica">Normal</alias> </aliases> <aliases> <alias name="Courier">Monospaced</alias> </aliases> <logical-font name="Sans"> <physical-font char-set="default"> <font-face>Helvetica, Arial Unicode MS</font-face> </physical-font> <physical-font char-set="Simplified Chinese"> <font-face>AdobeSongStd-Light</font-face> </physical-font> <physical-font char-set="Japanese"> <font-face>IPAGothic</font-face> </physical-font> <physical-font char-set="Korean"> <font-face>AdobeMyungjoStd-Medium</font-face> </physical-font> <physical-font char-set="Symbols"> <font-face>ZapfDingbats</font-face> </physical-font> <physical-font char-set="SubmenuSymbol"> <font-face>ZapfDingbats</font-face> </physical-font> <physical-font char-set="SymbolsSuperscript"> <font-face>Helvetica, Arial Unicode MS</font-face> <baseline-shift>20%</baseline-shift> <override-size>smaller</override-size> </physical-font> </logical-font> <logical-font name="Serif"> <physical-font char-set="default"> <font-face>Times New Roman, Times</font-face> </physical-font> <physical-font char-set="Simplified Chinese"> <font-face>AdobeSongStd-Light</font-face> </physical-font> <physical-font char-set="Japanese"> <font-face>IPAMincho</font-face> </physical-font> <physical-font char-set="Korean"> <font-face>AdobeMyungjoStd-Medium</font-face> </physical-font> <physical-font char-set="Symbols"> <font-face>ZapfDingbats</font-face> </physical-font> <physical-font char-set="SubmenuSymbol"> <font-face>ZapfDingbats</font-face> </physical-font> <physical-font char-set="SymbolsSuperscript"> <font-face>Times New Roman, Times</font-face> <baseline-shift>20%</baseline-shift> <override-size>smaller</override-size> </physical-font> </logical-font> <logical-font name="Monospaced"> <physical-font char-set="default"> <font-face>Courier New, Courier</font-face> </physical-font> <physical-font char-set="Simplified Chinese"> <font-face>AdobeSongStd-Light</font-face> </physical-font> <physical-font char-set="Japanese"> <font-face>IPAGothic</font-face> </physical-font> <physical-font char-set="Korean"> <font-face>AdobeMyungjoStd-Medium</font-face> </physical-font> <physical-font char-set="Symbols"> <font-face>ZapfDingbats</font-face> </physical-font> <physical-font char-set="SymbolsSuperscript"> <font-face>Courier New, Courier</font-face> <baseline-shift>20%</baseline-shift> <override-size>smaller</override-size> </physical-font> </logical-font> </font-table> </font-mappings>
fop.xconfの変更
font-baseと埋め込みフォントの設定を行います。
IPAフォントとフォントメトリックスはC:\fop-1.0\fontsにあるとします。
<!-- NOTE: This is the version of the configuration --> <fop version="1.0"> <!-- Strict FO validation --> <strict-validation>false</strict-validation> <!-- Base URL for resolving relative URLs --> <base>.</base> <font-base>C:\fop-1.0\fonts</font-base> ... <!-- Information for specific renderers --> <!-- Uses renderer mime type for renderers --> <renderers> <renderer mime="application/pdf"> <filterList> <!-- provides compression using zlib flate (default is on) --> <value>flate</value> <!-- encodes binary data into printable ascii characters (default off) This provides about a 4:5 expansion of data size --> <!-- <value>ascii-85</value> --> <!-- encodes binary data with hex representation (default off) This filter is not recommended as it doubles the data size --> <!-- <value>ascii-hex</value> --> </filterList> <fonts> <!-- embedded fonts --> <!-- This information must exactly match the font specified in the fo file. Otherwise it will use a default font. For example, <fo:inline font-family="Arial" font-weight="bold" font-style="normal"> Arial-normal-normal font </fo:inline> for the font triplet specified by: <font-triplet name="Arial" style="normal" weight="bold"/> If you do not want to embed the font in the pdf document then do not include the "embed-url" attribute. The font will be needed where the document is viewed for it to be displayed properly. possible styles: normal | italic | oblique | backslant possible weights: normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 (normal = 400, bold = 700) --> <!-- <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf"> <font-triplet name="Arial" style="normal" weight="normal"/> <font-triplet name="ArialMT" style="normal" weight="normal"/> </font> <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf"> <font-triplet name="Arial" style="normal" weight="bold"/> <font-triplet name="ArialMT" style="normal" weight="bold"/> </font> --> <font metrics-url="ipamincho.xml" embed-url="ipam.ttc" kerning="yes"> <font-triplet name="IPAMincho" style="normal" weight="normal"/> <font-triplet name="IPAMincho" style="normal" weight="bold"/> <font-triplet name="IPAMincho" style="italic" weight="normal"/> <font-triplet name="IPAMincho" style="italic" weight="bold"/> </font> <font metrics-url="ipagothic.xml" embed-url="ipag.ttc" kerning="yes"> <font-triplet name="IPAGothic" style="normal" weight="normal"/> <font-triplet name="IPAGothic" style="normal" weight="bold"/> <font-triplet name="IPAGothic" style="italic" weight="normal"/> <font-triplet name="IPAGothic" style="italic" weight="bold"/> </font> </fonts> <!-- This option lets you specify additional options on an XML handler --> <!--xml-handler namespace="http://www.w3.org/2000/svg"> <stroke-text>false</stroke-text> </xml-handler--> </renderer> ...