Packageorg.purepdf.pdf.fonts
Classpublic class BaseFont
InheritanceBaseFont Inheritance it.sephiroth.utils.ObjectHash
Subclasses CJKFont, DocumentFont, TrueTypeFont, Type1Font



Public Properties
 PropertyDefined By
  builtinFonts14 : HashMap
[static] [read-only]
BaseFont
  compressionLevel : int
BaseFont
  encoding : String
[read-only]
BaseFont
  fontSpecific : Boolean
BaseFont
  fontType : int
[read-only]
BaseFont
  subset : Boolean
BaseFont
Protected Properties
 PropertyDefined By
  _builtinFonts14 : HashMap
[static]
BaseFont
  charBBoxes : Vector.<Vector.<int>>
BaseFont
  _compressionLevel : int
BaseFont
  differences : Vector.<String>
BaseFont
  directTextToByte : Boolean = false
BaseFont
  embedded : Boolean
BaseFont
  _encoding : String
BaseFont
  fastWinansi : Boolean = false
BaseFont
  fontCache : HashMap
[static]
BaseFont
  _fontSpecific : Boolean = true
BaseFont
  _fontType : int
BaseFont
  forceWidthsOutput : Boolean = false
BaseFont
  specialMap : Object
BaseFont
  _subset : Boolean = true
BaseFont
  subsetRanges : Vector.<Vector.<int>>
BaseFont
  unicodeDifferences : Vector.<int>
BaseFont
  widths : Vector.<int>
BaseFont
Public Methods
 MethodDefined By
  
BaseFont
  
addSubsetTange(range:Vector.<int>):void
BaseFont
  
charExists(c:int):Boolean
BaseFont
  
convertToByte(char1:int):Bytes
Converts a char to a Bytes according to the font's encoding.
BaseFont
  
convertToBytes(char1:String):Bytes
Converts a char to a Bytes according to the font's encoding.
BaseFont
  
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
  
[static] Creates a unique subset prefix to be added to the font name when the font is embedded and subset.
BaseFont
  
getCharBBox(c:int):Vector.<int>
BaseFont
  
getFamilyFontName():Vector.<Vector.<String>>
BaseFont
  
getFontDescriptor(key:int, fontSize:Number):Number
BaseFont
  
BaseFont
  
getKerning(char1:int, char2:int):int
Gets the kerning between two Unicode chars
BaseFont
  
BaseFont
  
getUnicodeDifferences(index:int):int
BaseFont
  
BaseFont
  
getWidth(code:Object):int
Gets the width of a char in normalized 1000 units Possible input parameters are: String,int
BaseFont
  
getWidthPoint(code:Object, fontSize:Number):Number
Gets the width of a char in points.
BaseFont
  
getWidthPointKerned(text:String, fontSize:Number):Number
Gets the width of a string in points taking kerning into account
BaseFont
  
hasKernPairs():Boolean
Checks if the font has any kerning pairs
BaseFont
  
setKerning(char1:int, char2:int, kern:int):Boolean
BaseFont
  
writeFont(writer:PdfWriter, ref:PdfIndirectReference, params:Vector.<Object>):void
BaseFont
Protected Methods
 MethodDefined By
  
_getWidthI(code:int):int
BaseFont
  
_getWidthS(text:String):int
BaseFont
  
BaseFont
  
getBaseName(name:String):String
[static] Gets the fontname without the modifiers Bold, Italic or BoldItalic.
BaseFont
  
getRawCharBBox(c:int, name:String):Vector.<int>
BaseFont
  
getRawWidth(c:int, name:String):int
Gets the width from the font according to the Unicode char c or the name
BaseFont
  
normalizeEncoding(enc:String):String
[static] Normalize the encoding name
BaseFont
Public Constants
 ConstantDefined By
  AdobeCNS1_UCS2 : String = Adobe-CNS1-UCS2
[static]
BaseFont
  AdobeGB1_UCS2 : String = Adobe-GB1-UCS2
[static]
BaseFont
  AdobeJapan1_UCS2 : String = Adobe-Japan1-UCS2
[static]
BaseFont
  AdobeKorea1_UCS2 : String = Adobe-Korea1-UCS2
[static]
BaseFont
  ASCENT : int = 1
[static]
BaseFont
  AWT_ASCENT : int = 9
[static]
BaseFont
  AWT_DESCENT : int = 10
[static]
BaseFont
  AWT_LEADING : int = 11
[static]
BaseFont
  AWT_MAXADVANCE : int = 12
[static]
BaseFont
  BBOXLLX : int = 5
[static]
BaseFont
  BBOXLLY : int = 6
