I have created a userConfig file to add MSGOTHIC font to FOP.
<fop version="1.0">
<renderers>
<renderer mime="application/pdf">
<fonts>
<!-- register a particular font -->
<font metrics-url="file:/tmp/msmsgothic.xml" kerning="yes"
embed-file="file:/tmp/msgothic.ttf">
<font-triplet name="MSGothic" style="normal" weight="normal"/>
</font>
<font metrics-url="file:/tmp/msmsgothic.xml" kerning="yes"
embed-file="file:/tmp/msgothic.ttf">
<font-triplet name="MSGothic" style="normal" weight="bold"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
Now I have set the config in my fop object :
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
fopFactory.setUserConfig(userConfigFile);
The font is getting registered as I can see in logs.
org.apache.fop.fonts.FontInfo: Registering: MSGothic,normal,400 under F15 org.apache.fop.fonts.FontInfo: Registering: MSGothic,normal,700 under F16
But it is not being found while lookup:
Fri Aug 17 15:40:11 2012 GMT VendorPaymentsInvoiceRealTimeWorkerService12614-0@shrgupta.desktop.amazon.com:0 [TRACE] (pool-1-thread-1) org.apache.fop.fonts.FontInfo: Font lookup: MSGOTHIC normal 400
Fri Aug 17 15:40:11 2012 GMT VendorPaymentsInvoiceRealTimeWorkerService12614-0@shrgupta.desktop.amazon.com:0 [TRACE] (pool-1-thread-1) org.apache.fop.fonts.FontInfo: Font lookup: MSGOTHIC normal 400 substitutable
Fri Aug 17 15:40:11 2012 GMT VendorPaymentsInvoiceRealTimeWorkerService12614-0@shrgupta.desktop.amazon.com:0 [WARN] (pool-1-thread-1) org.apache.fop.apps.FOUserAgent: Font "MSGOTHIC,normal,400" not found. Substituting with "any,normal,400".
Substituting with "any,normal,400". This substitution happens and I am not able to see Japanese characters in PDF.
How can I use the font that I specified? Or is there any other way to display Japanese characters in PDF?