Packageorg.purepdf.pdf.fonts
Classpublic class FontsResourceFactory
InheritanceFontsResourceFactory Inheritance Object

Use this class if you want to register more fonts to be used with the document



Public Methods
 MethodDefined By
  
Do not use constructor to initialize this class but getInstance should be used
FontsResourceFactory
  
fontIsRegistered(name:String):Boolean
Return true if a font is already registered
FontsResourceFactory
  
getFontFile(filename:String):ByteArray
FontsResourceFactory
  
[static] Return the singleton of FontsResourceFactory
FontsResourceFactory
  
registerFont(name:String, file:ByteArray):void
You can register a new font passing the bytearray class of an embedded resource Example [Embed(source="assets/fonts/Helvetica-Bold.afm", mimeType="application/octet-stream")] private var helveticaB: Class; public function main() { // this will register a custom, user defined font FontsResourceFactory.getInstance().registerFont( BaseFont.HELVETICA_BOLD, new helveticaB() ); // register a new font, using one of the builtin fonts FontsResourceFactory.getInstance().registerFont( BaseFont.HELVETICA, new BuiltinFonts.HELVETICA() ); var font: Font = new Font( Font.HELVETICA, 18, Font.BOLD ); document.addElement( new Paragraph("Hello world", font) ); } You can use the built-in fonts embedded into the separate BuiltinFonts class
FontsResourceFactory
Constructor Detail
FontsResourceFactory()Constructor
public function FontsResourceFactory(lock:Lock)

Do not use constructor to initialize this class but getInstance should be used

Parameters
lock:Lock

See also

Method Detail
fontIsRegistered()method
public function fontIsRegistered(name:String):Boolean

Return true if a font is already registered

Parameters

name:String — the font name. eg. "Helvetica"

Returns
Boolean

See also

getFontFile()method 
public function getFontFile(filename:String):ByteArray

Parameters

filename:String

Returns
ByteArray
getInstance()method 
public static function getInstance():FontsResourceFactory

Return the singleton of FontsResourceFactory

Returns
FontsResourceFactory

See also

registerFont()method 
public function registerFont(name:String, file:ByteArray):void

You can register a new font passing the bytearray class of an embedded resource

Example

		 [Embed(source="assets/fonts/Helvetica-Bold.afm", mimeType="application/octet-stream")]
		 private var helveticaB: Class;
		 public function main()
		 {
		 // this will register a custom, user defined font
		 FontsResourceFactory.getInstance().registerFont( BaseFont.HELVETICA_BOLD, new helveticaB() );
		 // register a new font, using one of the builtin fonts
		 FontsResourceFactory.getInstance().registerFont( BaseFont.HELVETICA, new BuiltinFonts.HELVETICA() );
		 var font: Font = new Font( Font.HELVETICA, 18, Font.BOLD );
		 document.addElement( new Paragraph("Hello world", font) );
		 }
		 

You can use the built-in fonts embedded into the separate BuiltinFonts class

Parameters

name:String — The font name (eg. "Helvetica")
 
file:ByteArray

See also

BuiltinFonts