To create a PDF with embedded fonts, a local embeddable TrueType font file has to be identified for each Word document font. In the case where a local font cannot be determined for a Word document font then jWordConvert can be supplied with a single “fallback” font file path to use instead.

Here is more information about the matching logic used by jWordConvert to find and embed fonts when converting to PDF.

What local fonts is jWordConvert searching?

There are 3 different locations where jWordConvert will search for local fonts:

Operating System Fonts
jWordConvert searches well-known operating system directories for font files:

Windows C:\Windows\Fonts
OSX ~/Library/Fonts, /Library/Fonts, /Network/Library/Fonts,/System/Library/Fonts and /System/Folder/Fonts
Linux all directories under /usr/share/fonts

Java Fonts
jWordConvert also includes fonts in the /lib/fonts subdirectory of the current JVM, but many fonts included with Java (ex. Lucida fonts) are marked as not embeddable.

User Fonts
User font folders can be defined through the static method:

 WordDocument.setUserFontDirectories(List dirs)

jWordConvert will search these folders to find embeddable TrueType font files. Fonts found in these user directories will have priority over same-name fonts found in operating system directories (ex. an “Arial Italic” font found in a user font directory would be used instead of “Arial Italic” found in an operating system font directory).

What is jWordConvert’s font matching logic?

Try to find a local embeddable font
jWordConvert looks up document font by primary name in local fonts list. Priority is given to a local font with matching style (bold, italic, etc.), but fonts can be matched by name only. Also lookup document by alternative font name. If we find a match for a local font and it is embeddable, we’ll use this font (will embed local font subset).

Try to use one of the Standard 14 PDF fonts
If there is no match among local fonts, then we try to match the Word document’s font name to one of the Standard 14 PDF fonts.

Try to use fallback font
Try to use the fall back if any is defined in WordConvertOptions (embed fallback font subset). Setting the fallback font.

Throw an error
Throw WordException if fallback font is not set, does not exist or cannot be loaded.

How does jWordConvert determine if a font is embeddable?

To determine if a font is embeddable we look for the permissions bits property in TrueType fonts in the ‘OS/2’ table structure, fsType field. If either the “Restricted License embedding” or “Bitmap embedding only” bits are set then the font is considered not embeddable. (See TrueType font specification for details).