HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.BaseFont Class Referenceabstract

Summary description for BaseFont. More...

Inheritance diagram for iTextSharp.text.pdf.BaseFont:
iTextSharp.text.pdf.DocumentFont iTextSharp.text.pdf.Type3Font

Classes

class  StreamFont
 

Public Member Functions

abstract int GetKerning (int char1, int char2)
 
abstract bool SetKerning (int char1, int char2, int kern)
 
virtual int GetWidth (int char1)
 
virtual int GetWidth (string text)
 
int GetDescent (String text)
 
int GetAscent (String text)
 
float GetDescentPoint (String text, float fontSize)
 
float GetAscentPoint (String text, float fontSize)
 
float GetWidthPointKerned (String text, float fontSize)
 
float GetWidthPoint (string text, float fontSize)
 
float GetWidthPoint (int char1, float fontSize)
 
abstract PdfStream GetFullFontStream ()
 
abstract float GetFontDescriptor (int key, float fontSize)
 
bool IsEmbedded ()
 
bool IsFontSpecific ()
 
virtual int GetUnicodeEquivalent (int c)
 
virtual int GetCidCode (int c)
 
abstract bool HasKernPairs ()
 
virtual bool CharExists (int c)
 
virtual bool SetCharAdvance (int c, int advance)
 
virtual int[] GetCharBBox (int c)
 
void CorrectArabicAdvance ()
 
void AddSubsetRange (int[] range)
 

Static Public Member Functions

static BaseFont CreateFont ()
 
static BaseFont CreateFont (String name, String encoding, bool embedded)
 
static BaseFont CreateFont (String name, String encoding, bool embedded, bool forceRead)
 
static BaseFont CreateFont (String name, String encoding, bool embedded, bool cached, byte[] ttfAfm, byte[] pfb)
 
static BaseFont CreateFont (String name, String encoding, bool embedded, bool cached, byte[] ttfAfm, byte[] pfb, bool noThrow)
 
static BaseFont CreateFont (String name, String encoding, bool embedded, bool cached, byte[] ttfAfm, byte[] pfb, bool noThrow, bool forceRead)
 
static BaseFont CreateFont (PRIndirectReference fontRef)
 
static string[][] GetFullFontName (string name, string encoding, byte[] ttfAfm)
 
static Object[] GetAllFontNames (String name, String encoding, byte[] ttfAfm)
 
static String[][] GetAllNameEntries (String name, String encoding, byte[] ttfAfm)
 
static string[] EnumerateTTCNames (string ttcFile)
 
static string[] EnumerateTTCNames (byte[] ttcArray)
 
static void AddToResourceSearch (object obj)
 
static Stream GetResourceStream (string key)
 
static ArrayList GetDocumentFonts (PdfReader reader)
 
static ArrayList GetDocumentFonts (PdfReader reader, int page)
 

Static Public Attributes

const string COURIER = "Courier"
 
const string COURIER_BOLD = "Courier-Bold"
 
const string COURIER_OBLIQUE = "Courier-Oblique"
 
const string COURIER_BOLDOBLIQUE = "Courier-BoldOblique"
 
const string HELVETICA = "Helvetica"
 
const string HELVETICA_BOLD = "Helvetica-Bold"
 
const string HELVETICA_OBLIQUE = "Helvetica-Oblique"
 
const string HELVETICA_BOLDOBLIQUE = "Helvetica-BoldOblique"
 
const string SYMBOL = "Symbol"
 
const string TIMES_ROMAN = "Times-Roman"
 
const string TIMES_BOLD = "Times-Bold"
 
const string TIMES_ITALIC = "Times-Italic"
 
const string TIMES_BOLDITALIC = "Times-BoldItalic"
 
const string ZAPFDINGBATS = "ZapfDingbats"
 
const int ASCENT = 1
 
const int CAPHEIGHT = 2
 
const int DESCENT = 3
 
const int ITALICANGLE = 4
 
const int BBOXLLX = 5
 
const int BBOXLLY = 6
 
const int BBOXURX = 7
 
const int BBOXURY = 8
 
const int AWT_ASCENT = 9
 
const int AWT_DESCENT = 10
 
const int AWT_LEADING = 11
 
const int AWT_MAXADVANCE = 12
 
const int UNDERLINE_POSITION = 13
 
const int UNDERLINE_THICKNESS = 14
 
const int STRIKETHROUGH_POSITION = 15
 
const int STRIKETHROUGH_THICKNESS = 16
 
const int SUBSCRIPT_SIZE = 17
 
const int SUBSCRIPT_OFFSET = 18
 
const int SUPERSCRIPT_SIZE = 19
 
const int SUPERSCRIPT_OFFSET = 20
 
const int FONT_TYPE_T1 = 0
 
const int FONT_TYPE_TT = 1
 
const int FONT_TYPE_CJK = 2
 
const int FONT_TYPE_TTUNI = 3
 
const int FONT_TYPE_DOCUMENT = 4
 
const int FONT_TYPE_T3 = 5
 
const string IDENTITY_H = "Identity-H"
 
const string IDENTITY_V = "Identity-V"
 
const string CP1250 = "Cp1250"
 
const string CP1252 = "Cp1252"
 
const string CP1257 = "Cp1257"
 
const string WINANSI = "Cp1252"
 
const string MACROMAN = "MacRoman"
 
static readonly int[] CHAR_RANGE_LATIN = {0, 0x17f, 0x2000, 0x206f, 0x20a0, 0x20cf, 0xfb00, 0xfb06}
 