[static]
BaseFont
  BBOXURX : int = 7
[static]
BaseFont
  BBOXURY : int = 8
[static]
BaseFont
  CACHED : Boolean = true
[static]
BaseFont
  CAPHEIGHT : int = 2
[static]
BaseFont
  CHAR_RANGE_ARABIC : Vector.<int>
[static]
BaseFont
  CHAR_RANGE_CYRILLIC : Vector.<int>
[static]
BaseFont
  CHAR_RANGE_HEBREW : Vector.<int>
[static]
BaseFont
  CHAR_RANGE_LATIN : Vector.<int>
[static]
BaseFont
  CID_NEWLINE : String = U7fff
[static]
BaseFont
  COURIER : String = Courier.afm
[static]
BaseFont
  COURIER_BOLD : String = Courier-Bold.afm
[static]
BaseFont
  COURIER_BOLDOBLIQUE : String = Courier-BoldOblique.afm
[static]
BaseFont
  COURIER_OBLIQUE : String = Courier-Oblique.afm
[static]
BaseFont
  CP1250 : String = Cp1250
[static]
BaseFont
  CP1252 : String = Cp1252
[static]
BaseFont
  CP1257 : String = Cp1257
[static]
BaseFont
  DESCENT : int = 3
[static]
BaseFont
  EMBEDDED : Boolean = true
[static]
BaseFont
  FONT_TYPE_CJK : int = 2
[static]
BaseFont
  FONT_TYPE_DOCUMENT : int = 4
[static]
BaseFont
  FONT_TYPE_T1 : int = 0
[static]
BaseFont
  FONT_TYPE_T3 : int = 5
[static]
BaseFont
  FONT_TYPE_TT : int = 1
[static]
BaseFont
  FONT_TYPE_TTUNI : int = 3
[static]
BaseFont
  HELVETICA : String = Helvetica.afm
[static]
BaseFont
  HELVETICA_BOLD : String = Helvetica-Bold.afm
[static]
BaseFont
  HELVETICA_BOLDOBLIQUE : String = Helvetica-BoldOblique.afm
[static]
BaseFont
  HELVETICA_OBLIQUE : String = Helvetica-Oblique.afm
[static]
BaseFont
  IDENTITY_H : String = Identity-H
[static]
BaseFont
  IDENTITY_V : String = Identity-V
[static]
BaseFont
  ITALICANGLE : int = 4
[static]
BaseFont
  MACROMAN : String = MacRoman
[static]
BaseFont
  NOT_CACHED : Boolean = false
[static]
BaseFont
  notdef : String = .notdef
[static]
BaseFont
  NOT_EMBEDDED : Boolean = false
[static]
BaseFont
  RESOURCE_PATH : String = fonts/
[static]
BaseFont
  STRIKETHROUGH_POSITION : int = 15
[static]
BaseFont
  STRIKETHROUGH_THICKNESS : int = 16
[static]
BaseFont
  SUBSCRIPT_OFFSET : int = 18
[static]
BaseFont
  SUBSCRIPT_SIZE : int = 17
[static]
BaseFont
  SUPERSCRIPT_OFFSET : int = 20
[static]
BaseFont
  SUPERSCRIPT_SIZE : int = 19
[static]
BaseFont
  SYMBOL : String = Symbol.afm
[static]
BaseFont
  TIMES_BOLD : String = Times-Bold.afm
[static]
BaseFont
  TIMES_BOLDITALIC : String = Times-BoldItalic.afm
[static]
BaseFont
  TIMES_ITALIC : String = Times-Italic.afm
[static]
BaseFont
  TIMES_ROMAN : String = Times-Roman.afm
[static]
BaseFont
  UNDERLINE_POSITION : int = 13
[static]
BaseFont
  UNDERLINE_THICKNESS : int = 14
[static]
BaseFont
  UniCNS_UCS2_H : String = UniCNS-UCS2-H
[static]
BaseFont
  UniCNS_UCS2_V : String = UniCNS-UCS2-V
[static]
BaseFont
  UniGB_UCS2_H : String = UniGB-UCS2-H
[static]
BaseFont
  UniGB_UCS2_V : String = UniGB-UCS2-V
[static]
BaseFont
  UniJIS_UCS2_H : String = UniJIS-UCS2-H
[static]
BaseFont
  UniJIS_UCS2_HW_H : String = UniJIS-UCS2-HW-H
[static]
BaseFont
  UniJIS_UCS2_HW_V : String = UniJIS-UCS2-HW-V
[static]
BaseFont
  UniJIS_UCS2_V : String = UniJIS-UCS2-V
