Let's supose you want to use a font not present in the system. For example you want to use a 'grunge' font:
The font used here is Viper Vera. It turns out that you can 'embed' the font with your application. How?
At the Java FX forum you can read:
You embed the font along with your application. You load the font by name. Simply place the ttf font file in a package in your application. Then you need to include a fonts.mf file in the META-INF of the jar so that we can discover the embedded fonts at runtime. The fonts.mf file is simply a properties file that lists the name of the font and the location of the font.
fonts.mf:
Arindam\ Neo\ Bold = /com/mycompany/fonts/arind.ttf
for example. Then in code you just load a font by name, using the name that you entered into your fonts.mf:
Font {
name: "Arindam Neo Bold"
size: 27
}

No hay comentarios:
Publicar un comentario