static readonly int[] CHAR_RANGE_ARABIC = {0, 0x7f, 0x0600, 0x067f, 0x20a0, 0x20cf, 0xfb50, 0xfbff, 0xfe70, 0xfeff}
 
static readonly int[] CHAR_RANGE_HEBREW = {0, 0x7f, 0x0590, 0x05ff, 0x20a0, 0x20cf, 0xfb1d, 0xfb4f}
 
static readonly int[] CHAR_RANGE_CYRILLIC = {0, 0x7f, 0x0400, 0x052f, 0x2000, 0x206f, 0x20a0, 0x20cf}
 
const bool EMBEDDED = true
 
const bool NOT_EMBEDDED = false
 
const bool CACHED = true
 
const bool NOT_CACHED = false
 
const string RESOURCE_PATH = "iTextSharp.text.pdf.fonts."
 
const char CID_NEWLINE = '\u7fff'
 
const string notdef = ".notdef"
 

Protected Member Functions

 BaseFont ()
 
void CreateEncoding ()
 
abstract int[] GetRawCharBBox (int c, String name)
 

Static Protected Member Functions

static string GetBaseName (string name)
 
static string NormalizeEncoding (string enc)
 

Protected Attributes

ArrayList subsetRanges
 
int[] widths = new int[256]
 
string[] differences = new string[256]
 
char[] unicodeDifferences = new char[256]
 
int[][] charBBoxes = new int[256][]
 
string encoding
 
bool embedded
 
int compressionLevel = PdfStream.DEFAULT_COMPRESSION
 
bool fontSpecific = true
 
bool forceWidthsOutput = false
 
bool directTextToByte = false
 
bool subset = true
 
bool fastWinansi = false
 
IntHashtable specialMap
 

Static Protected Attributes

static Hashtable fontCache = new Hashtable()
 
static Hashtable BuiltinFonts14 = new Hashtable()
 

Properties

string Encoding [get]
 
int FontType [get, set]
 
abstract string PostscriptFontName [get, set]
 
abstract string[][] FullFontName [get]
 
abstract string[][] AllNameEntries [get]
 
abstract string[][] FamilyFontName [get]
 
virtual string[] CodePagesSupported [get]
 
int[] Widths [get]
 
string[] Differences [get]
 
char[] UnicodeDifferences [get]
 
bool ForceWidthsOutput [get, set]
 
bool DirectTextToByte [get, set]
 
bool Subset [get, set]
 
int CompressionLevel [get, set]
 

Detailed Description

Summary description for BaseFont.

Constructor & Destructor Documentation

◆ BaseFont()

iTextSharp.text.pdf.BaseFont.BaseFont ( )
protected

Creates new BaseFont

Member Function Documentation

◆ AddSubsetRange()

void iTextSharp.text.pdf.BaseFont.AddSubsetRange ( int[]  range)

Adds a character range when subsetting. The range is an int array where the first element is the start range inclusive and the second element is the end range inclusive. Several ranges are allowed in the same array.

Parameters
rangethe character range

◆ AddToResourceSearch()

static void iTextSharp.text.pdf.BaseFont.AddToResourceSearch ( object  obj)
static

◆ CharExists()

virtual bool iTextSharp.text.pdf.BaseFont.CharExists ( int  c)
virtual

Checks if a character exists in this font.

Parameters
cthe character to check
Returns
true if the character has a glyph, false otherwise

Reimplemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ CorrectArabicAdvance()

void iTextSharp.text.pdf.BaseFont.CorrectArabicAdvance ( )

iText expects Arabic Diactrics (tashkeel) to have zero advance but some fonts, most notably those that come with Windows, like times.ttf, have non-zero advance for those characters. This method makes those character to have zero width advance and work correctly in the iText Arabic shaping and reordering context.

◆ CreateEncoding()

void iTextSharp.text.pdf.BaseFont.CreateEncoding ( )
protected

Creates the widths and the differences arrays

Exceptions
UnsupportedEncodingExceptionthe encoding is not supported