[static]
BaseFont
  UniKS_UCS2_H : String = UniKS-UCS2-H
[static]
BaseFont
  UniKS_UCS2_V : String = UniKS-UCS2-V
[static]
BaseFont
  WINANSI : String = Cp1252
[static]
BaseFont
  ZAPFDINGBATS : String = ZapfDingbats.afm
[static]
BaseFont
Property Detail
_builtinFonts14property
protected static var _builtinFonts14:HashMap

_compressionLevelproperty 
protected var _compressionLevel:int

_encodingproperty 
protected var _encoding:String

_fontSpecificproperty 
protected var _fontSpecific:Boolean = true

_fontTypeproperty 
protected var _fontType:int

_subsetproperty 
protected var _subset:Boolean = true

builtinFonts14property 
builtinFonts14:HashMap  [read-only]


Implementation
    public static function get builtinFonts14():HashMap
charBBoxesproperty 
protected var charBBoxes:Vector.<Vector.<int>>

compressionLevelproperty 
compressionLevel:int


Implementation
    public function get compressionLevel():int
    public function set compressionLevel(value:int):void
differencesproperty 
protected var differences:Vector.<String>

directTextToByteproperty 
protected var directTextToByte:Boolean = false

embeddedproperty 
protected var embedded:Boolean

encodingproperty 
encoding:String  [read-only]


Implementation
    public function get encoding():String
fastWinansiproperty 
protected var fastWinansi:Boolean = false

fontCacheproperty 
protected static var fontCache:HashMap

fontSpecificproperty 
fontSpecific:Boolean


Implementation
    public function get fontSpecific():Boolean
    public function set fontSpecific(value:Boolean):void
fontTypeproperty 
fontType:int  [read-only]


Implementation
    public function get fontType():int
forceWidthsOutputproperty 
protected var forceWidthsOutput:Boolean = false

specialMapproperty 
protected var specialMap:Object

subsetproperty 
subset:Boolean


Implementation
    public function get subset():Boolean
    public function set subset(value:Boolean):void
subsetRangesproperty 
protected var subsetRanges:Vector.<Vector.<int>>

unicodeDifferencesproperty 
protected var unicodeDifferences:Vector.<int>

widthsproperty 
protected var widths:Vector.<int>

Constructor Detail
BaseFont()Constructor
public function BaseFont()



Method Detail
_getWidthI()method
protected function _getWidthI(code:int):int

Parameters

code:int

Returns
int
_getWidthS()method 
protected function _getWidthS(text:String):int

Parameters

text:String

Returns
int
addSubsetTange()method 
public function addSubsetTange(range:Vector.<int>):void

Parameters

range:Vector.<int>

charExists()method 
public function charExists(c:int):Boolean

Parameters

c:int

Returns
Boolean
convertToByte()method 
public function convertToByte(char1:int):Bytes

Converts a char to a Bytes according to the font's encoding.

Parameters

char1:int

Returns
Bytes
convertToBytes()method 
public function convertToBytes(char1:String):Bytes

Converts a char to a Bytes according to the font's encoding.

Parameters

char1:String

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

createFont()method 
public static function createFont(name:String, encoding:String, embedded:Boolean, cached:Boolean, ttfAfm:Vector.<int> = null, pfb:Vector.<int> = null, noThrow:Boolean = false, forceRead:Boolean = false):BaseFont

Creates a new font. This font can be one of the 14 built in types, a Type1 font referred to by an AFM or PFM file, a TrueType font (simple or collection) or a CJK font from the Adobe Asian Font Pack. TrueType fonts and CJK fonts can have an optional style modifier appended to the name. These modifiers are: Bold, Italic and BoldItalic. An example would be "STSong-Light,Bold". Note that this modifiers do not work if the font is embedded. Fonts in TrueType collections are addressed by index such as "msgothic.ttc,1". This would get the second font (indexes start at 0), in this case "MS PGothic".

Parameters

name:String
 
encoding:String
 
embedded:Boolean (default = NaN)
 
cached:Boolean (default = NaN)
 
ttfAfm:Vector.<int> (default = null)
 
pfb:Vector.<int> (default = null)
 
noThrow:Boolean (default = false)
 
forceRead:Boolean (default = false)

Returns
BaseFont

Throws
DocumentError
 
IOError
createSubsetPrefix()method 
public static function createSubsetPrefix():String

Creates a unique subset prefix to be added to the font name when the font is embedded and subset.

Returns
String — the subset prefix
getBaseName()method 
protected static function getBaseName(name:String):String

Gets the fontname without the modifiers Bold, Italic or BoldItalic.

Parameters

name:String

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

Parameters

c:int

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

