iText 8.0.5 API
iText.Kernel.Font.PdfSimpleFont< T > Class Template Referenceabstract
Inheritance diagram for iText.Kernel.Font.PdfSimpleFont< T >:
iText.Kernel.Font.PdfFont iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >

Public Member Functions

override bool  IsBuiltWith (String fontProgram, String encoding)
  Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP. More...
 
override GlyphLine  CreateGlyphLine (String content)
 
override int  AppendGlyphs (String text, int from, int to, IList< Glyph > glyphs)
  Append all supported glyphs and return number of processed chars. More...
 
override int  AppendAnyGlyph (String text, int from, IList< Glyph > glyphs)
  Append any single glyph, even notdef. More...
 
virtual FontEncoding  GetFontEncoding ()
  Get the font encoding. More...
 
virtual CMapToUnicode  GetToUnicode ()
  Get the mapping of character codes to unicode values based on /ToUnicode entry of font dictionary. More...
 
override byte[]  ConvertToBytes (String text)
  Converts the text into bytes to be placed in the document. More...
 
override byte[]  ConvertToBytes (GlyphLine glyphLine)
 
override byte[]  ConvertToBytes (Glyph glyph)
 
override void  WriteText (GlyphLine text, int from, int to, PdfOutputStream stream)
 
override void  WriteText (String text, PdfOutputStream stream)
 
override String  Decode (PdfString content)
 
override GlyphLine  DecodeIntoGlyphLine (PdfString content)
  Decodes sequence of character codes (e.g. from content stream) into a iText.IO.Font.Otf.GlyphLine More...
 
override bool  AppendDecodedCodesToGlyphsList (IList< Glyph > list, PdfString characterCodes)
  Decodes sequence of character codes (e.g. from content stream) to sequence of glyphs and appends them to the passed list. More...
 
override float  GetContentWidth (PdfString content)
 
virtual bool  IsForceWidthsOutput ()
  Gets the state of the property. More...
 
virtual void  SetForceWidthsOutput (bool forceWidthsOutput)
  Set to true to force the generation of the widths array. More...
 
- Public Member Functions inherited from iText.Kernel.Font.PdfFont
abstract Glyph  GetGlyph (int unicode)
  Get glyph by unicode More...
 
virtual bool  ContainsGlyph (int unicode)
  Check whether font contains glyph with specified unicode. More...
 
virtual int  GetWidth (int unicode)
  Returns the width of a certain character of this font in 1000 normalized units. More...
 
virtual float  GetWidth (int unicode, float fontSize)
  Returns the width of a certain character of this font in points. More...
 
virtual int  GetWidth (String text)
  Returns the width of a string of this font in 1000 normalized units. More...
 
virtual float  GetWidth (String text, float fontSize)
  Gets the width of a String in points. More...
 
virtual float  GetDescent (String text, float fontSize)
  Gets the descent of a String in points. More...
 
virtual float  GetDescent (int unicode, float fontSize)
  Gets the descent of a char code in points. More...
 
virtual float  GetAscent (String text, float fontSize)
  Gets the ascent of a String in points. More...
 
virtual float  GetAscent (int unicode, float fontSize)
  Gets the ascent of a char code in normalized 1000 units. More...
 
virtual FontProgram  GetFontProgram ()
 
virtual bool  IsEmbedded ()
 
virtual bool  IsSubset ()
  Indicates if all the glyphs and widths for that particular encoding should be included in the document. More...
 
virtual void  SetSubset (bool subset)
  Indicates if all the glyphs and widths for that particular encoding should be included in the document. More...
 
virtual void  AddSubsetRange (int[] range)
  Adds a character range when subsetting. More...
 
virtual IList< String >  SplitString (String text, float fontSize, float maxWidth)
 
override void  Flush ()
  To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. More...
 
override String  ToString ()
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
virtual T  GetPdfObject ()
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  SetModified ()
 
virtual bool  IsFlushed ()
 

Package Functions

  PdfSimpleFont (PdfDictionary fontDictionary)
 
virtual void  FlushFontData (String fontName, PdfName subtype)
 
virtual bool  IsBuiltInFont ()
  Indicates that the font is built in, i.e. it is one of the 14 Standard fonts More...
 
override PdfDictionary  GetFontDescriptor (String fontName)
  Generates the font descriptor for this font or null if it is one of the 14 built in fonts. More...
 
