Packageorg.purepdf.pdf.fonts
Classpublic class TrueTypeFont
InheritanceTrueTypeFont Inheritance BaseFont Inheritance it.sephiroth.utils.ObjectHash
Subclasses TrueTypeFontUnicode



Public Properties
 PropertyDefined By
 InheritedbuiltinFonts14 : HashMap
[static] [read-only]
BaseFont
 InheritedcompressionLevel : int
BaseFont
 Inheritedencoding : String
[read-only]
BaseFont
 InheritedfontSpecific : Boolean
BaseFont
 InheritedfontType : int
[read-only]
BaseFont
 Inheritedsubset : Boolean
BaseFont
Protected Properties
 PropertyDefined By
  allNameEntries : Vector.<Vector.<String>>
TrueTypeFont
  bboxes : Vector.<Vector.<int>>
TrueTypeFont
 Inherited_builtinFonts14 : HashMap
[static]
BaseFont
  cff : Boolean = false
TrueTypeFont
  cffLength : int = 0
TrueTypeFont
  cffOffset : int = 0
TrueTypeFont
 InheritedcharBBoxes : Vector.<Vector.<int>>
BaseFont
  cmap10 : HashMap
TrueTypeFont
  cmap31 : HashMap
TrueTypeFont
  cmapExt : HashMap
TrueTypeFont
 Inherited_compressionLevel : int
BaseFont
 Inheriteddifferences : Vector.<String>
BaseFont
  directoryOffset : int = 0
TrueTypeFont
 InheriteddirectTextToByte : Boolean = false
BaseFont
 Inheritedembedded : Boolean
BaseFont
 Inherited_encoding : String
BaseFont
  familyName : Vector.<Vector.<String>>
TrueTypeFont
 InheritedfastWinansi : Boolean = false
BaseFont
  fileName : String
TrueTypeFont
 InheritedfontCache : HashMap
[static]
BaseFont
  fontName : String
TrueTypeFont
 Inherited_fontSpecific : Boolean = true
BaseFont
 Inherited_fontType : int
BaseFont
 InheritedforceWidthsOutput : Boolean = false
BaseFont
  fullName : Vector.<Vector.<String>>
TrueTypeFont
  GlyphWidths : Vector.<int>
TrueTypeFont
  head : FontHeader
TrueTypeFont
  hhea : HorizontalHeader
TrueTypeFont
  isFixedPitch : Boolean = false
TrueTypeFont
  italicAngle : Number = 0
TrueTypeFont
  justNames : Boolean = false
TrueTypeFont
  kerning : Dictionary
TrueTypeFont
  kerning_size : int = 0
TrueTypeFont
  os_2 : WindowsMetrics
TrueTypeFont
  rf : ByteArray
TrueTypeFont
 InheritedspecialMap : Object
BaseFont
  style : String
TrueTypeFont
 Inherited_subset : Boolean = true
BaseFont
 InheritedsubsetRanges : Vector.<Vector.<int>>
BaseFont
  tables : HashMap
TrueTypeFont
  ttcIndex : String
TrueTypeFont
  underlinePosition : int = 0
TrueTypeFont
  underlineThickness : int = 0
TrueTypeFont
 InheritedunicodeDifferences : Vector.<int>
BaseFont
 Inheritedwidths : Vector.<int>
BaseFont
Public Methods
 MethodDefined By
  
TrueTypeFont
 Inherited
addSubsetTange(range:Vector.<int>):void
BaseFont
 Inherited
charExists(c:int):Boolean
BaseFont
 Inherited
convertToByte(char1:int):Bytes
Converts a char to a Bytes according to the font's encoding.
BaseFont
 Inherited
convertToBytes(char1:String):Bytes
Converts a char to a Bytes according to the font's encoding.
BaseFont
 Inherited
createFont(name:String, encoding:String, embedded:Boolean, cached:Boolean, ttfAfm:Vector.<int> = null, pfb:Vector.<int> = null, noThrow:Boolean = false, forceRead:Boolean = false):BaseFont
[static] Creates a new font.
BaseFont
 Inherited
