iText 8.0.5 API
iText.IO.Font.FontEncoding Class Reference

Public Member Functions

virtual String  GetBaseEncoding ()
 
virtual bool  IsFontSpecific ()
 
virtual bool  AddSymbol (int code, int unicode)
 
virtual int  GetUnicode (int index)
  Gets unicode value for corresponding font's char code. More...
 
virtual int  GetUnicodeDifference (int index)
 
virtual bool  HasDifferences ()
 
virtual String  GetDifference (int index)
 
virtual void  SetDifference (int index, String difference)
  Sets a new value in the differences array. More...
 
virtual byte[]  ConvertToBytes (String text)
  Converts a String to a byte array according to the encoding. More...
 
virtual int  ConvertToByte (int unicode)
  Converts a unicode symbol or font specific code to byte according to the encoding. More...
 
virtual bool  CanEncode (int unicode)
  Check whether a unicode symbol or font specific code can be converted to byte according to the encoding. More...
 
virtual bool  CanDecode (int code)
  Check whether a byte code can be converted to unicode symbol according to the encoding. More...
 
virtual bool  IsBuiltWith (String encoding)
  Checks whether the FontEncoding was built with corresponding encoding. More...
 

Static Public Member Functions

static iText.IO.Font.FontEncoding  CreateFontEncoding (String baseEncoding)
 
static iText.IO.Font.FontEncoding  CreateEmptyFontEncoding ()
 
static iText.IO.Font.FontEncoding  CreateFontSpecificEncoding ()
  This encoding will base on font encoding (FontSpecific encoding in Type 1 terminology) More...
 
static void  FillFontEncoding (iText.IO.Font.FontEncoding encoding)
  Fill FontEncoding object with default data. More...
 

Static Public Attributes

const String  FONT_SPECIFIC = "FontSpecific"
 
const String  NOTDEF = ".notdef"
  A not defined character in a custom PDF encoding. More...
 

Package Functions

virtual void  FillCustomEncoding ()
 
virtual void  FillNamedEncoding ()
 
virtual void  FillStandardEncoding ()
 

Static Package Functions

static String  NormalizeEncoding (String enc)
  Normalize the encoding names. More...
 

Package Attributes

String  baseEncoding
  Base font encoding. More...
 
bool  fontSpecific
  true if the font must use its built in encoding. More...
 
IntHashtable  unicodeToCode
  Mapping map from unicode to simple code according to the encoding. More...
 
int[]  codeToUnicode
 
String[]  differences
  Encoding names. More...
 
IntHashtable  unicodeDifferences
  Encodings unicode differences More...
 

Member Function Documentation

◆ CanDecode()

virtual bool iText.IO.Font.FontEncoding.CanDecode ( int  code )
inlinevirtual

Check whether a byte code can be converted to unicode symbol according to the encoding.

Parameters
code a byte code to be checked.
Returns

true if code could be decoded.

◆ CanEncode()

virtual bool iText.IO.Font.FontEncoding.CanEncode ( int  unicode )
inlinevirtual

Check whether a unicode symbol or font specific code can be converted to byte according to the encoding.

Parameters
unicode a unicode symbol or font specific code to be checked.
Returns

true if ch could be encoded.

◆ ConvertToByte()

virtual int iText.IO.Font.FontEncoding.ConvertToByte ( int  unicode )
inlinevirtual

Converts a unicode symbol or font specific code to byte according to the encoding.

Parameters
unicode a unicode symbol or FontSpecif code to be converted.
Returns
a byte representing the conversion according to the encoding

◆ ConvertToBytes()

virtual byte [] iText.IO.Font.FontEncoding.ConvertToBytes ( String  text )
inlinevirtual

Converts a String to a byte array according to the encoding.

Converts a String to a byte array according to the encoding. String could contain a unicode symbols or font specific codes.

Parameters
text the String to be converted.
Returns
an array of byte representing the conversion according to the encoding

◆ CreateFontSpecificEncoding()

static iText.IO.Font.FontEncoding iText.IO.Font.FontEncoding.CreateFontSpecificEncoding ( )
inlinestatic

This encoding will base on font encoding (FontSpecific encoding in Type 1 terminology)

Returns
created font specific encoding

◆ FillFontEncoding()

static void iText.IO.Font.FontEncoding.FillFontEncoding ( iText.IO.Font.FontEncoding  encoding )
inlinestatic

Fill FontEncoding object with default data.

Parameters
encoding

FontEncoding to fill.

◆ GetUnicode()

virtual int iText.IO.Font.FontEncoding.GetUnicode ( int  index )
inlinevirtual

Gets unicode value for corresponding font's char code.

Parameters
index font's char code
Returns
-1, if the char code unsupported or valid unicode.

◆ IsBuiltWith()

virtual bool iText.IO.Font.FontEncoding.IsBuiltWith ( String  encoding )
inlinevirtual

Checks whether the FontEncoding was built with corresponding encoding.

Parameters
encoding an encoding
Returns
true, if the FontEncoding was built with the encoding. Otherwise false.

◆ NormalizeEncoding()

static String iText.IO.Font.FontEncoding.NormalizeEncoding ( String  enc )
inlinestaticpackage

Normalize the encoding names.

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

Parameters
enc the encoding to be normalized
Returns
the normalized encoding

◆ SetDifference()

virtual void iText.IO.Font.FontEncoding.SetDifference ( int  index,
String  difference 
)
inlinevirtual

Sets a new value in the differences array.

Sets a new value in the differences array. See differences.

Parameters
index position to replace
difference new difference value

Member Data Documentation

◆ baseEncoding

String iText.IO.Font.FontEncoding.baseEncoding
package

Base font encoding.

◆ differences

String [] iText.IO.Font.FontEncoding.differences
package

Encoding names.

◆ fontSpecific

bool iText.IO.Font.FontEncoding.fontSpecific
package

true if the font must use its built in encoding.

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.

◆ NOTDEF

const String iText.IO.Font.FontEncoding.NOTDEF = ".notdef"
static

A not defined character in a custom PDF encoding.

◆ unicodeDifferences

IntHashtable iText.IO.Font.FontEncoding.unicodeDifferences
package

Encodings unicode differences

◆ unicodeToCode

IntHashtable iText.IO.Font.FontEncoding.unicodeToCode
package

Mapping map from unicode to simple code according to the encoding.