virtual PdfArray  BuildWidthsArray (int firstChar, int lastChar)
 
abstract void  AddFontStream (PdfDictionary fontDescriptor)
 
virtual void  SetFontProgram (T fontProgram)
 
- Package Functions inherited from iText.Kernel.Font.PdfFont
  PdfFont (PdfDictionary fontDictionary)
 
override bool  IsWrappedObjectMustBeIndirect ()
  Defines if the object behind this wrapper must be an indirect object in the resultant document. More...
 
virtual PdfStream  GetPdfFontStream (byte[] fontStreamBytes, int[] fontStreamLengths)
  Create PdfStream based on fontStreamBytes . More...
 
- Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
  PdfObjectWrapper (T pdfObject)
 
virtual void  SetPdfObject (T pdfObject)
 
virtual void  SetForbidRelease ()
 
virtual void  UnsetForbidRelease ()
 
virtual void  EnsureUnderlyingObjectHasIndirectReference ()
 

Package Attributes

FontEncoding  fontEncoding
 
bool  forceWidthsOutput = false
  Forces the output of the width array. More...
 
byte[]  usedGlyphs = new byte[PdfFont.SIMPLE_FONT_MAX_CHAR_CODE_VALUE + 1]
  The array used with single byte encodings. More...
 
CMapToUnicode  toUnicode
  Currently only exists for the fonts that are parsed from the document. More...
 
- Package Attributes inherited from iText.Kernel.Font.PdfFont
FontProgram  fontProgram
 
IDictionary< int, Glyph notdefGlyphs = new DictionaryGlyph>()
 
bool  newFont = true
  false, if the font comes from PdfDocument. More...
 
bool  embedded = false
  true if the font is to be embedded in the PDF. More...
 
bool  subset = true
  Indicates if all the glyphs and widths for that particular encoding should be included in the document. More...
 
IList< int[]>  subsetRanges
 

Additional Inherited Members

- Static Public Attributes inherited from iText.Kernel.Font.PdfFont
const int  SIMPLE_FONT_MAX_CHAR_CODE_VALUE = 255
  The upper bound value for char code. More...
 
- Static Package Functions inherited from iText.Kernel.Font.PdfFont
static String  UpdateSubsetPrefix (String fontName, bool isSubset, bool isEmbedded)
  Adds a unique subset prefix to be added to the font name when the font is embedded and subsetted. More...
 
- Static Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
static void  MarkObjectAsIndirect (PdfObject pdfObject)
 
static void  EnsureObjectIsAddedToDocument (PdfObject @object)
  Some wrappers use object's indirect reference to obtain the PdfDocument to which the object belongs to. More...
 
- Static Package Attributes inherited from iText.Kernel.Font.PdfFont
static readonly byte[]  EMPTY_BYTES = new byte[0]
 

Member Function Documentation

◆ AppendAnyGlyph()

override int iText.Kernel.Font.PdfSimpleFont< T >.AppendAnyGlyph ( String  text,
int  from,
IList< Glyph glyphs 
)
inlinevirtual

Append any single glyph, even notdef.

Append any single glyph, even notdef. Returns number of processed chars: 2 in case surrogate pair, otherwise 1.

Parameters
text String to convert to glyphs.
from from index of the text.
glyphs array for a new glyph, shall not be null.
Returns
number of processed chars: 2 in case surrogate pair, otherwise 1

Implements iText.Kernel.Font.PdfFont.

◆ AppendDecodedCodesToGlyphsList()

override bool iText.Kernel.Font.PdfSimpleFont< T >.AppendDecodedCodesToGlyphsList ( IList< Glyph list,
PdfString  characterCodes 
)
inlinevirtual

Decodes sequence of character codes (e.g. from content stream) to sequence of glyphs and appends them to the passed list.

Reimplemented from iText.Kernel.Font.PdfFont.

◆ AppendGlyphs()

override int iText.Kernel.Font.PdfSimpleFont< T >.AppendGlyphs ( String  text,
int  from,
int  to,
IList< Glyph glyphs 
)
inlinevirtual

Append all supported glyphs and return number of processed chars.

Append all supported glyphs and return number of processed chars. Composite font supports surrogate pairs.

