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 the Label and TextArea classes.
[Visual Basic]
' Create a Type 1 font.
Dim MyType1Font As Type1Font = New Type1Font( "C:\Eras.pfm", "C:\Eras.pfb" )
' Use the Type 1 font in a text area Page Element.
MyPage.Elements.Add( New TextArea( "Text", 0, 0, 200, 12, MyType1Font, 12 ) )
[C#]
// Create a Type 1 font.
Type1Font type1Font = new Type1Font( @"C:\Eras.pfm", @"C:\Eras.pfb" );
// Use the Type 1 font in a text area Page Element.
page.Elements.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 the Type1Font object only once, and use it where ever 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 (Shared in VB) member variable. This static member variable can then be used anywhere the font is required.
| See Also |
Type1Font Class | ceTe.DynamicPDF.Text Namespace | Label Class | TextArea Class | Performance Considerations | Fonts And Text | Programming with Generator for .NET

