Type 1 fonts can be used by creating a Type1Font object, specifying the path to the metrics file (.PFM or .AFM) and font file (.PFB) in the constructor. You can then use that font anywhere a font is specified, such as in the constructors of theLabel and TextArea classes.
[Java]
// Create a Type 1 font.
Type1Font type1Font = new Type1Font("[PhysicalPath]/Eras.pfm", "[PhysicalPath]/Eras.pfb");
// Use the Type 1 font in a text area Page Element.
page1.getElements().add(new TextArea("Text", 0, 0, 200, 12, type1Font, 12));
Type 1 Font Reuse
When using the same Type 1 font many times within the same document, it is important to create theType1Font object only once, and use it whereever needed. Doing this will prevent the font from being embedded in the document multiple times.
When a Type1Font object is initialized, resources are required to parse the font. For fonts that are to be used across multiple documents, the Type1Font class can be initialized and set to a static member variable. This static member variable can then be used anywhere the font is required.
| See Also |
Type1Font Class | Label Class | TextArea Class | Performance Considerations | Fonts And Text | com.cete.dynamicpdf.text Package | Programming with Generator for Java

