To simplify the creation of font mapping files, PD4ML v4.0.16 introduces a handy tool. The tool is implemented as an utility of the interactive PD4ML Converter

How to use it

Run the converter, as described by the link /support-topics/pd4ml-v4-programmers-manual/ and click the [Fonts Tool] button on the status bar of the application window.

It will prompt you for the location of the font directory. Select a directory. We can start with system fonts like C:\Windows\Fonts

Because the system font directory contains an excessive number of fonts that your application doesn’t really need, you can filter them out by entering a comma-separated list of font name patterns in the input field next to the “Filter by Font File Name” button. Apply the filter by pressing the button. The resulting list will include only those fonts whose filenames case-insensitively match the given patterns.

The generated list is editable, so you can manually refine it.

At this point you have four options:

  • Close – is obvious: close the tool and lose the current font mapping configuration
  • Use – use the font configuration only in the current session of the PD4ML Converter, without saving it.
  • Save Mapping File – creates a pd4fonts.properties file that can later be referenced from your application with pd4ml.useTTF() API call. If the chosen mapping file location is different from the original font directory (which is a good idea if you are using the system font directory), pd4fonts.properties will include a link to the font dir, allowing PD4ML to find the actual font files.
  • Save as JAR – packages the listed fonts and the corresponding pd4fonts.properties into a JAR file. Fonts are stored in the “pdffonts” JAR subdirectory by default, so once the JAR is deployed with a PD4ML-enabled application, the font configuration can be referenced with pd4ml.useTTF("java:pdffonts") API call. The subdirectory name can be customized by uncommenting and setting the jar.folder=pdffonts property.