◆ CreateFont() [1/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( )
static

Creates a new font. This will always be the default Helvetica font (not embedded). This method is introduced because Helvetica is used in many examples.

Returns
a BaseFont object (Helvetica, Winansi, not embedded)
Exceptions
IOExceptionThis shouldn't occur ever
DocumentExceptionThis shouldn't occur ever
Since
2.1.1

◆ CreateFont() [2/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( PRIndirectReference  fontRef)
static

Creates a font based on an existing document font. The created font font may not behave as expected, depending on the encoding or subset.

Parameters
fontRefthe reference to the document font
Returns
the font

◆ CreateFont() [3/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( String  name,
String  encoding,
bool  embedded 
)
static

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".

The fonts are cached and if they already exist they are extracted from the cache, not parsed again.

Besides the common encodings described by name, custom encodings can also be made. These encodings will only work for the single byte fonts Type1 and TrueType. The encoding string starts with a '#' followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list of hex values representing the Unicode codes that compose that encoding.
The "simple" encoding is recommended for TrueType fonts as the "full" encoding risks not matching the character with the right glyph if not done with care.
The "full" encoding is specially aimed at Type1 fonts where the glyphs have to be described by non standard names like the Tex math fonts. Each group of three elements compose a code position: the one byte code order in decimal or as 'x' (x cannot be the space), the name and the Unicode character used to access the glyph. The space must be assigned to character position 32 otherwise text justification will not work.

Example for a "simple" encoding that includes the Unicode character space, A, B and ecyrillic:

"# simple 32 0020 0041 0042 0454"

<P<blockquote>

Example for a "full" encoding for a Type1 Tex font:

"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"

<P<blockquote>

This method calls:

createFont(name, encoding, embedded, true, null, null);
Parameters
namethe name of the font or its location on file
encodingthe encoding to be applied to this font
embeddedtrue if the font is to be embedded in the PDF
Returns
returns a new font. This font may come from the cache
Exceptions
DocumentExceptionthe font is invalid
IOExceptionthe font file could not be read

◆ CreateFont() [4/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( String  name,
String  encoding,
bool  embedded,
bool  cached,
byte[]  ttfAfm,
byte[]  pfb 
)
static

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".

The fonts may or may not be cached depending on the flag cached. If the byte arrays are present the font will be read from them instead of the name. A name is still required to identify the font type.

Besides the common encodings described by name, custom encodings can also be made. These encodings will only work for the single byte fonts Type1 and TrueType. The encoding string starts with a '#' followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list of hex values representing the Unicode codes that compose that encoding.
The "simple" encoding is recommended for TrueType fonts as the "full" encoding risks not matching the character with the right glyph if not done with care.
The "full" encoding is specially aimed at Type1 fonts where the glyphs have to be described by non standard names like the Tex math fonts. Each group of three elements compose a code position: the one byte code order in decimal or as 'x' (x cannot be the space), the name and the Unicode character used to access the glyph. The space must be assigned to character position 32 otherwise text justification will not work.

Example for a "simple" encoding that includes the Unicode character space, A, B and ecyrillic:

"# simple 32 0020 0041 0042 0454"

<P<blockquote>

Example for a "full" encoding for a Type1 Tex font:

"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
Parameters
namethe name of the font or its location on file
encodingthe encoding to be applied to this font
embeddedtrue if the font is to be embedded in the PDF
cachedtrue if the font comes from the cache or is added to the cache if new, false if the font is always created new
ttfAfmthe true type font or the afm in a byte array
pfbthe pfb in a byte array
Returns
returns a new font. This font may come from the cache but only if cached is true, otherwise it will always be created new
Exceptions
DocumentExceptionthe font is invalid
IOExceptionthe font file could not be read
Since
iText 0.80

◆ CreateFont() [5/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( String  name,
String  encoding,
bool  embedded,
bool  cached,
byte[]  ttfAfm,
byte[]  pfb,
bool  noThrow 
)
static

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".

The fonts may or may not be cached depending on the flag cached. If the byte arrays are present the font will be read from them instead of the name. A name is still required to identify the font type.

Besides the common encodings described by name, custom encodings can also be made. These encodings will only work for the single byte fonts Type1 and TrueType. The encoding string starts with a '#' followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list of hex values representing the Unicode codes that compose that encoding.
The "simple" encoding is recommended for TrueType fonts as the "full" encoding risks not matching the character with the right glyph if not done with care.
The "full" encoding is specially aimed at Type1 fonts where the glyphs have to be described by non standard names like the Tex math fonts. Each group of three elements compose a code position: the one byte code order in decimal or as 'x' (x cannot be the space), the name and the Unicode character used to access the glyph. The space must be assigned to character position 32 otherwise text justification will not work.

Example for a "simple" encoding that includes the Unicode character space, A, B and ecyrillic:

"# simple 32 0020 0041 0042 0454"

<P<blockquote>

Example for a "full" encoding for a Type1 Tex font:

"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
Parameters
namethe name of the font or its location on file
encodingthe encoding to be applied to this font
embeddedtrue if the font is to be embedded in the PDF
cachedtrue if the font comes from the cache or is added to the cache if new, false if the font is always created new
ttfAfmthe true type font or the afm in a byte array
pfbthe pfb in a byte array
noThrowif true will not throw an exception if the font is not recognized and will return null, if false will throw an exception if the font is not recognized. Note that even if true an exception may be thrown in some circumstances. This parameter is useful for FontFactory that may have to check many invalid font names before finding the right one
Returns
returns a new font. This font may come from the cache but only if cached is true, otherwise it will always be created new
Exceptions
DocumentExceptionthe font is invalid
IOExceptionthe font file could not be read
Since
2.0.3

◆ CreateFont() [6/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( String  name,
String  encoding,
bool  embedded,
bool  cached,
byte[]  ttfAfm,
byte[]  pfb,
bool  noThrow,
bool  forceRead 
)
static

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".

The fonts may or may not be cached depending on the flag cached. If the byte arrays are present the font will be read from them instead of the name. A name is still required to identify the font type.

Besides the common encodings described by name, custom encodings can also be made. These encodings will only work for the single byte fonts Type1 and TrueType. The encoding string starts with a '#' followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list of hex values representing the Unicode codes that compose that encoding.
The "simple" encoding is recommended for TrueType fonts as the "full" encoding risks not matching the character with the right glyph if not done with care.
The "full" encoding is specially aimed at Type1 fonts where the glyphs have to be described by non standard names like the Tex math fonts. Each group of three elements compose a code position: the one byte code order in decimal or as 'x' (x cannot be the space), the name and the Unicode character used to access the glyph. The space must be assigned to character position 32 otherwise text justification will not work.

Example for a "simple" encoding that includes the Unicode character space, A, B and ecyrillic:

"# simple 32 0020 0041 0042 0454"

<P<blockquote>

Example for a "full" encoding for a Type1 Tex font:

"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
Parameters
namethe name of the font or its location on file
encodingthe encoding to be applied to this font
embeddedtrue if the font is to be embedded in the PDF
cachedtrue if the font comes from the cache or is added to the cache if new, false if the font is always created new
ttfAfmthe true type font or the afm in a byte array
pfbthe pfb in a byte array
noThrowif true will not throw an exception if the font is not recognized and will return null, if false will throw an exception if the font is not recognized. Note that even if true an exception may be thrown in some circumstances. This parameter is useful for FontFactory that may have to check many invalid font names before finding the right one
forceReadin some cases (TrueTypeFont, Type1Font), the full font file will be read and kept in memory if forceRead is true
Returns
returns a new font. This font may come from the cache but only if cached is true, otherwise it will always be created new
Exceptions
DocumentExceptionthe font is invalid
IOExceptionthe font file could not be read
Since
2.1.5

◆ CreateFont() [7/7]

static BaseFont iTextSharp.text.pdf.BaseFont.CreateFont ( String  name,
String  encoding,
bool  embedded,
bool  forceRead 
)
static

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".

The fonts are cached and if they already exist they are extracted from the cache, not parsed again.

Besides the common encodings described by name, custom encodings can also be made. These encodings will only work for the single byte fonts Type1 and TrueType. The encoding string starts with a '#' followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list of hex values representing the Unicode codes that compose that encoding.
The "simple" encoding is recommended for TrueType fonts as the "full" encoding risks not matching the character with the right glyph if not done with care.
The "full" encoding is specially aimed at Type1 fonts where the glyphs have to be described by non standard names like the Tex math fonts. Each group of three elements compose a code position: the one byte code order in decimal or as 'x' (x cannot be the space), the name and the Unicode character used to access the glyph. The space must be assigned to character position 32 otherwise text justification will not work.

Example for a "simple" encoding that includes the Unicode character space, A, B and ecyrillic:

"# simple 32 0020 0041 0042 0454"

<P<blockquote>

Example for a "full" encoding for a Type1 Tex font:

"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"

<P<blockquote>

This method calls:

createFont(name, encoding, embedded, true, null, null);
Parameters
namethe name of the font or its location on file
encodingthe encoding to be applied to this font
embeddedtrue if the font is to be embedded in the PDF
forceReadin some cases (TrueTypeFont, Type1Font), the full font file will be read and kept in memory if forceRead is true
Returns
returns a new font. This font may come from the cache
Exceptions
DocumentExceptionthe font is invalid
IOExceptionthe font file could not be read
Since
2.1.5

◆ EnumerateTTCNames() [1/2]

static string [] iTextSharp.text.pdf.BaseFont.EnumerateTTCNames ( byte[]  ttcArray)
static

Enumerates the postscript font names present inside a True Type Collection.

Parameters
ttcArraythe font as a byte array
Exceptions
DocumentExceptionon error
IOExceptionon error
Returns
the postscript font names

◆ EnumerateTTCNames() [2/2]

static string [] iTextSharp.text.pdf.BaseFont.EnumerateTTCNames ( string  ttcFile)
static

Enumerates the postscript font names present inside a True Type Collection.

Parameters
ttcFilethe file name of the font
Exceptions
DocumentExceptionon error
IOExceptionon error
Returns
the postscript font names

◆ GetAllFontNames()

static Object [] iTextSharp.text.pdf.BaseFont.GetAllFontNames ( String  name,
String  encoding,
byte[]  ttfAfm 
)
static

Gets all the names from the font. Only the required tables are read.

Parameters
namethe name of the font
encodingthe encoding of the font
ttfAfmthe true type font or the afm in a byte array
Exceptions
DocumentExceptionon error
IOExceptionon error
Returns
an array of Object[] built with {getPostscriptFontName(), GetFamilyFontName(), GetFullFontName()}

◆ GetAllNameEntries()

static String [][] iTextSharp.text.pdf.BaseFont.GetAllNameEntries ( String  name,
String  encoding,
byte[]  ttfAfm 
)
static

Gets all the entries of the namestable from the font. Only the required tables are read.

Parameters
namethe name of the font
encodingthe encoding of the font
ttfAfmthe true type font or the afm in a byte array
Exceptions
DocumentExceptionon error
IOExceptionon error
Returns
an array of Object[] built with {getPostscriptFontName(), getFamilyFontName(), getFullFontName()}

◆ GetAscent()

int iTextSharp.text.pdf.BaseFont.GetAscent ( String  text)

Gets the ascent of a String in normalized 1000 units. The ascent will always be greater than or equal to zero even if all the characters have a lower ascent.

Parameters
textthe String to get the ascent of
Returns
the ascent in normalized 1000 units

◆ GetAscentPoint()

float iTextSharp.text.pdf.BaseFont.GetAscentPoint ( String  text,
float  fontSize 
)

Gets the ascent of a String in points. The ascent will always be greater than or equal to zero even if all the characters have a lower ascent.

Parameters
textthe String to get the ascent of
fontSizethe size of the font
Returns
the ascent in points

◆ GetBaseName()

static string iTextSharp.text.pdf.BaseFont.GetBaseName ( string  name)
staticprotected

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

Parameters
namethe full name of the font
Returns
the name without the modifiers Bold, Italic or BoldItalic

◆ GetCharBBox()

virtual int [] iTextSharp.text.pdf.BaseFont.GetCharBBox ( int  c)
virtual

Gets the smallest box enclosing the character contours. It will return null if the font has not the information or the character has no contours, as in the case of the space, for example. Characters with no contours may also return [0,0,0,0].

Parameters
cthe character to get the contour bounding box from
Returns
an array of four floats with the bounding box in the format [llx,lly,urx,ury] or null

Reimplemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ GetCidCode()

virtual int iTextSharp.text.pdf.BaseFont.GetCidCode ( int  c)
virtual

Gets the CID code given an Unicode. It has only meaning with CJK fonts.

Parameters
cthe Unicode
Returns
the CID equivalent

◆ GetDescent()

int iTextSharp.text.pdf.BaseFont.GetDescent ( String  text)

Gets the descent of a String in normalized 1000 units. The descent will always be less than or equal to zero even if all the characters have an higher descent.

Parameters
textthe String to get the descent of
Returns
the dexcent in normalized 1000 units

◆ GetDescentPoint()

float iTextSharp.text.pdf.BaseFont.GetDescentPoint ( String  text,
float  fontSize 
)

Gets the descent of a String in points. The descent will always be less than or equal to zero even if all the characters have an higher descent.

Parameters
textthe String to get the descent of
fontSizethe size of the font
Returns
the dexcent in points

◆ GetDocumentFonts() [1/2]

static ArrayList iTextSharp.text.pdf.BaseFont.GetDocumentFonts ( PdfReader  reader)
static

Gets a list of all document fonts. Each element of the ArrayList contains a Object[]{String,PRIndirectReference} with the font name and the indirect reference to it.

Parameters
readerthe document where the fonts are to be listed from
Returns
the list of fonts and references

◆ GetDocumentFonts() [2/2]

static ArrayList iTextSharp.text.pdf.BaseFont.GetDocumentFonts ( PdfReader  reader,
int  page 
)
static

Gets a list of the document fonts in a particular page. Each element of the ArrayList contains a Object[]{String,PRIndirectReference} with the font name and the indirect reference to it.

Parameters
readerthe document where the fonts are to be listed from
pagethe page to list the fonts from
Returns
the list of fonts and references

◆ GetFontDescriptor()

abstract float iTextSharp.text.pdf.BaseFont.GetFontDescriptor ( int  key,
float  fontSize 
)
pure virtual

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

Parameters
keythe parameter to be extracted
fontSizethe font size in points
Returns
the parameter in points

Implemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ GetFullFontName()

static string [][] iTextSharp.text.pdf.BaseFont.GetFullFontName ( string  name,
string  encoding,
byte[]  ttfAfm 
)
static

Gets the full name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"", "", "", font name}.

Parameters
namethe name of the font
encodingthe encoding of the font
ttfAfmthe true type font or the afm in a byte array
Exceptions
DocumentExceptionon error
IOExceptionon error
Returns
the full name of the font

◆ GetFullFontStream()

abstract PdfStream iTextSharp.text.pdf.BaseFont.GetFullFontStream ( )
pure virtual

Returns a PdfStream object with the full font program (if possible). This method will return null for some types of fonts (CJKFont, Type3Font) or if there is no font program available (standard Type 1 fonts).

Returns
a PdfStream with the font program
Since
2.1.3

Implemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ GetKerning()

abstract int iTextSharp.text.pdf.BaseFont.GetKerning ( int  char1,
int  char2 
)
pure virtual

Gets the kerning between two Unicode chars.

Parameters
char1the first char
char2the second char
Returns
the kerning to be applied

Implemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ GetRawCharBBox()

abstract int [] iTextSharp.text.pdf.BaseFont.GetRawCharBBox ( int  c,
String  name 
)
protectedpure virtual

◆ GetResourceStream()

static Stream iTextSharp.text.pdf.BaseFont.GetResourceStream ( string  key)
static

Gets the font resources.

Parameters
keythe name of the resource
Returns
the Stream to get the resource or null if not found

◆ GetUnicodeEquivalent()

virtual int iTextSharp.text.pdf.BaseFont.GetUnicodeEquivalent ( int  c)
virtual

Gets the Unicode equivalent to a CID. The (inexistent) CID <FF00> is translated as '
'. It has only meaning with CJK fonts with Identity encoding.

Parameters
cthe CID code
Returns
the Unicode equivalent

◆ GetWidth() [1/2]

virtual int iTextSharp.text.pdf.BaseFont.GetWidth ( int  char1)
virtual

Gets the width of a char in normalized 1000 units.

Parameters
char1the unicode char to get the width of
Returns
the width in normalized 1000 units

Reimplemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ GetWidth() [2/2]

virtual int iTextSharp.text.pdf.BaseFont.GetWidth ( string  text)
virtual

Gets the width of a string in normalized 1000 units.

Parameters
textthe string to get the witdth of
Returns
the width in normalized 1000 units

◆ GetWidthPoint() [1/2]

float iTextSharp.text.pdf.BaseFont.GetWidthPoint ( int  char1,
float  fontSize 
)

Gets the width of a char in points.

Parameters
char1the char to get the witdth of
fontSizethe font size
Returns
the width in points

◆ GetWidthPoint() [2/2]

float iTextSharp.text.pdf.BaseFont.GetWidthPoint ( string  text,
float  fontSize 
)

Gets the width of a string in points.

Parameters
textthe string to get the witdth of
fontSizethe font size
Returns
the width in points

◆ GetWidthPointKerned()

float iTextSharp.text.pdf.BaseFont.GetWidthPointKerned ( String  text,
float  fontSize 
)

Gets the width of a String in points taking kerning into account.

Parameters
textthe String to get the witdth of
fontSizethe font size
Returns
the width in points

◆ HasKernPairs()

abstract bool iTextSharp.text.pdf.BaseFont.HasKernPairs ( )
pure virtual

Checks if the font has any kerning pairs.

Returns
true if the font has any kerning pairs

Implemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

◆ IsEmbedded()

bool iTextSharp.text.pdf.BaseFont.IsEmbedded ( )

Gets the embedded flag.

Returns
true if the font is embedded.

◆ IsFontSpecific()

bool iTextSharp.text.pdf.BaseFont.IsFontSpecific ( )

Gets the symbolic flag of the font.

Returns
true if the font is symbolic

◆ NormalizeEncoding()

static string iTextSharp.text.pdf.BaseFont.NormalizeEncoding ( string  enc)
staticprotected

Normalize the encoding names. "winansi" is changed to "Cp1252" and "macroman" is changed to "MacRoman".

Parameters
encthe encoding to be normalized
Returns
the normalized encoding

◆ SetCharAdvance()

virtual bool iTextSharp.text.pdf.BaseFont.SetCharAdvance ( int  c,
int  advance 
)
virtual

Sets the character advance.

Parameters
cthe character
advancethe character advance normalized to 1000 units
Returns
true if the advance was set, false otherwise

Reimplemented in iTextSharp.text.pdf.Type3Font.

◆ SetKerning()

abstract bool iTextSharp.text.pdf.BaseFont.SetKerning ( int  char1,
int  char2,
int  kern 
)
pure virtual

Sets the kerning between two Unicode chars.

Parameters
char1the first char
char2the second char
kernthe kerning to apply in normalized 1000 units
Returns
true if the kerning was applied, false otherwise

Implemented in iTextSharp.text.pdf.Type3Font, and iTextSharp.text.pdf.DocumentFont.

Member Data Documentation

◆ ASCENT

const int iTextSharp.text.pdf.BaseFont.ASCENT = 1
static

The maximum height above the baseline reached by glyphs in this font, excluding the height of glyphs for accented characters.

◆ AWT_ASCENT

const int iTextSharp.text.pdf.BaseFont.AWT_ASCENT = 9
static

java.awt.Font property

◆ AWT_DESCENT

const int iTextSharp.text.pdf.BaseFont.AWT_DESCENT = 10
static

java.awt.Font property

◆ AWT_LEADING

const int iTextSharp.text.pdf.BaseFont.AWT_LEADING = 11
static

java.awt.Font property

◆ AWT_MAXADVANCE

const int iTextSharp.text.pdf.BaseFont.AWT_MAXADVANCE = 12
static

java.awt.Font property

◆ BBOXLLX

const int iTextSharp.text.pdf.BaseFont.BBOXLLX = 5
static

The lower left x glyph coordinate.

◆ BBOXLLY

const int iTextSharp.text.pdf.BaseFont.BBOXLLY = 6
static

The lower left y glyph coordinate.

◆ BBOXURX

const int iTextSharp.text.pdf.BaseFont.BBOXURX = 7
static

The upper right x glyph coordinate.

◆ BBOXURY

const int iTextSharp.text.pdf.BaseFont.BBOXURY = 8
static

The upper right y glyph coordinate.

◆ BuiltinFonts14

Hashtable iTextSharp.text.pdf.BaseFont.BuiltinFonts14 = new Hashtable()
staticprotected

list of the 14 built in fonts.

◆ CACHED

const bool iTextSharp.text.pdf.BaseFont.CACHED = true
static

if the font has to be cached

◆ CAPHEIGHT

const int iTextSharp.text.pdf.BaseFont.CAPHEIGHT = 2
static

The y coordinate of the top of flat capital letters, measured from the baseline.

◆ CHAR_RANGE_ARABIC

readonly int [] iTextSharp.text.pdf.BaseFont.CHAR_RANGE_ARABIC = {0, 0x7f, 0x0600, 0x067f, 0x20a0, 0x20cf, 0xfb50, 0xfbff, 0xfe70, 0xfeff}
static

◆ CHAR_RANGE_CYRILLIC

readonly int [] iTextSharp.text.pdf.BaseFont.CHAR_RANGE_CYRILLIC = {0, 0x7f, 0x0400, 0x052f, 0x2000, 0x206f, 0x20a0, 0x20cf}
static

◆ CHAR_RANGE_HEBREW

readonly int [] iTextSharp.text.pdf.BaseFont.CHAR_RANGE_HEBREW = {0, 0x7f, 0x0590, 0x05ff, 0x20a0, 0x20cf, 0xfb1d, 0xfb4f}
static

◆ CHAR_RANGE_LATIN

readonly int [] iTextSharp.text.pdf.BaseFont.CHAR_RANGE_LATIN = {0, 0x17f, 0x2000, 0x206f, 0x20a0, 0x20cf, 0xfb00, 0xfb06}
static

◆ charBBoxes

int [][] iTextSharp.text.pdf.BaseFont.charBBoxes = new int[256][]
protected

◆ CID_NEWLINE

const char iTextSharp.text.pdf.BaseFont.CID_NEWLINE = '\u7fff'
static

The fake CID code that represents a newline.

◆ compressionLevel

int iTextSharp.text.pdf.BaseFont.compressionLevel = PdfStream.DEFAULT_COMPRESSION
protected

The compression level for the font stream.

Since
2.1.3

◆ COURIER

const string iTextSharp.text.pdf.BaseFont.COURIER = "Courier"
static

This is a possible value of a base 14 type 1 font

◆ COURIER_BOLD

const string iTextSharp.text.pdf.BaseFont.COURIER_BOLD = "Courier-Bold"
static

This is a possible value of a base 14 type 1 font

◆ COURIER_BOLDOBLIQUE

const string iTextSharp.text.pdf.BaseFont.COURIER_BOLDOBLIQUE = "Courier-BoldOblique"
static

This is a possible value of a base 14 type 1 font

◆ COURIER_OBLIQUE

const string iTextSharp.text.pdf.BaseFont.COURIER_OBLIQUE = "Courier-Oblique"
static

This is a possible value of a base 14 type 1 font

◆ CP1250

const string iTextSharp.text.pdf.BaseFont.CP1250 = "Cp1250"
static

A possible encoding.

◆ CP1252

const string iTextSharp.text.pdf.BaseFont.CP1252 = "Cp1252"
static

A possible encoding.

◆ CP1257

const string iTextSharp.text.pdf.BaseFont.CP1257 = "Cp1257"
static

A possible encoding.

◆ DESCENT

const int iTextSharp.text.pdf.BaseFont.DESCENT = 3
static

The maximum depth below the baseline reached by glyphs in this font. The value is a negative number.

◆ differences

string [] iTextSharp.text.pdf.BaseFont.differences = new string[256]
protected

encoding names

◆ directTextToByte

bool iTextSharp.text.pdf.BaseFont.directTextToByte = false
protected

Converts char directly to byte by casting.

◆ EMBEDDED

const bool iTextSharp.text.pdf.BaseFont.EMBEDDED = true
static

if the font has to be embedded

◆ embedded

bool iTextSharp.text.pdf.BaseFont.embedded
protected

true if the font is to be embedded in the PDF

◆ encoding

string iTextSharp.text.pdf.BaseFont.encoding
protected

encoding used with this font

◆ fastWinansi

bool iTextSharp.text.pdf.BaseFont.fastWinansi = false
protected

◆ FONT_TYPE_CJK

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_CJK = 2
static

The font is CJK.

◆ FONT_TYPE_DOCUMENT

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_DOCUMENT = 4
static

A font already inside the document.

◆ FONT_TYPE_T1

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_T1 = 0
static

The font is Type 1.

◆ FONT_TYPE_T3

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_T3 = 5
static

A Type3 font.

◆ FONT_TYPE_TT

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_TT = 1
static

The font is True Type with a standard encoding.

◆ FONT_TYPE_TTUNI

const int iTextSharp.text.pdf.BaseFont.FONT_TYPE_TTUNI = 3
static

The font is True Type with a Unicode encoding.

◆ fontCache

Hashtable iTextSharp.text.pdf.BaseFont.fontCache = new Hashtable()
staticprotected

cache for the fonts already used.

◆ fontSpecific

bool iTextSharp.text.pdf.BaseFont.fontSpecific = true
protected

true if the font must use its built in encoding. In that case the encoding is only used to map a char to the position inside the font, not to the expected char name.

◆ forceWidthsOutput

bool iTextSharp.text.pdf.BaseFont.forceWidthsOutput = false
protected

Forces the output of the width array. Only matters for the 14 built-in fonts.

◆ HELVETICA

const string iTextSharp.text.pdf.BaseFont.HELVETICA = "Helvetica"
static

This is a possible value of a base 14 type 1 font

◆ HELVETICA_BOLD

const string iTextSharp.text.pdf.BaseFont.HELVETICA_BOLD = "Helvetica-Bold"
static

This is a possible value of a base 14 type 1 font

◆ HELVETICA_BOLDOBLIQUE

const string iTextSharp.text.pdf.BaseFont.HELVETICA_BOLDOBLIQUE = "Helvetica-BoldOblique"
static

This is a possible value of a base 14 type 1 font

◆ HELVETICA_OBLIQUE

const string iTextSharp.text.pdf.BaseFont.HELVETICA_OBLIQUE = "Helvetica-Oblique"
static

This is a possible value of a base 14 type 1 font

◆ IDENTITY_H

const string iTextSharp.text.pdf.BaseFont.IDENTITY_H = "Identity-H"
static

The Unicode encoding with horizontal writing.

◆ IDENTITY_V

const string iTextSharp.text.pdf.BaseFont.IDENTITY_V = "Identity-V"
static

The Unicode encoding with vertical writing.

◆ ITALICANGLE

const int iTextSharp.text.pdf.BaseFont.ITALICANGLE = 4
static

The angle, expressed in degrees counterclockwise from the vertical, of the dominant vertical strokes of the font. The value is negative for fonts that slope to the right, as almost all italic fonts do.

◆ MACROMAN

const string iTextSharp.text.pdf.BaseFont.MACROMAN = "MacRoman"
static

A possible encoding.

◆ NOT_CACHED

const bool iTextSharp.text.pdf.BaseFont.NOT_CACHED = false
static

if the font doesn't have to be cached

◆ NOT_EMBEDDED

const bool iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED = false
static

if the font doesn't have to be embedded

◆ notdef

const string iTextSharp.text.pdf.BaseFont.notdef = ".notdef"
static

a not defined character in a custom PDF encoding

◆ RESOURCE_PATH

const string iTextSharp.text.pdf.BaseFont.RESOURCE_PATH = "iTextSharp.text.pdf.fonts."
static

The path to the font resources.

◆ specialMap

IntHashtable iTextSharp.text.pdf.BaseFont.specialMap
protected

Custom encodings use this map to key the Unicode character to the single byte code.

◆ STRIKETHROUGH_POSITION

const int iTextSharp.text.pdf.BaseFont.STRIKETHROUGH_POSITION = 15
static

The strikethrough position.

◆ STRIKETHROUGH_THICKNESS

const int iTextSharp.text.pdf.BaseFont.STRIKETHROUGH_THICKNESS = 16
static

The strikethrough thickness.

◆ SUBSCRIPT_OFFSET

const int iTextSharp.text.pdf.BaseFont.SUBSCRIPT_OFFSET = 18
static

The recommended vertical offset from the baseline for subscripts for this font. Usually a negative value.

◆ SUBSCRIPT_SIZE

const int iTextSharp.text.pdf.BaseFont.SUBSCRIPT_SIZE = 17
static

The recommended vertical size for subscripts for this font.

◆ subset

bool iTextSharp.text.pdf.BaseFont.subset = true
protected

Indicates if all the glyphs and widths for that particular encoding should be included in the document.

◆ subsetRanges

ArrayList iTextSharp.text.pdf.BaseFont.subsetRanges
protected

◆ SUPERSCRIPT_OFFSET

const int iTextSharp.text.pdf.BaseFont.SUPERSCRIPT_OFFSET = 20
static

The recommended vertical offset from the baseline for superscripts for this font.

◆ SUPERSCRIPT_SIZE

const int iTextSharp.text.pdf.BaseFont.SUPERSCRIPT_SIZE = 19
static

The recommended vertical size for superscripts for this font.

◆ SYMBOL

const string iTextSharp.text.pdf.BaseFont.SYMBOL = "Symbol"
static

This is a possible value of a base 14 type 1 font

◆ TIMES_BOLD

const string iTextSharp.text.pdf.BaseFont.TIMES_BOLD = "Times-Bold"
static

This is a possible value of a base 14 type 1 font

◆ TIMES_BOLDITALIC

const string iTextSharp.text.pdf.BaseFont.TIMES_BOLDITALIC = "Times-BoldItalic"
static

This is a possible value of a base 14 type 1 font

◆ TIMES_ITALIC

const string iTextSharp.text.pdf.BaseFont.TIMES_ITALIC = "Times-Italic"
static

This is a possible value of a base 14 type 1 font

◆ TIMES_ROMAN

const string iTextSharp.text.pdf.BaseFont.TIMES_ROMAN = "Times-Roman"
static

This is a possible value of a base 14 type 1 font

◆ UNDERLINE_POSITION

const int iTextSharp.text.pdf.BaseFont.UNDERLINE_POSITION = 13
static

The underline position. Usually a negative value.

◆ UNDERLINE_THICKNESS

const int iTextSharp.text.pdf.BaseFont.UNDERLINE_THICKNESS = 14
static

The underline thickness.

◆ unicodeDifferences

char [] iTextSharp.text.pdf.BaseFont.unicodeDifferences = new char[256]
protected

same as differences but with the unicode codes

◆ widths

int [] iTextSharp.text.pdf.BaseFont.widths = new int[256]
protected

table of characters widths for this encoding

◆ WINANSI

const string iTextSharp.text.pdf.BaseFont.WINANSI = "Cp1252"
static

A possible encoding.

◆ ZAPFDINGBATS

const string iTextSharp.text.pdf.BaseFont.ZAPFDINGBATS = "ZapfDingbats"
static

This is a possible value of a base 14 type 1 font

Property Documentation

◆ AllNameEntries

abstract string [][] iTextSharp.text.pdf.BaseFont.AllNameEntries
get

Gets all the entries of the names-table. If it is a True Type font each array element will have {Name ID, Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"4", "", "", "", font name}.

Returns
the full name of the font

◆ CodePagesSupported

virtual string [] iTextSharp.text.pdf.BaseFont.CodePagesSupported
get

Gets the code pages supported by the font. This has only meaning with True Type fonts.

Returns
the code pages supported by the font

◆ CompressionLevel

int iTextSharp.text.pdf.BaseFont.CompressionLevel
getset

Sets the compression level to be used for the font streams.

Parameters
compressionLevela value between 0 (best speed) and 9 (best compression)
Since
2.1.3

◆ Differences

string [] iTextSharp.text.pdf.BaseFont.Differences
get

Gets the array with the names of the characters.

Returns
the array with the names of the characters

◆ DirectTextToByte

bool iTextSharp.text.pdf.BaseFont.DirectTextToByte
getset

Sets the conversion of char directly to byte by casting. This is a low level feature to put the bytes directly in the content stream without passing through string.GetBytes().

Parameters
directTextToByteNew value of property directTextToByte.

◆ Encoding

string iTextSharp.text.pdf.BaseFont.Encoding
get

Gets the encoding used to convert string into byte[].

Returns
the encoding name

◆ FamilyFontName

abstract string [][] iTextSharp.text.pdf.BaseFont.FamilyFontName
get

Gets the family name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"", "", "", font name}.

Returns
the family name of the font

◆ FontType

int iTextSharp.text.pdf.BaseFont.FontType
getset

Gets the font type. The font types can be: FONT_TYPE_T1, FONT_TYPE_TT, FONT_TYPE_CJK and FONT_TYPE_TTUNI.

Returns
the font type

◆ ForceWidthsOutput

bool iTextSharp.text.pdf.BaseFont.ForceWidthsOutput
getset

Set to true to force the generation of the widths array.

Parameters
forceWidthsOutputtrue to force the generation of the widths array

◆ FullFontName

abstract string [][] iTextSharp.text.pdf.BaseFont.FullFontName
get

Gets the full name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"", "", "", font name}.

Returns
the full name of the font

◆ PostscriptFontName

abstract string iTextSharp.text.pdf.BaseFont.PostscriptFontName
getset

Gets the postscript font name.

Returns
the postscript font name

◆ Subset

bool iTextSharp.text.pdf.BaseFont.Subset
getset

Indicates if all the glyphs and widths for that particular encoding should be included in the document. When set to true only the glyphs used will be included in the font. When set to false and addSubsetRange(int[]) was not called the full font will be included otherwise just the characters ranges will be included.

Parameters
subsetnew value of property subset

◆ UnicodeDifferences

char [] iTextSharp.text.pdf.BaseFont.UnicodeDifferences
get

Gets the array with the unicode characters.

Returns
the array with the unicode characters

◆ Widths

int [] iTextSharp.text.pdf.BaseFont.Widths
get

Gets the font width array.

Returns
the font width array

The documentation for this class was generated from the following file: