GH_FontServer

public sealed class GH_FontServer
Maintains a collection of standard fonts and mays to measure them.

Properties

Console

#
FontFamily.GenericMonospace, 10pt, regular
public static Font Console { get; }

ConsoleAdjusted

#
FontFamily.GenericMonospace, 10pt, regular, adjusted to counter UI scaling.
public static Font ConsoleAdjusted { get; }

ConsoleSmall

#
FontFamily.GenericMonospace, 8pt, regular
public static Font ConsoleSmall { get; }

ConsoleSmallAdjusted

#
FontFamily.GenericMonospace, 8pt, regular, adjusted to counter UI scaling.
public static Font ConsoleSmallAdjusted { get; }

FamilyConsole

#
Gets or sets the FontFamily used for monospaced fonts in Grasshopper.
public static FontFamily FamilyConsole { get; set; }

FamilyScript

#
Gets or sets the FontFamily used for scripted fonts in Grasshopper.
public static FontFamily FamilyScript { get; set; }

FamilyStandard

#
Gets or sets the FontFamily used for standard fonts in Grasshopper.
public static FontFamily FamilyStandard { get; set; }

Large

#
SystemFonts.CaptionFont, 10pt, bold
public static Font Large { get; }

LargeAdjusted

#
SystemFonts.CaptionFont, 10pt, bold, adjusted for logical pixel size.
public static Font LargeAdjusted { get; }

Script

#
FontFamily.GenericSansSerif, 10pt, italic
public static Font Script { get; }

ScriptSmall

#
FontFamily.GenericSansSerif, 8pt, italic
public static Font ScriptSmall { get; }

Small

#
SystemFonts.CaptionFont, 6pt, regular
public static Font Small { get; }

Standard

#
SystemFonts.CaptionFont, 8pt, regular
public static Font Standard { get; }

StandardAdjusted

#
SystemFonts.CaptionFont, 8pt, regular, adjusted for logical pixel size.
public static Font StandardAdjusted { get; }

StandardBold

#
SystemFonts.CaptionFont, 8pt, bold
public static Font StandardBold { get; }

StandardItalic

#
SystemFonts.CaptionFont, 8pt, italic
public static Font StandardItalic { get; }

Methods

FontToString

#
Convert a font to a string.
public static string FontToString(
Font
font
Font to convert.
)
Strig representing the font family, size, bold and italic flags.

MeasureString

#
Measure the size of a string
public static Size MeasureString(
text,
The string to measure
Font
font,
The font to measure with
maxwidth
The maximum width (in pixels) for the layout
)

MeasureString

#
Measure the size of a string
public static Size MeasureString(
text,
The string to measure
Font
font,
The font to measure with
SizeF
iLayout
The layout rectangle
)

MeasureString

#
Measure the size of a string
public static Size MeasureString(
text,
The string to measure
Font
font
The font to measure with
)

NewFont

#
Safe font constructor.
public static Font NewFont(
Font
font,
Base font.
size,
New size (points)
style
New style.
)

NewFont

#
Safe font constructor.
public static Font NewFont(
Font
font,
Base font.
size
New size (points)
)

NewFont

#
Safe font constructor.
public static Font NewFont(
Font
font,
Base font.
style
New style.
)

NewFont

#
Safe font constructor.
public static Font NewFont(
family,
Font family.
size,
Size (in points).
style
Style (if available).
)
A font, or null if family is null. A null family means the machine could not supply one at all; returning null degrades text rather than sinking the shared constructor, which is how the LINUX branches have always behaved and what the measuring methods below already expect.

NewFont

#
Safe font constructor.
public static Font NewFont(
family,
Font family.
size
Size (in points).
)

NewFont

#
High level function for Font creation. We've ran into loads of trouble in the past with missing Fonts. Never create a font directly via GDI+, always use this method.
public static Font NewFont(
family,
Font Family Name. If a font is found with the exact name, it will be loaded.
size,
Size of font.
style
Font style, if the requested family does not support the requested style, the style flags will be ignored.
)
A font that might or might not be what you asked for.

StringToFont

#
Convert a font description string back into a font.
public static Font StringToFont(
text
Text to parse.
)
Font represented by the text, or null if no font could be created.

StringWidth

#
Measure the maximum width of a collection of strings
public static int StringWidth(
text,
The strings to measure
Font
font
The font to measure with
)

StringWidth

#
Measure the width of a string in pixels
public static int StringWidth(
text,
The string to measure
Font
font
The font to measure with
)

Events

ConsoleFamilyChanged

#
Raised whenever the MonospacedFamily is changed.
public static event GH_FontServer.ConsoleFamilyChangedEventHandler ConsoleFamilyChanged

ScriptFamilyChanged

#
Raised whenever the ScriptFamily is changed.
public static event GH_FontServer.ScriptFamilyChangedEventHandler ScriptFamilyChanged

StandardFamilyChanged

#
Raised whenever the StandardFamily is changed.
public static event GH_FontServer.StandardFamilyChangedEventHandler StandardFamilyChanged