[static] Creates a unique subset prefix to be added to the font name when the font is embedded and subset.
BaseFont
 Inherited
getCharBBox(c:int):Vector.<int>
BaseFont
  
getFamilyFontName():Vector.<Vector.<String>>
[override]
TrueTypeFont
  
getFontDescriptor(key:int, fontSize:Number):Number
[override] Gets the font parameter identified by key.
TrueTypeFont
 Inherited
BaseFont
 Inherited
getKerning(char1:int, char2:int):int
Gets the kerning between two Unicode chars
BaseFont
  
getMetricsTT(c:int):Vector.<int>
Gets the glyph index and metrics for a character.
TrueTypeFont
 Inherited
BaseFont
 Inherited
getUnicodeDifferences(index:int):int
BaseFont
 Inherited
BaseFont
 Inherited
getWidth(code:Object):int
Gets the width of a char in normalized 1000 units Possible input parameters are: String,int
BaseFont
 Inherited
getWidthPoint(code:Object, fontSize:Number):Number
Gets the width of a char in points.
BaseFont
 Inherited
getWidthPointKerned(text:String, fontSize:Number):Number
Gets the width of a string in points taking kerning into account
BaseFont
  
hasKernPairs():Boolean
[override]
TrueTypeFont
  
init($ttFile:String, $enc:String, $emb:Boolean, $ttfAfm:Vector.<int>, $justNames:Boolean, $forceRead:Boolean):void
Creates a new TrueType font.
TrueTypeFont
  
setKerning(char1:int, char2:int, kern:int):Boolean
[override]
TrueTypeFont
  
writeFont(writer:PdfWriter, ref:PdfIndirectReference, params:Vector.<Object>):void
[override]
TrueTypeFont
Protected Methods
 MethodDefined By
 Inherited
_getWidthI(code:int):int
BaseFont
 Inherited
_getWidthS(text:String):int
BaseFont
  
addRangeUni(longTag:HashMap, includeMetrics:Boolean, subsetp:Boolean):void
TrueTypeFont
  
compactRanges(ranges:Vector.<Vector.<int>>):Vector.<int>
[static]
TrueTypeFont
 Inherited
BaseFont
 Inherited
getBaseName(name:String):String
[static] Gets the fontname without the modifiers Bold, Italic or BoldItalic.
BaseFont
  
getFontBaseType(fontDescriptor:PdfIndirectReference, subsetPrefix:String, firstChar:int, lastChar:int, shortTag:Vector.<int>):PdfDictionary
Generates the font dictionary for this font.
TrueTypeFont
  
Generates the font descriptor for this font.
TrueTypeFont
  
TrueTypeFont
  
getGlyphWidth(glyph:int):int
Gets width of a glyph
TrueTypeFont
  
getRawCharBBox(c:int, name:String):Vector.<int>
[override]
TrueTypeFont
  
getRawWidth(c:int, name:String):int
[override]
TrueTypeFont
  
getTTCName(name:String):String
[static] Gets the name from a composed TTC file name.
TrueTypeFont
 Inherited
normalizeEncoding(enc:String):String
[static] Normalize the encoding name
BaseFont
  
process(preload:Boolean):void
Read the font data
TrueTypeFont
  
TrueTypeFont
  
Reads the glyphs widths.
TrueTypeFont
  
readStandardString(length:int):String
Reads a String from the font file as bytes using the Cp1252 encoding
TrueTypeFont
  
readUnicodeString(length:int):String
TrueTypeFont
Public Constants
 ConstantDefined By
 InheritedAdobeCNS1_UCS2 : String = Adobe-CNS1-UCS2
[static]
BaseFont
 InheritedAdobeGB1_UCS2 : String = Adobe-GB1-UCS2
[static]
BaseFont
 InheritedAdobeJapan1_UCS2 : String = Adobe-Japan1-UCS2
[static]
BaseFont
 InheritedAdobeKorea1_UCS2 : String = Adobe-Korea1-UCS2
[static]
BaseFont
 InheritedASCENT : int = 1
[static]
BaseFont
 InheritedAWT_ASCENT : int = 9