Returns
Vector.<Vector.<String>>
getFontDescriptor()method 
public function getFontDescriptor(key:int, fontSize:Number):Number

Parameters

key:int
 
fontSize:Number

Returns
Number
getFullFontStream()method 
public function getFullFontStream():PdfStream

Returns
PdfStream

Throws
IOError
 
DocumentError;
getKerning()method 
public function getKerning(char1:int, char2:int):int

Gets the kerning between two Unicode chars

Parameters

char1:int
 
char2:int

Returns
int
getPostscriptFontName()method 
public function getPostscriptFontName():String

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

Parameters

c:int
 
name:String

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

Gets the width from the font according to the Unicode char c or the name

Parameters

c:int
 
name:String

Returns
int
getUnicodeDifferences()method 
public function getUnicodeDifferences(index:int):int

Parameters

index:int

Returns
int
getUnicodeEquivalent()method 
public function getUnicodeEquivalent(c:int):int

Parameters

c:int

Returns
int
getWidth()method 
public function getWidth(code:Object):int

Gets the width of a char in normalized 1000 units Possible input parameters are: String,int

Parameters

code:Object — Allowed values are int, String

Returns
int
getWidthPoint()method 
public function getWidthPoint(code:Object, fontSize:Number):Number

Gets the width of a char in points.

Parameters

code:Object — Allowed values are int, String
 
fontSize:Number

Returns
Number
getWidthPointKerned()method 
public function getWidthPointKerned(text:String, fontSize:Number):Number

Gets the width of a string in points taking kerning into account

Parameters

text:String
 
fontSize:Number

Returns
Number
hasKernPairs()method 
public function hasKernPairs():Boolean

Checks if the font has any kerning pairs

Returns
Boolean
normalizeEncoding()method 
protected static function normalizeEncoding(enc:String):String

Normalize the encoding name

Parameters

enc:String

Returns
String
setKerning()method 
public function setKerning(char1:int, char2:int, kern:int):Boolean

Parameters

char1:int
 
char2:int
 
kern:int

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

Parameters

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


Throws
DocumentError
 
IOError
Constant Detail
AdobeCNS1_UCS2Constant
public static const AdobeCNS1_UCS2:String = Adobe-CNS1-UCS2

AdobeGB1_UCS2Constant 
public static const AdobeGB1_UCS2:String = Adobe-GB1-UCS2

AdobeJapan1_UCS2Constant 
public static const AdobeJapan1_UCS2:String = Adobe-Japan1-UCS2

AdobeKorea1_UCS2Constant 
public static const AdobeKorea1_UCS2:String = Adobe-Korea1-UCS2

ASCENTConstant 
public static const ASCENT:int = 1

AWT_ASCENTConstant 
public static const AWT_ASCENT:int = 9

AWT_DESCENTConstant 
public static const AWT_DESCENT:int = 10

AWT_LEADINGConstant 
public static const AWT_LEADING:int = 11

AWT_MAXADVANCEConstant 
public static const AWT_MAXADVANCE:int = 12

BBOXLLXConstant 
public static const BBOXLLX:int = 5

BBOXLLYConstant 
public static const BBOXLLY:int = 6

BBOXURXConstant 
public static const BBOXURX:int = 7

BBOXURYConstant 
public static const BBOXURY:int = 8

CACHEDConstant 
public static const CACHED:Boolean = true

CAPHEIGHTConstant 
public static const CAPHEIGHT:int = 2

CHAR_RANGE_ARABICConstant 
public static const CHAR_RANGE_ARABIC:Vector.<int>

CHAR_RANGE_CYRILLICConstant 
public static const CHAR_RANGE_CYRILLIC:Vector.<int>

CHAR_RANGE_HEBREWConstant 
public static const CHAR_RANGE_HEBREW:Vector.<int>

CHAR_RANGE_LATINConstant 
public static const CHAR_RANGE_LATIN:Vector.<int>

CID_NEWLINEConstant 
public static const CID_NEWLINE:String = U7fff

COURIERConstant 
public static const COURIER:String = Courier.afm

COURIER_BOLDConstant 
public static const COURIER_BOLD:String = Courier-Bold.afm

COURIER_BOLDOBLIQUEConstant 
public static const COURIER_BOLDOBLIQUE:String = Courier-BoldOblique.afm

COURIER_OBLIQUEConstant 
public static const COURIER_OBLIQUE:String = Courier-Oblique.afm

CP1250Constant 
public static const CP1250:String = Cp1250

CP1252Constant 
public static const CP1252:String = Cp1252

CP1257Constant 
public static const CP1257:String = Cp1257

