PdfFont class
Namespace: PdfNetStack.Fonts
Assembly: PdfNetStack.dll
Package: PdfNetStack
A font for drawing text. Font size is given when drawing, so one instance serves every size. Vertical metrics are fractions of the font size: multiply by the size in points to get points.
public abstract class PdfFontInheritance
Derived
PdfOpenTypeFont, PdfStandardFont
Remarks
Section titled “Remarks”Use PdfStandardFont for the 14 fonts every PDF viewer has. A font is written into a document the first time text is drawn with it, once per document, and is safe to share between documents and threads.
Properties
Section titled “Properties”Ascent
Section titled “ Ascent”Height above the baseline used for line spacing.
public double Ascent { get; }Property Value
Section titled “Property Value”CapHeight
Section titled “ CapHeight”Height of flat capital letters such as H.
public double CapHeight { get; }Property Value
Section titled “Property Value”Descent
Section titled “ Descent”Depth below the baseline used for line spacing, as a positive number.
public double Descent { get; }Property Value
Section titled “Property Value”FamilyName
Section titled “ FamilyName”Family name, such as “Helvetica”.
public abstract string FamilyName { get; }Property Value
Section titled “Property Value”IsBold
Section titled “ IsBold”True for bold and heavier weights.
public abstract bool IsBold { get; }Property Value
Section titled “Property Value”IsItalic
Section titled “ IsItalic”True for italic and oblique styles.
public abstract bool IsItalic { get; }Property Value
Section titled “Property Value”ItalicAngle
Section titled “ ItalicAngle”Slant in degrees, counterclockwise from vertical; negative for fonts leaning right.
public double ItalicAngle { get; }Property Value
Section titled “Property Value”LineGap
Section titled “ LineGap”Extra space the font designer recommends between lines.
public double LineGap { get; }Property Value
Section titled “Property Value”PostScript name, as written to /BaseFont.
public abstract string Name { get; }Property Value
Section titled “Property Value”StrikeoutPosition
Section titled “ StrikeoutPosition”Height of the middle of a strikethrough line above the baseline.
public double StrikeoutPosition { get; }Property Value
Section titled “Property Value”StrikeoutThickness
Section titled “ StrikeoutThickness”Strikethrough stroke thickness.
public double StrikeoutThickness { get; }Property Value
Section titled “Property Value”UnderlinePosition
Section titled “ UnderlinePosition”Distance from the baseline down to the middle of an underline.
public double UnderlinePosition { get; }Property Value
Section titled “Property Value”UnderlineThickness
Section titled “ UnderlineThickness”Underline stroke thickness.
public double UnderlineThickness { get; }Property Value
Section titled “Property Value”XHeight
Section titled “ XHeight”Height of flat lowercase letters such as x.
public double XHeight { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”CanRender(string)
Section titled “ CanRender(string)”True when every character of text can be drawn: the font has a glyph for
it (directly, or for OpenType fonts after Unicode normalization: decomposed, composed with
the marks before it, or a space drawn with the font’s space), or it is an invisible control
or format character, which drawing skips.
public bool CanRender(string text)Parameters
Section titled “Parameters”text string
Returns
Section titled “Returns”GetLineHeight(double)
Section titled “ GetLineHeight(double)”Default line height for size: ascent, descent and line gap, in points.
public double GetLineHeight(double size)Parameters
Section titled “Parameters”size double
Returns
Section titled “Returns”HasGlyph(int)
Section titled “ HasGlyph(int)”True when the font has a glyph for the Unicode code point.
public bool HasGlyph(int codePoint)Parameters
Section titled “Parameters”codePoint int
Returns
Section titled “Returns”MeasureString(string, double)
Section titled “ MeasureString(string, double)”Width of text drawn on one line at size, in points.
public double MeasureString(string text, double size)Parameters
Section titled “Parameters”text string
size double
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The font has no glyph for a character of the text.
ToString()
Section titled “ ToString()”Returns a string that represents the current object.
public override string ToString()Returns
Section titled “Returns”A string that represents the current object.