[static]
BaseFont
 InheritedAWT_DESCENT : int = 10
[static]
BaseFont
 InheritedAWT_LEADING : int = 11
[static]
BaseFont
 InheritedAWT_MAXADVANCE : int = 12
[static]
BaseFont
 InheritedBBOXLLX : int = 5
[static]
BaseFont
 InheritedBBOXLLY : int = 6
[static]
BaseFont
 InheritedBBOXURX : int = 7
[static]
BaseFont
 InheritedBBOXURY : int = 8
[static]
BaseFont
 InheritedCACHED : Boolean = true
[static]
BaseFont
 InheritedCAPHEIGHT : int = 2
[static]
BaseFont
 InheritedCHAR_RANGE_ARABIC : Vector.<int>
[static]
BaseFont
 InheritedCHAR_RANGE_CYRILLIC : Vector.<int>
[static]
BaseFont
 InheritedCHAR_RANGE_HEBREW : Vector.<int>
[static]
BaseFont
 InheritedCHAR_RANGE_LATIN : Vector.<int>
[static]
BaseFont
 InheritedCID_NEWLINE : String = U7fff
[static]
BaseFont
 InheritedCOURIER : String = Courier.afm
[static]
BaseFont
 InheritedCOURIER_BOLD : String = Courier-Bold.afm
[static]
BaseFont
 InheritedCOURIER_BOLDOBLIQUE : String = Courier-BoldOblique.afm
[static]
BaseFont
 InheritedCOURIER_OBLIQUE : String = Courier-Oblique.afm
[static]
BaseFont
 InheritedCP1250 : String = Cp1250
[static]
BaseFont
 InheritedCP1252 : String = Cp1252
[static]
BaseFont
 InheritedCP1257 : String = Cp1257
[static]
BaseFont
 InheritedDESCENT : int = 3
[static]
BaseFont
 InheritedEMBEDDED : Boolean = true
[static]
BaseFont
 InheritedFONT_TYPE_CJK : int = 2
[static]
BaseFont
 InheritedFONT_TYPE_DOCUMENT : int = 4
[static]
BaseFont
 InheritedFONT_TYPE_T1 : int = 0
[static]
BaseFont
 InheritedFONT_TYPE_T3 : int = 5
[static]
BaseFont
 InheritedFONT_TYPE_TT : int = 1
[static]
BaseFont
 InheritedFONT_TYPE_TTUNI : int = 3
[static]
BaseFont
 InheritedHELVETICA : String = Helvetica.afm
[static]
BaseFont
 InheritedHELVETICA_BOLD : String = Helvetica-Bold.afm
[static]
BaseFont
 InheritedHELVETICA_BOLDOBLIQUE : String = Helvetica-BoldOblique.afm
[static]
BaseFont
 InheritedHELVETICA_OBLIQUE : String = Helvetica-Oblique.afm
[static]
BaseFont
 InheritedIDENTITY_H : String = Identity-H
[static]
BaseFont
 InheritedIDENTITY_V : String = Identity-V
[static]
BaseFont
 InheritedITALICANGLE : int = 4
[static]
BaseFont
 InheritedMACROMAN : String = MacRoman
[static]
BaseFont
 InheritedNOT_CACHED : Boolean = false
[static]
BaseFont
 Inheritednotdef : String = .notdef
[static]
BaseFont
 InheritedNOT_EMBEDDED : Boolean = false
[static]
BaseFont
 InheritedRESOURCE_PATH : String = fonts/
[static]
BaseFont
 InheritedSTRIKETHROUGH_POSITION : int = 15
[static]
BaseFont
 InheritedSTRIKETHROUGH_THICKNESS : int = 16
[static]
BaseFont
 InheritedSUBSCRIPT_OFFSET : int = 18
[static]
BaseFont
 InheritedSUBSCRIPT_SIZE : int = 17
[static]
BaseFont
 InheritedSUPERSCRIPT_OFFSET : int = 20
[static]
BaseFont
 InheritedSUPERSCRIPT_SIZE : int = 19
