
copy the fonts to the target location /opt/fonts. create a directory on device to hold the fonts and configuration (for example /opt/fonts):. The fonts used in the examples can be found in a full JDK distribution under. Follow these steps to set up custom fonts for JavaFX. You can configure JavaFX to find and use custom fonts without fontconfig. Configuring Embedded Linux for custom fonts Certain embedded configurations may not contain this directory, in which case the directory and its contents can be copied from a standard JDK. If the target device does not have fontconfig, JavaFX will attempt to use the 8 standard Lucida fonts found in $/lib/fonts. The fontconfig package is not installed if the following command returns no result: $ find /usr/lib -name libfontconfig.so -o -name libfontconfig.so.1 JavaFX on an Embedded Linux device without the fontconfig library Some devices do not have the Linux fontconfig package. It is usually associated with X11, but does not require it. Fontconfig provides for a powerful means of identifying and finding installed fonts. On Linux, JavaFX will use fontconfig to find fonts. To change the default value of 80 pixels, use -Dprism.fontSizeLimit=xx Embedded Device Fonts Adjusting this limit might improve performance for some types of applications that a limited set of very large characters, though at an impact to the texture cache. JavaFX caches rasterized characters up to a size limit, and then uses paths for rendering after than. Generally fonts look better when rendered from a raster includes hinting and other tricks to make it look its best. Big Fontsįonts can be rendered by either using a cached raster (bitmap) or with a path. Refer to the Font class in the JavaFX API Documentation. You can also load a web font by passing the URL to using the loadFont() method. You can include a custom font in a JavaFX application JAR bundle. This failure is the result of CSS failing to find the metrics for the default font. Note: if no fonts can be resolved, JavaFX will likely fail in CSS initialization. Any compatible fonts added to the host system should be found. JavaFX supports discovery of the host system fonts. Note: for embedded environments, the use of native rasterization by default will happen after 8u26. To determine the "system" font that JavaFX will use for a logical font: $ fc-match sans.regular On Linux, the font config tools can be used to discover which fonts are present, for example fc-list and fc-match. It is still possible to fallback if needed to the previous rasterier with -Dprism.text=t2k Font Enginesįor Linux, MacOSx and Windows, JavaFX defaults to a native rasterizer library. Bitmap fonts and Type 1 fonts are not supported.
The preferred format is TrueType outlines. However, some configurations or use cases require additional setup of fonts. JavaFX will usually require no additional setup of fonts.