iText 8.0.5 API
iText.Kernel.Font.PdfType3Font Class Reference

Low-level API class for Type 3 fonts. More...

Inheritance diagram for iText.Kernel.Font.PdfType3Font:
iText.Kernel.Font.PdfSimpleFont< Type3Font >

Public Member Functions

virtual void  SetFontName (String fontName)
  Sets the PostScript name of the font. More...
 
virtual void  SetFontFamily (String fontFamily)
  Sets a preferred font family name. More...
 
virtual void  SetFontWeight (int fontWeight)
  Sets font weight. More...
 
virtual void  SetCapHeight (int capHeight)
  Sets cap height. More...
 
virtual void  SetItalicAngle (int italicAngle)
  Sets the PostScript italic angle. More...
 
virtual void  SetFontStretch (String fontWidth)
  Sets font width in css notation (font-stretch property) More...
 
virtual void  SetPdfFontFlags (int flags)
  Sets Font descriptor flags. More...
 
virtual Type3Glyph  GetType3Glyph (int unicode)
  Returns a Type3Glyph by unicode. More...
 
override bool  IsSubset ()
 
override bool  IsEmbedded ()
 
virtual int  GetNumberOfGlyphs ()
  Gets count of glyphs in Type 3 font. More...
 
virtual Type3Glyph  AddGlyph (char c, int wx, int llx, int lly, int urx, int ury)
  Defines a glyph. More...
 
override Glyph  GetGlyph (int unicode)
 
override bool  ContainsGlyph (int unicode)
 
override void  Flush ()
 
- Public Member Functions inherited from iText.Kernel.Font.PdfSimpleFont< Type3Font >
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)
 
override bool  AppendDecodedCodesToGlyphsList (IList< Glyph > list, PdfString characterCodes)
 
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...
 

Package Functions

override PdfDictionary  GetFontDescriptor (String fontName)
 
override PdfArray  BuildWidthsArray (int firstChar, int lastChar)
 
override void  AddFontStream (PdfDictionary fontDescriptor)
 
virtual PdfDocument  GetDocument ()
 
- Package Functions inherited from iText.Kernel.Font.PdfSimpleFont< Type3Font >
  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...
 
abstract void  AddFontStream (PdfDictionary fontDescriptor)
 
virtual void  SetFontProgram (T fontProgram)
 

Additional Inherited Members

- Package Attributes inherited from iText.Kernel.Font.PdfSimpleFont< Type3Font >
FontEncoding  fontEncoding
 
bool  forceWidthsOutput
  Forces the output of the width array. More...
 
byte[]  usedGlyphs
  The array used with single byte encodings. More...
 
CMapToUnicode  toUnicode
  Currently only exists for the fonts that are parsed from the document. More...
 

Detailed Description

Low-level API class for Type 3 fonts.

Low-level API class for Type 3 fonts.

In Type 3 fonts, glyphs are defined by streams of PDF graphics operators. These streams are associated with character names. A separate encoding entry maps character codes to the appropriate character names for the glyphs.

Note, that this class operates in a special way with glyph space units. In the code when working with fonts, iText expects that 1000 units of glyph-space correspond to 1 unit of text space. For Type3 fonts this is not always the case and depends on FontMatrix. That's why in PdfType3Font the font matrix and all font metrics in glyph space units are "normalized" in such way, that 1 to 1000 relation is preserved. This is done on Type3 font initialization, and is reverted back on font flushing, because the actual content streams of type3 font glyphs are left with original coordinates based on original font matrix. See also ISO-32000-2, 9.2.4 "Glyph positioning and metrics":

"The glyph coordinate system is the space in which an individual character’s glyph is defined. All path coordinates and metrics shall be interpreted in glyph space. For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space; for a Type 3 font, the transformation from glyph space to text space shall be defined by a font matrix specified in an explicit FontMatrix entry in the font."

Note, that because of this when processing Type3 glyphs content streams either process them completely independent from this class or take this normalization into account.

To be able to be wrapped with this iText.Kernel.Pdf.PdfObjectWrapper the iText.Kernel.Pdf.PdfObject must be indirect.

Member Function Documentation

◆ AddGlyph()

virtual Type3Glyph iText.Kernel.Font.PdfType3Font.AddGlyph ( char  c,
int  wx,
int  llx,
int  lly,
int  urx,
int  ury 
)
inlinevirtual

Defines a glyph.

Defines a glyph. If the character was already defined it will return the same content

Parameters
c the character to match this glyph.
wx the advance this character will have
llx the X lower left corner of the glyph bounding box. If the colorize option is true the value is ignored
lly the Y lower left corner of the glyph bounding box. If the colorize option is true the value is ignored
urx the X upper right corner of the glyph bounding box. If the colorize option is true the value is ignored
ury the Y upper right corner of the glyph bounding box. If the colorize option is true the value is ignored
Returns
a content where the glyph can be defined

◆ GetNumberOfGlyphs()

virtual int iText.Kernel.Font.PdfType3Font.GetNumberOfGlyphs ( )
inlinevirtual

Gets count of glyphs in Type 3 font.

Returns
number of glyphs.

◆ GetType3Glyph()

virtual Type3Glyph iText.Kernel.Font.PdfType3Font.GetType3Glyph ( int  unicode )
inlinevirtual

Returns a Type3Glyph by unicode.

Parameters
unicode glyph unicode
Returns

Type3Glyph glyph, or null if this font does not contain glyph for the unicode

◆ SetCapHeight()

virtual void iText.Kernel.Font.PdfType3Font.SetCapHeight ( int  capHeight )
inlinevirtual

Sets cap height.

Parameters
capHeight integer in glyph-space 1000-units

◆ SetFontFamily()

virtual void iText.Kernel.Font.PdfType3Font.SetFontFamily ( String  fontFamily )
inlinevirtual

Sets a preferred font family name.

Parameters
fontFamily a preferred font family name.

◆ SetFontName()

virtual void iText.Kernel.Font.PdfType3Font.SetFontName ( String  fontName )
inlinevirtual

Sets the PostScript name of the font.

Parameters
fontName the PostScript name of the font, shall not be null or empty.

◆ SetFontStretch()

virtual void iText.Kernel.Font.PdfType3Font.SetFontStretch ( String  fontWidth )
inlinevirtual

Sets font width in css notation (font-stretch property)

Parameters
fontWidth

iText.IO.Font.Constants.FontStretches.

◆ SetFontWeight()

virtual void iText.Kernel.Font.PdfType3Font.SetFontWeight ( int  fontWeight )
inlinevirtual

Sets font weight.

Parameters
fontWeight integer form 100 to 900. See iText.IO.Font.Constants.FontWeights.

◆ SetItalicAngle()

virtual void iText.Kernel.Font.PdfType3Font.SetItalicAngle ( int  italicAngle )
inlinevirtual

Sets the PostScript italic angle.

Sets the PostScript italic angle.

Italic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right (forward).

Parameters
italicAngle in counter-clockwise degrees from the vertical

◆ SetPdfFontFlags()

virtual void iText.Kernel.Font.PdfType3Font.SetPdfFontFlags ( int  flags )
inlinevirtual

Sets Font descriptor flags.

Parameters
flags font descriptor flags.
See also
iText.IO.Font.Constants.FontDescriptorFlags