I would like to integrate a custom font into a synth style. I found a possible answer here but the interesting part - the xml - is not visible on that site.
Could some one explain to me, how to integrate this custom object into the xml?
I figured it out by myself. For everyone searching for this topic, here's the solution. Create a new class:
public class CustomFontResource {
public static FontUIResource createFont(String path, final int size) {
Font font = Font.createFont(Font.TRUETYPE_FONT,
new FileInputStream(path));
FontUIResource fontResource = new FontUIResource(font.deriveFont(
Font.PLAIN, size));
return fontResource;
}
}
Add this to the style.xml:
<object id="your_font_id" class="yourpackage.CustomFontResource"
method="createFont">
<string>fontpath</string>
<int>desired size</int>
</object>
<style ...>
<font idref="your_font_id" />
</style>