Table of Contents

Struct FormFont

Namespace
RDCore.Forms.Model
Assembly
RDCore.Forms.dll

A font as a form holds it: every field a designer file writes for one.

public readonly record struct FormFont : IEquatable<FormFont>
Implements
Inherited Members

Constructors

FormFont(string, double, int, bool, bool, bool, int, bool)

A font as a form holds it: every field a designer file writes for one.

public FormFont(string Name, double Size, int Weight = 400, bool Italic = false, bool Underline = false, bool Strikethrough = false, int Charset = 0, bool IsNamed = true)

Parameters

Name string

The font's family name, such as MS Sans Serif.

Size double

The font's size in points. It is fractional: VB writes sizes such as 8.25 and 9.6.

Weight int

The font's weight, from 0 to 1000: 400 is normal and 700 is bold.

Italic bool

Whether the font is italic.

Underline bool

Whether the font is underlined.

Strikethrough bool

Whether the font is struck through.

Charset int

The font's character set, as Windows numbers them: 0 is ANSI, 2 is Symbol.

IsNamed bool

Whether the font's name was ever set; True by default. A stdole.StdFont no program has named reads its default name, MS Sans Serif, and is drawn in the scalable face Windows maps no name to, at that face's sizes (RDCore.SDK.Runtime.Stdole.StdFontObject.IsNamed). A font a form's file declares is named.

Fields

BoldWeight

The weight of a bold font.

public const int BoldWeight = 700

Field Value

int

NormalWeight

The weight of a normal font.

public const int NormalWeight = 400

Field Value

int

Properties

Bold

Whether the font is bold: its weight is BoldWeight or more.

public bool Bold { get; }

Property Value

bool

Charset

The font's character set, as Windows numbers them: 0 is ANSI, 2 is Symbol.

public int Charset { get; init; }

Property Value

int

Default

The font a VB form and its controls have when the form's file declares none: MS Sans Serif at 8.25 points, as measured in VB6.

public static FormFont Default { get; }

Property Value

FormFont

IsNamed

Whether the font's name was ever set; True by default. A stdole.StdFont no program has named reads its default name, MS Sans Serif, and is drawn in the scalable face Windows maps no name to, at that face's sizes (RDCore.SDK.Runtime.Stdole.StdFontObject.IsNamed). A font a form's file declares is named.

public bool IsNamed { get; init; }

Property Value

bool

Italic

Whether the font is italic.

public bool Italic { get; init; }

Property Value

bool

Name

The font's family name, such as MS Sans Serif.

public string Name { get; init; }

Property Value

string

Size

The font's size in points. It is fractional: VB writes sizes such as 8.25 and 9.6.

public double Size { get; init; }

Property Value

double

Strikethrough

Whether the font is struck through.

public bool Strikethrough { get; init; }

Property Value

bool

Underline

Whether the font is underlined.

public bool Underline { get; init; }

Property Value

bool

Weight

The font's weight, from 0 to 1000: 400 is normal and 700 is bold.

public int Weight { get; init; }

Property Value

int

Methods

AtDrawnSize()

The font at the size VB6 draws it at, which is the size VB6 reads back from a font it holds, as measured.

public FormFont AtDrawnSize()

Returns

FormFont

The font, with the size it is drawn at as its Size.

Remarks

The size is the one DrawnSize(string, decimal) gives for the font's name, or for no name where the font is not IsNamed: a whole number of pixels, or one of a bitmap font's own sizes, so MS Sans Serif asked for 8 points is drawn at 8.25. A size of 0 or less is drawn as the smallest size, and one too large to draw as the largest.

FromStdFont(StdFontObject)

Makes the font a stdole.StdFont holds, as a VB6 control takes one for its Font.

public static FormFont FromStdFont(StdFontObject font)

Parameters

font StdFontObject

The stdole.StdFont.

Returns

FormFont

The font, at the size the RDCore.SDK.Runtime.Stdole.StdFontObject reads back, and named where it is.

Exceptions

ArgumentNullException

font is null.

TryToStdFont(out StdFontObject?)

Makes the stdole.StdFont that holds this font, as a VB6 control gives one for its Font.

public StdFontFailure TryToStdFont(out StdFontObject? font)

Parameters

font StdFontObject

The new font, holding each of this font's values; null where a value is refused.

Returns

StdFontFailure

RDCore.SDK.Runtime.Stdole.StdFontFailure.None where every value is taken; otherwise the failure of the first value a RDCore.SDK.Runtime.Stdole.StdFontObject refuses, in the order name, size, weight, character set: a name longer than 31 characters, a size of 0 or less or of 24576 points or more, a weight outside 0 to 1000, a character set outside 0 to 255.

Remarks

The new font's weight is 400 or 700, as a RDCore.SDK.Runtime.Stdole.StdFontObject stores one. A font that is not IsNamed is given no name, so the new font is not named either.