[Serializable] public sealed class Font : ISerializable
Defines a format for text.

Constructors

Font

#Since v6.0
public Font(string familyName, FontWeight weight, FontStyle style, bool underlined, bool strikethrough)
familyName (string)
weight (Font.FontWeight)
style (Font.FontStyle)
underlined (bool)
strikethrough (bool)

Font

#Since v8.0
public Font(string familyName, FontWeight weight, FontStyle style, FontStretch stretch, bool underlined, bool strikethrough)
familyName (string)
weight (Font.FontWeight)
style (Font.FontStyle)
stretch (Font.FontStretch)
underlined (bool)
strikethrough (bool)

Font

#Since v6.0
public Font(string familyName)
familyName (string)

Properties

AscentOfCapital

#Since v9.0
public int AscentOfCapital { get; }
The font's typographic capital height, in the design units reported by UnitsPerEm. This is the metric a "text height" is measured against, so text of height h renders its capitals h tall. Zero when the font has no usable metrics.

Bold

#Since v5.0
public bool Bold { get; }

Description

#Since v6.5
public string Description { get; }
Returns a long description that includes family, face, weight, stretch and style information. Generally not useful for finding matching fonts.

EnglishFaceName

#Since v6.9
public string EnglishFaceName { get; }
Returns English Face name

EnglishFamilyName

#Since v6.9
public string EnglishFamilyName { get; }

EnglishQuartetName

#Since v6.12
public string EnglishQuartetName { get; }

FaceName

#Since v5.0
public string FaceName { get; }
Returns Face name

FamilyName

#Since v6.5
public string FamilyName { get; }

FamilyPlusFaceName

#Since v6.9
public string FamilyPlusFaceName { get; }
Returns concatenated Family and Face names

IsEngravingFont

#Since v6.10
public bool IsEngravingFont { get; }

IsGeometricToleranceFont

#Since v9.0
public bool IsGeometricToleranceFont { get; }

IsInstalled

#Since v8.7
public bool IsInstalled { get; }
Is this font installed on the system

IsSimulated

#Since v6.5
public bool IsSimulated { get; }

IsSingleStrokeFont

#Since v6.5
public bool IsSingleStrokeFont { get; }

IsSymbolFont

#Since v6.5
public bool IsSymbolFont { get; }

Italic

#Since v5.0
public bool Italic { get; }

LogfontName

#Since v6.5
public string LogfontName { get; }
Returns Windows LOGFONT Face name

PointSize

#Since v6.0
public double PointSize { get; }

PostScriptName

#Since v6.5
public string PostScriptName { get; }
Returns the Font PostScriptName - "Apple font name"

QuartetName

#Since v6.7
public string QuartetName { get; }

RichTextFontName

#Since v6.5
public string RichTextFontName { get; }
Returns the Font RichTextFontName used in RTF strings: {\\fonttbl...{\\fN RichTextFontName;}...}

Stretch

#Since v8.0
public Font.FontStretch Stretch { get; }

Strikeout

#Since v6.0
public bool Strikeout { get; }

Style

#Since v6.0
public Font.FontStyle Style { get; }

Underlined

#Since v6.0
public bool Underlined { get; }

UnitsPerEm

#Since v9.0
public int UnitsPerEm { get; }
The number of design units per em in this font's normalized metrics. Together with AscentOfCapital this converts between an em size - the "font size" used by CSS, SVG, PDF and most page layout - and the height of a capital letter, which is what Rhino means by a text height. Zero when the font has no usable metrics.

Weight

#Since v6.0
public Font.FontWeight Weight { get; }

Methods

AvailableFontFaceNames

#Since v5.0
public static string[] AvailableFontFaceNames()

FromQuartetProperties

#Since v6.7
public static Font FromQuartetProperties(string quartetName, bool bold, bool italic)
quartetName (string)
bold (bool)
italic (bool)

FromRichTextProperties

#Since v8.35
public static Font FromRichTextProperties(string richTextFontName, bool bold, bool italic, bool underlined, bool strikethrough)
Returns a font with the requested rich-text (family) name, preserving that name even when the font is not installed on the current machine. If an installed font matches it is returned; otherwise a "not on device" managed font that keeps the requested name is returned (rendered with a fallback quartet). Use this to author a font by name on a machine that does not have it installed: the Font constructor and FromQuartetProperties(string, bool, bool) both substitute the family in that case, losing the requested name when the file is written.
richTextFontName (string)The rich-text font (family) name to store.
bold (bool)True to select the heavier member of the rich-text quartet.
italic (bool)True to select the more slanted member of the rich-text quartet.
underlined (bool)True for underlined text.
strikethrough (bool)True for strikethrough text.
A font that preserves the requested name, or null if none could be created.

GetObjectData

#Since v8.0
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
info (SerializationInfo)The System.Runtime.Serialization.SerializationInfo to populate with data.
context (StreamingContext)The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

GetSubstituteFont

#Since v8.7
public Font GetSubstituteFont()
If this font is not installed on the system, try to find a substitute

InstalledFonts

#Since v6.5
public static Font[] InstalledFonts()

InstalledFonts

#Since v6.5
public static Font[] InstalledFonts(string familyName)
familyName (string)

InstalledFontsAsQuartets

#Since v6.7
public static FontQuartet[] InstalledFontsAsQuartets()