DESCENTConstant 
public static const DESCENT:int = 3

EMBEDDEDConstant 
public static const EMBEDDED:Boolean = true

FONT_TYPE_CJKConstant 
public static const FONT_TYPE_CJK:int = 2

FONT_TYPE_DOCUMENTConstant 
public static const FONT_TYPE_DOCUMENT:int = 4

FONT_TYPE_T1Constant 
public static const FONT_TYPE_T1:int = 0

FONT_TYPE_T3Constant 
public static const FONT_TYPE_T3:int = 5

FONT_TYPE_TTConstant 
public static const FONT_TYPE_TT:int = 1

FONT_TYPE_TTUNIConstant 
public static const FONT_TYPE_TTUNI:int = 3

HELVETICAConstant 
public static const HELVETICA:String = Helvetica.afm

HELVETICA_BOLDConstant 
public static const HELVETICA_BOLD:String = Helvetica-Bold.afm

HELVETICA_BOLDOBLIQUEConstant 
public static const HELVETICA_BOLDOBLIQUE:String = Helvetica-BoldOblique.afm

HELVETICA_OBLIQUEConstant 
public static const HELVETICA_OBLIQUE:String = Helvetica-Oblique.afm

IDENTITY_HConstant 
public static const IDENTITY_H:String = Identity-H

IDENTITY_VConstant 
public static const IDENTITY_V:String = Identity-V

ITALICANGLEConstant 
public static const ITALICANGLE:int = 4

MACROMANConstant 
public static const MACROMAN:String = MacRoman

NOT_CACHEDConstant 
public static const NOT_CACHED:Boolean = false

NOT_EMBEDDEDConstant 
public static const NOT_EMBEDDED:Boolean = false

notdefConstant 
public static const notdef:String = .notdef

RESOURCE_PATHConstant 
public static const RESOURCE_PATH:String = fonts/

STRIKETHROUGH_POSITIONConstant 
public static const STRIKETHROUGH_POSITION:int = 15

STRIKETHROUGH_THICKNESSConstant 
public static const STRIKETHROUGH_THICKNESS:int = 16

SUBSCRIPT_OFFSETConstant 
public static const SUBSCRIPT_OFFSET:int = 18

SUBSCRIPT_SIZEConstant 
public static const SUBSCRIPT_SIZE:int = 17

SUPERSCRIPT_OFFSETConstant 
public static const SUPERSCRIPT_OFFSET:int = 20

SUPERSCRIPT_SIZEConstant 
public static const SUPERSCRIPT_SIZE:int = 19

SYMBOLConstant 
public static const SYMBOL:String = Symbol.afm

TIMES_BOLDConstant 
public static const TIMES_BOLD:String = Times-Bold.afm

TIMES_BOLDITALICConstant 
public static const TIMES_BOLDITALIC:String = Times-BoldItalic.afm

TIMES_ITALICConstant 
public static const TIMES_ITALIC:String = Times-Italic.afm

TIMES_ROMANConstant 
public static const TIMES_ROMAN:String = Times-Roman.afm

UNDERLINE_POSITIONConstant 
public static const UNDERLINE_POSITION:int = 13

UNDERLINE_THICKNESSConstant 
public static const UNDERLINE_THICKNESS:int = 14

UniCNS_UCS2_HConstant 
public static const UniCNS_UCS2_H:String = UniCNS-UCS2-H

UniCNS_UCS2_VConstant 
public static const UniCNS_UCS2_V:String = UniCNS-UCS2-V

UniGB_UCS2_HConstant 
public static const UniGB_UCS2_H:String = UniGB-UCS2-H

UniGB_UCS2_VConstant 
public static const UniGB_UCS2_V:String = UniGB-UCS2-V

UniJIS_UCS2_HConstant 
public static const UniJIS_UCS2_H:String = UniJIS-UCS2-H

UniJIS_UCS2_HW_HConstant 
public static const UniJIS_UCS2_HW_H:String = UniJIS-UCS2-HW-H

UniJIS_UCS2_HW_VConstant 
public static const UniJIS_UCS2_HW_V:String = UniJIS-UCS2-HW-V

UniJIS_UCS2_VConstant 
public static const UniJIS_UCS2_V:String = UniJIS-UCS2-V

UniKS_UCS2_HConstant 
public static const UniKS_UCS2_H:String = UniKS-UCS2-H

UniKS_UCS2_VConstant 
public static const UniKS_UCS2_V:String = UniKS-UCS2-V

WINANSIConstant 
public static const WINANSI:String = Cp1252

ZAPFDINGBATSConstant 
public static const ZAPFDINGBATS:String = ZapfDingbats.afm