iText 7 7.1.9 API
iText.Kernel.Font.PdfFont Class Referenceabstract
Inheritance diagram for iText.Kernel.Font.PdfFont:
iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary > iText.Kernel.Font.PdfSimpleFont< T > iText.Kernel.Font.PdfType0Font

Public Member Functions

abstract Glyph  GetGlyph (int unicode)
  Get glyph by unicode More...
 
virtual bool  ContainsGlyph (int unicode)
  Check whether font contains glyph with specified unicode. More...
 
abstract GlyphLine  CreateGlyphLine (String content)
 
abstract int  AppendGlyphs (String text, int from, int to, IList< Glyph > glyphs)
  Append all supported glyphs and return number of processed chars. More...
 
abstract int  AppendAnyGlyph (String text, int from, IList< Glyph > glyphs)
  Append any single glyph, even notdef. More...
 
abstract byte[]  ConvertToBytes (String text)
  Converts the text into bytes to be placed in the document. More...
 
abstract byte[]  ConvertToBytes (GlyphLine glyphLine)
 
abstract String  Decode (PdfString content)
 
abstract GlyphLine  DecodeIntoGlyphLine (PdfString content)
  Decodes a given iText.Kernel.Pdf.PdfString containing encoded string (e.g. from content stream) into a iText.IO.Font.Otf.GlyphLine More...
 
abstract float  GetContentWidth (PdfString content)
 
abstract byte[]  ConvertToBytes (Glyph glyph)
 
abstract void  WriteText (GlyphLine text, int from, int to, PdfOutputStream stream)
 
abstract void  WriteText (String text, PdfOutputStream stream)
 
virtual double[]  GetFontMatrix ()
 
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 int  GetDescent (String text, float fontSize)
  Gets the descent of a String in points. More...
 
virtual int  GetDescent (int unicode, float fontSize)
  Gets the descent of a char code in points. More...
 
virtual int  GetAscent (String text, float fontSize)
  Gets the ascent of a String in points. More...
 
virtual int  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)
 
virtual bool  IsBuiltWith (String fontProgram, String encoding)
  Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP. More...
 
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 ()
 

Member Function Documentation

◆ AddSubsetRange()

virtual void iText.Kernel.Font.PdfFont.AddSubsetRange ( int[]  range )
inlinevirtual

Adds a character range when subsetting.

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. Note, #setSubset(true) will be called implicitly therefore this range is an addition to the used glyphs.

Parameters
range the character range

◆ AppendAnyGlyph()

abstract int iText.Kernel.Font.PdfFont.AppendAnyGlyph ( String  text,
int  from,
IList< Glyph glyphs 
)
pure virtual

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

Implemented in iText.Kernel.Font.PdfType0Font, and iText.Kernel.Font.PdfSimpleFont< T >.

◆ AppendGlyphs()

abstract int iText.Kernel.Font.PdfFont.AppendGlyphs ( String  text,
int  from,
int  to,
IList< Glyph glyphs 
)
pure virtual

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.

Implemented in iText.Kernel.Font.PdfType0Font, and iText.Kernel.Font.PdfSimpleFont< T >.

◆ ContainsGlyph()

virtual bool iText.Kernel.Font.PdfFont.ContainsGlyph ( int  unicode )
inlinevirtual

Check whether font contains glyph with specified unicode.

Parameters
unicode a unicode code point
Returns
true if font contains glyph, represented with the unicode code point, otherwise false.

Reimplemented in iText.Kernel.Font.PdfType0Font.

◆ ConvertToBytes()

abstract byte [] iText.Kernel.Font.PdfFont.ConvertToBytes ( String  text )
pure virtual

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

Implemented in iText.Kernel.Font.PdfType0Font, and iText.Kernel.Font.PdfSimpleFont< T >.

◆ DecodeIntoGlyphLine()

abstract GlyphLine iText.Kernel.Font.PdfFont.DecodeIntoGlyphLine ( PdfString  content )
pure virtual

Decodes a given iText.Kernel.Pdf.PdfString containing encoded string (e.g. from content stream) into a iText.IO.Font.Otf.GlyphLine

