Skip to content

PDFStandardFont

Namespace: O2S.Components.PDF4NET.Graphics

Defines a standard PDF font.

public class PDFStandardFont : PDFFont

Inheritance ObjectPDFFontPDFStandardFont

Constructors

PDFStandardFont()

Initializes a new PDFStandardFont object

public PDFStandardFont()

PDFStandardFont(PDFStandardFontFace, Double)

Initializes a new PDFStandardFont object.

public PDFStandardFont(PDFStandardFontFace fontFace, double size)

Parameters

fontFace PDFStandardFontFace
The font face.

size Double
Font size


PDFStandardFont(PDFStandardFont)

Initializes a new PDFStandardFont object with another font.

public PDFStandardFont(PDFStandardFont font)

Parameters

font PDFStandardFont
Source PDF font.


Properties

Bold

Gets or sets a value indicating whether the font is bold.

public bool Bold { get; set; }

Property Value

Boolean
If true, then the font has a bold appearance.


CharacterSpacing

Gets or sets the character spacing to be used by this font.

public double CharacterSpacing { get; set; }

Property Value

Double
Character spacing in unscaled text units.


CosFont

Gets the COS font dictionary.

public PDFCosDictionary CosFont { get; }

Property Value

PDFCosDictionary


FontFace

Gets or sets the font face.

public PDFStandardFontFace FontFace { get; set; }

Property Value

PDFStandardFontFace
A PDFStandardFont.FontFace that represents the font face.


HorizontalScaling

Gets or sets the text horizontal scaling to be used by this font.

public double HorizontalScaling { get; set; }

Property Value

Double
Percentage of the normal width of the glyphs, with 100 being the normal width.

Remarks

The horizontal scaling property adjusts the width of glyphs by stretching or compressing them in the horizontal direction.


Italic

Gets or sets a value indicating whether the font is italic.

public bool Italic { get; set; }

Property Value

Boolean
If true, then the font has an italic appearance.


Metrics

Gets the font metrics.

public PDFFontMetrics Metrics { get; }

Property Value

PDFFontMetrics
A PDFFontMetrics that represents the metrics of the font.


Size

Gets or sets the font size.

public double Size { get; set; }

Property Value

Double
The font size in PDF points.


Strikethrough

Gets or sets a value indicating whether the font is strikethrough.

public bool Strikethrough { get; set; }

Property Value

Boolean
If true, then the font has a strikethrough appearance.


StrikethroughOffset

Gets or sets the strikethrough offset.

public double StrikethroughOffset { get; set; }

Property Value

Double
Offset from text baseline for drawing the strikethrough.

Remarks

The offset is given in PDF points. 0 means default strikethrough offset.


TextRenderingMode

Gets or sets the text rendering mode.

public PDFTextRenderingMode TextRenderingMode { get; set; }

Property Value

PDFTextRenderingMode
A PDFTextRenderingMode specifying how the text is rendered using this font.


Underline

Gets or sets a value indicating whether the font is underlined.

public bool Underline { get; set; }

Property Value

Boolean
If true, then the font has an underlined appearance.


Methods

GetCharWidth(Char)

Gets the width of the given character when drawn with this font object.

public double GetCharWidth(char charCode)

Parameters

charCode Char
the char to get its width

Returns

Double
This method returns a float value that represents the width, in unscaled glyph units, of the given character.

Remarks

To scale this value to font's current size, divide it by 1000 and multiply it by font size. For example, if font size is 20pt, then the width, in points, of a character for this font is 20 * GetCharWidth( charCode ) / 1000.