Parameters
text String to convert to glyphs.
from from index of the text.
to to index of the text.
glyphs array for a new glyphs, shall not be null.
Returns
number of processed chars from text.

Implements iText.Kernel.Font.PdfFont.

◆ ConvertToBytes()

override byte [] iText.Kernel.Font.PdfSimpleFont< T >.ConvertToBytes ( String  text )
inlinevirtual

Converts the text into bytes to be placed in the document.

Converts the text into bytes to be placed in the document. The conversion is done according to the font and the encoding and the characters used are stored.

Parameters
text the text to convert
Returns
the conversion

Implements iText.Kernel.Font.PdfFont.

◆ DecodeIntoGlyphLine()

override GlyphLine iText.Kernel.Font.PdfSimpleFont< T >.DecodeIntoGlyphLine ( PdfString  content )
inlinevirtual

Decodes sequence of character codes (e.g. from content stream) into a iText.IO.Font.Otf.GlyphLine

Implements iText.Kernel.Font.PdfFont.

◆ GetFontDescriptor()

override PdfDictionary iText.Kernel.Font.PdfSimpleFont< T >.GetFontDescriptor ( String  fontName )
inlinepackagevirtual

Generates the font descriptor for this font or null if it is one of the 14 built in fonts.

Returns
the PdfDictionary containing the font descriptor or null.

Implements iText.Kernel.Font.PdfFont.

◆ GetFontEncoding()

virtual FontEncoding iText.Kernel.Font.PdfSimpleFont< T >.GetFontEncoding ( )
inlinevirtual

Get the font encoding.

Returns
the iText.IO.Font.FontEncoding

◆ GetToUnicode()

virtual CMapToUnicode iText.Kernel.Font.PdfSimpleFont< T >.GetToUnicode ( )
inlinevirtual

Get the mapping of character codes to unicode values based on /ToUnicode entry of font dictionary.

Returns
the iText.IO.Font.Cmap.CMapToUnicode built based on /ToUnicode, or null if /ToUnicode is not available

◆ IsBuiltInFont()

virtual bool iText.Kernel.Font.PdfSimpleFont< T >.IsBuiltInFont ( )
inlinepackagevirtual

Indicates that the font is built in, i.e. it is one of the 14 Standard fonts

Returns

true in case the font is a Standard font and false otherwise

Reimplemented in iText.Kernel.Font.PdfTrueTypeFont, and iText.Kernel.Font.PdfType1Font.

◆ IsBuiltWith()

override bool iText.Kernel.Font.PdfSimpleFont< T >.IsBuiltWith ( String  fontProgram,
String  encoding 
)
inlinevirtual

Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP.

Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP. Default value is false unless overridden.

Parameters
fontProgram a font name or path to a font program
encoding an encoding or CMAP
Returns
true, if the PdfFont was built with the fontProgram and encoding. Otherwise false.
See also
iText.Kernel.Pdf.PdfDocument.FindFont(System.String, System.String), iText.IO.Font.FontProgram.IsBuiltWith(System.String), iText.IO.Font.FontEncoding.IsBuiltWith(System.String), iText.IO.Font.CMapEncoding.IsBuiltWith(System.String)

Reimplemented from iText.Kernel.Font.PdfFont.

◆ IsForceWidthsOutput()

virtual bool iText.Kernel.Font.PdfSimpleFont< T >.IsForceWidthsOutput ( )
inlinevirtual

Gets the state of the property.

Returns
value of property forceWidthsOutput

◆ SetForceWidthsOutput()

virtual void iText.Kernel.Font.PdfSimpleFont< T >.SetForceWidthsOutput ( bool  forceWidthsOutput )
inlinevirtual

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

Parameters
forceWidthsOutput

true to force the generation of the widths array

Member Data Documentation

◆ forceWidthsOutput

bool iText.Kernel.Font.PdfSimpleFont< T >.forceWidthsOutput = false
package

Forces the output of the width array.

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

◆ toUnicode

Currently only exists for the fonts that are parsed from the document.

Currently only exists for the fonts that are parsed from the document. In the future, we might provide possibility to add custom mappings after a font has been created from a font file.

◆ usedGlyphs

byte [] iText.Kernel.Font.PdfSimpleFont< T >.usedGlyphs = new byte[PdfFont.SIMPLE_FONT_MAX_CHAR_CODE_VALUE + 1]
package

The array used with single byte encodings.