Hi Maxime,

a while ago I had the same issue, and ultimately decided to use the HanaMin
fonts (cf. here http://www.fonts.jp/hanazono/). The ttf is so large it is
split into two files, best configure them in a configuration file you feed
to FOP, like this:


        <!--  HanaMinA Regular -->
        <font kerning="yes" embed-url="HanaMin/HanaMinA.ttf">
            <font-triplet name="HanaMinA" style="normal" weight="normal"/>
        </font>
        <font kerning="yes" embed-url="HanaMin/HanaMinA.ttf">
            <font-triplet name="HanaMinA" style="normal" weight="bold"/>
        </font>
        <font kerning="yes" embed-url="HanaMin/HanaMinA.ttf">
            <font-triplet name="HanaMinA" style="italic" weight="normal"/>
        </font>
        <font kerning="yes" embed-url="HanaMin/HanaMinA.ttf">
            <font-triplet name="HanaMinA" style="italic" weight="bold"/>
        </font>
...

>From Java, you can source such configuration file using
DefaultConfiguration conf = (DefaultConfiguration) new
DefaultConfigurationBuilder().buildFromFile(f);

For more on configuration, check here:
https://xmlgraphics.apache.org/fop/1.1/configuration.html

If you are rendering SVG images, I found registering the font with the
graphics envoronment to be the best option:

GraphicsEnvironment lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
for (File fontFile : myGetFontFilesTtf()) {
try {
Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
if (!lge.registerFont(font)) {
LOGGER.warn("Font registration unsuccessful: " +
fontFile.getAbsolutePath());
} else {...}
...}
}

Best regards,

Robert

Reply via email to