Parameters
content the encoded string
Returns
the iText.IO.Font.Otf.GlyphLine containing the glyphs encoded by the passed string

Implemented in iText.Kernel.Font.PdfType0Font, and iText.Kernel.Font.PdfSimpleFont< T >.

◆ Flush()

override void iText.Kernel.Font.PdfFont.Flush ( )
inlinevirtual

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.

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. Basically this means that before flushing you need to explicitly call iText.Kernel.Pdf.PdfObjectWrapper<T>.MakeIndirect(iText.Kernel.Pdf.PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.

Reimplemented from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.

Reimplemented in iText.Kernel.Font.PdfType0Font.

◆ GetAscent() [1/2]

virtual int iText.Kernel.Font.PdfFont.GetAscent ( int  unicode,
float  fontSize 
)
inlinevirtual

Gets the ascent of a char code in normalized 1000 units.

Gets the ascent of a char code 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
unicode the char code to get the ascent of
fontSize the font size
Returns
the ascent in points

◆ GetAscent() [2/2]

virtual int iText.Kernel.Font.PdfFont.GetAscent ( String  text,
float  fontSize 
)
inlinevirtual

Gets the ascent of a String in points.

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
text the String to get the ascent of
fontSize the font size
Returns
the ascent in points

◆ GetDescent() [1/2]

virtual int iText.Kernel.Font.PdfFont.GetDescent ( int  unicode,
float  fontSize 
)
inlinevirtual

Gets the descent of a char code in points.

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

Parameters
unicode the char code to get the descent of
fontSize the font size
Returns
the descent in points

◆ GetDescent() [2/2]

virtual int iText.Kernel.Font.PdfFont.GetDescent ( String  text,
float  fontSize 
)
inlinevirtual

Gets the descent of a String in points.

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
text the String to get the descent of
fontSize the font size
Returns
the descent in points

◆ GetGlyph()

abstract Glyph iText.Kernel.Font.PdfFont.GetGlyph ( int  unicode )
pure virtual

Get glyph by unicode

Parameters
unicode a unicode code point
Returns

iText.IO.Font.Otf.Glyph if it exists or .NOTDEF if supported, otherwise null.

Implemented in iText.Kernel.Font.PdfType0Font.

◆ GetWidth() [1/4]

virtual int iText.Kernel.Font.PdfFont.GetWidth ( int  unicode )
inlinevirtual

Returns the width of a certain character of this font in 1000 normalized units.

Parameters
unicode a certain character.
Returns
a width in Text Space.

◆ GetWidth() [2/4]

virtual float iText.Kernel.Font.PdfFont.GetWidth ( int  unicode,
float  fontSize 
)
inlinevirtual

Returns the width of a certain character of this font in points.

Parameters
unicode a certain character.
fontSize the font size.
Returns
a width in points.

◆ GetWidth() [3/4]

virtual int iText.Kernel.Font.PdfFont.GetWidth ( String  text )
inlinevirtual

Returns the width of a string of this font in 1000 normalized units.

Parameters
text a string content.
Returns
a width of string in Text Space.

◆ GetWidth() [4/4]

virtual float iText.Kernel.Font.PdfFont.GetWidth ( String  text,
float  fontSize 
)
inlinevirtual

Gets the width of a String in points.

Parameters
text the String to get the width of
fontSize the font size
Returns
the width in points

◆ IsBuiltWith()

virtual bool iText.Kernel.Font.PdfFont.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 in iText.Kernel.Font.PdfType0Font, and iText.Kernel.Font.PdfSimpleFont< T >.

◆ IsSubset()

virtual bool iText.Kernel.Font.PdfFont.IsSubset ( )
inlinevirtual

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

Returns
false to include all the glyphs and widths.

◆ SetSubset()

virtual void iText.Kernel.Font.PdfFont.SetSubset ( bool  subset )
inlinevirtual

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

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 the full font will be included and all subset ranges will be removed.

Parameters
subset new value of property subset
See also
AddSubsetRange(int[])