Table of Contents

Class PdfType3Font

Namespace
iText.Kernel.Font
Assembly
itext.kernel.dll

Low-level API class for Type 3 fonts.

public class PdfType3Font : PdfSimpleFont<Type3Font>
Inheritance
PdfType3Font
Inherited Members

Remarks

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 PdfObjectWrapper<T> the PdfObject must be indirect.

Methods

AddFontStream(PdfDictionary)

protected override void AddFontStream(PdfDictionary fontDescriptor)

Parameters

fontDescriptor PdfDictionary

AddGlyph(char, int, int, int, int, int)

Defines a glyph.

public virtual Type3Glyph AddGlyph(char c, int wx, int llx, int lly, int urx, int ury)

Parameters

c char

the character to match this glyph.

wx int

the advance this character will have

llx int

the X lower left corner of the glyph bounding box. If the colorize option is true the value is ignored

lly int

the Y lower left corner of the glyph bounding box. If the colorize option is true the value is ignored

urx int

the X upper right corner of the glyph bounding box. If the colorize option is true the value is ignored

ury int

the Y upper right corner of the glyph bounding box. If the colorize option is true the value is ignored

Returns

Type3Glyph

a content where the glyph can be defined

Remarks

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

BuildWidthsArray(int, int)

protected override PdfArray BuildWidthsArray(int firstChar, int lastChar)

Parameters

firstChar int
lastChar int

Returns

PdfArray

ContainsGlyph(int)

public override bool ContainsGlyph(int unicode)

Parameters

unicode int

Returns

bool

Flush()

public override void Flush()

GetDocument()

protected virtual PdfDocument GetDocument()

Returns

PdfDocument

GetFontDescriptor(string)

protected override PdfDictionary GetFontDescriptor(string fontName)

Parameters

fontName string

Returns

PdfDictionary

GetGlyph(int)

public override Glyph GetGlyph(int unicode)

Parameters

unicode int

Returns

Glyph

GetNumberOfGlyphs()

Gets count of glyphs in Type 3 font.

public virtual int GetNumberOfGlyphs()

Returns

int

number of glyphs.

GetType3Glyph(int)

Returns a Type3Glyph by unicode.

public virtual Type3Glyph GetType3Glyph(int unicode)

Parameters

unicode int

glyph unicode

Returns

Type3Glyph

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

IsEmbedded()

public override bool IsEmbedded()

Returns

bool

IsSubset()

public override bool IsSubset()

Returns

bool

SetCapHeight(int)

Sets cap height.

public virtual void SetCapHeight(int capHeight)

Parameters

capHeight int

integer in glyph-space 1000-units

SetFontFamily(string)

Sets a preferred font family name.

public virtual void SetFontFamily(string fontFamily)

Parameters

fontFamily string

a preferred font family name.

SetFontName(string)

Sets the PostScript name of the font.

public virtual void SetFontName(string fontName)

Parameters

fontName string

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

SetFontStretch(string)

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

public virtual void SetFontStretch(string fontWidth)

Parameters

fontWidth string

FontStretches.

SetFontWeight(int)

Sets font weight.

public virtual void SetFontWeight(int fontWeight)

Parameters

fontWeight int

integer form 100 to 900. See FontWeights.

SetItalicAngle(int)

Sets the PostScript italic angle.

public virtual void SetItalicAngle(int italicAngle)

Parameters

italicAngle int

in counter-clockwise degrees from the vertical

Remarks

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

SetPdfFontFlags(int)

Sets Font descriptor flags.

public virtual void SetPdfFontFlags(int flags)

Parameters

flags int

font descriptor flags.

See Also