[static]
BaseFont
 InheritedSYMBOL : String = Symbol.afm
[static]
BaseFont
 InheritedTIMES_BOLD : String = Times-Bold.afm
[static]
BaseFont
 InheritedTIMES_BOLDITALIC : String = Times-BoldItalic.afm
[static]
BaseFont
 InheritedTIMES_ITALIC : String = Times-Italic.afm
[static]
BaseFont
 InheritedTIMES_ROMAN : String = Times-Roman.afm
[static]
BaseFont
 InheritedUNDERLINE_POSITION : int = 13
[static]
BaseFont
 InheritedUNDERLINE_THICKNESS : int = 14
[static]
BaseFont
 InheritedUniCNS_UCS2_H : String = UniCNS-UCS2-H
[static]
BaseFont
 InheritedUniCNS_UCS2_V : String = UniCNS-UCS2-V
[static]
BaseFont
 InheritedUniGB_UCS2_H : String = UniGB-UCS2-H
[static]
BaseFont
 InheritedUniGB_UCS2_V : String = UniGB-UCS2-V
[static]
BaseFont
 InheritedUniJIS_UCS2_H : String = UniJIS-UCS2-H
[static]
BaseFont
 InheritedUniJIS_UCS2_HW_H : String = UniJIS-UCS2-HW-H
[static]
BaseFont
 InheritedUniJIS_UCS2_HW_V : String = UniJIS-UCS2-HW-V
[static]
BaseFont
 InheritedUniJIS_UCS2_V : String = UniJIS-UCS2-V
[static]
BaseFont
 InheritedUniKS_UCS2_H : String = UniKS-UCS2-H
[static]
BaseFont
 InheritedUniKS_UCS2_V : String = UniKS-UCS2-V
[static]
BaseFont
 InheritedWINANSI : String = Cp1252
[static]
BaseFont
 InheritedZAPFDINGBATS : String = ZapfDingbats.afm
[static]
BaseFont
Property Detail
allNameEntriesproperty
protected var allNameEntries:Vector.<Vector.<String>>

bboxesproperty 
protected var bboxes:Vector.<Vector.<int>>

cffproperty 
protected var cff:Boolean = false

cffLengthproperty 
protected var cffLength:int = 0

cffOffsetproperty 
protected var cffOffset:int = 0

cmap10property 
protected var cmap10:HashMap

cmap31property 
protected var cmap31:HashMap

cmapExtproperty 
protected var cmapExt:HashMap

directoryOffsetproperty 
protected var directoryOffset:int = 0

familyNameproperty 
protected var familyName:Vector.<Vector.<String>>

fileNameproperty 
protected var fileName:String

fontNameproperty 
protected var fontName:String

fullNameproperty 
protected var fullName:Vector.<Vector.<String>>

GlyphWidthsproperty 
protected var GlyphWidths:Vector.<int>

headproperty 
protected var head:FontHeader

hheaproperty 
protected var hhea:HorizontalHeader

isFixedPitchproperty 
protected var isFixedPitch:Boolean = false

italicAngleproperty 
protected var italicAngle:Number = 0

justNamesproperty 
protected var justNames:Boolean = false

kerningproperty 
protected var kerning:Dictionary

kerning_sizeproperty 
protected var kerning_size:int = 0

os_2property 
protected var os_2:WindowsMetrics

rfproperty 
protected var rf:ByteArray

styleproperty 
protected var style:String

tablesproperty 
protected var tables:HashMap

ttcIndexproperty 
protected var ttcIndex:String

underlinePositionproperty 
protected var underlinePosition:int = 0

underlineThicknessproperty 
protected var underlineThickness:int = 0

Constructor Detail
TrueTypeFont()Constructor
public function TrueTypeFont()



Method Detail
addRangeUni()method
protected function addRangeUni(longTag:HashMap, includeMetrics:Boolean, subsetp:Boolean):void

Parameters

longTag:HashMap
 
includeMetrics:Boolean
 
subsetp:Boolean

compactRanges()method 
protected static function compactRanges(ranges:Vector.<Vector.<int>>):Vector.<int>

Parameters

