View Source

When fonts are not embedded in an PDF file ICEpdf must rely on font substitution to load the correct font. Font substitution relies on fonts that are found on the client operating system or deployed in jar file that is on the application classpath (since version 5.0.1). More information on optimization font substitution on the client operating system can be found [here|http://www.icesoft.org/wiki/display/PDF/Optimized+Font+Substitution].

In large deployments it is not always convenient or practical to install fonts needed for improved font substitution. With this problem in mind it is also possible to package and JAR the needed fonts and deploy them with the application. The following example code shows how to create an instance of the FontManager and use it to load font resources from a specific package on the classpath.

{code:borderStyle=solid}
// get an instance to the singleton FontManager
FontManager fontManager = FontManager.getInstance();
// read the four fonts from the package font, they
// are now available to the font manager for font
// substitution.
fontManager.readFontPackage("fonts", Arrays.asList(
new String[]{"CenturySchL-Bold.pfb",
"Dingbats.pfb",
"NimbusMonL-Bold.pfb",
"NimbusSanL-Bold.pfb"}));
{code}

The Pro font engine can read many font types and even some that a particular operating system cannot read. The following font types and file extension are supported by the font engine.

||Font Type ||Extensions||
| TrueType | *.ttf, *.dfont, *.ttc |
| Type1 | *.pfa, *.pfb |
| OpenType | *.otf, *.otc |