ranges:Vector.<Vector.<int>>

Returns
Vector.<int>
getFamilyFontName()method 
override public function getFamilyFontName():Vector.<Vector.<String>>

Returns
Vector.<Vector.<String>>
getFontBaseType()method 
protected function getFontBaseType(fontDescriptor:PdfIndirectReference, subsetPrefix:String, firstChar:int, lastChar:int, shortTag:Vector.<int>):PdfDictionary

Generates the font dictionary for this font.

Parameters

fontDescriptor:PdfIndirectReference
 
subsetPrefix:String
 
firstChar:int
 
lastChar:int
 
shortTag:Vector.<int>

Returns
PdfDictionary — the PdfDictionary containing the font dictionary
getFontDescriptor()method 
override public function getFontDescriptor(key:int, fontSize:Number):Number

Gets the font parameter identified by key. Valid values for key are ASCENT, CAPHEIGHT, DESCENT and ITALICANGLE.

Parameters

key:int — the parameter to be extracted
 
fontSize:Number — the font size in points

Returns
Number — the parameter in points
getFontDescriptorRef()method 
protected function getFontDescriptorRef(fontStream:PdfIndirectReference, subsetPrefix:String, cidset:PdfIndirectReference):PdfDictionary

Generates the font descriptor for this font.

Parameters

fontStream:PdfIndirectReference
 
subsetPrefix:String
 
cidset:PdfIndirectReference

Returns
PdfDictionary
getFullFont()method 
protected function getFullFont():Bytes

Returns
Bytes

Throws
EOFError
getGlyphWidth()method 
protected function getGlyphWidth(glyph:int):int

Gets width of a glyph

Parameters

glyph:int

Returns
int
getMetricsTT()method 
public function getMetricsTT(c:int):Vector.<int>

Gets the glyph index and metrics for a character.

Parameters

c:int

Returns
Vector.<int>
getRawCharBBox()method 
override protected function getRawCharBBox(c:int, name:String):Vector.<int>

Parameters

c:int
 
name:String

Returns
Vector.<int>
getRawWidth()method 
override protected function getRawWidth(c:int, name:String):int

Parameters

c:int
 
name:String

Returns
int
getTTCName()method 
protected static function getTTCName(name:String):String

Gets the name from a composed TTC file name.

Parameters

name:String

Returns
String
hasKernPairs()method 
override public function hasKernPairs():Boolean

Returns
Boolean
init()method 
public function init($ttFile:String, $enc:String, $emb:Boolean, $ttfAfm:Vector.<int>, $justNames:Boolean, $forceRead:Boolean):void

Creates a new TrueType font.

Parameters

$ttFile:String — the encoding to be applied to this font
 
$enc:String — true if the font is to be embedded in the PDF
 
$emb:Boolean
 
$ttfAfm:Vector.<int>
 
$justNames:Boolean
 
$forceRead:Boolean


Throws
DocumentError
 
IOError
process()method 
protected function process(preload:Boolean):void

Read the font data

Parameters

preload:Boolean


Throws
DocumentError
 
IOError
readCffFont()method 
protected function readCffFont():Bytes

Returns
Bytes
readGlyphWidths()method 
protected function readGlyphWidths():void

Reads the glyphs widths. The widths are extracted from the table 'hmtx'. The glyphs are normalized to 1000 units.


Throws
DocumentError
 
EOFError
readStandardString()method 
protected function readStandardString(length:int):String

Reads a String from the font file as bytes using the Cp1252 encoding

Parameters

length:int

Returns
String

Throws
IOError
readUnicodeString()method 
protected function readUnicodeString(length:int):String

Parameters

length:int

Returns
String

Throws
EOFError
setKerning()method 
override public function setKerning(char1:int, char2:int, kern:int):Boolean

Parameters

char1:int
 
char2:int
 
kern:int

Returns
Boolean
writeFont()method 
override public function writeFont(writer:PdfWriter, ref:PdfIndirectReference, params:Vector.<Object>):void

Parameters

writer:PdfWriter
 
ref:PdfIndirectReference
 
params:Vector.<Object>