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
NamestringThe font's family name, such as
MS Sans Serif.SizedoubleThe font's size in points. It is fractional: VB writes sizes such as 8.25 and 9.6.
WeightintThe font's weight, from 0 to 1000: 400 is normal and 700 is bold.
ItalicboolWhether the font is italic.
UnderlineboolWhether the font is underlined.
StrikethroughboolWhether the font is struck through.
CharsetintThe font's character set, as Windows numbers them: 0 is ANSI, 2 is Symbol.
IsNamedboolWhether the font's name was ever set; True by default. A
stdole.StdFontno 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
NormalWeight
The weight of a normal font.
public const int NormalWeight = 400
Field Value
Properties
Bold
Whether the font is bold: its weight is BoldWeight or more.
public bool Bold { get; }
Property Value
Charset
The font's character set, as Windows numbers them: 0 is ANSI, 2 is Symbol.
public int Charset { get; init; }
Property Value
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
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
Italic
Whether the font is italic.
public bool Italic { get; init; }
Property Value
Name
The font's family name, such as MS Sans Serif.
public string Name { get; init; }
Property Value
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
Strikethrough
Whether the font is struck through.
public bool Strikethrough { get; init; }
Property Value
Underline
Whether the font is underlined.
public bool Underline { get; init; }
Property Value
Weight
The font's weight, from 0 to 1000: 400 is normal and 700 is bold.
public int Weight { get; init; }
Property Value
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
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
fontStdFontObjectThe
stdole.StdFont.
Returns
- FormFont
The font, at the size the RDCore.SDK.Runtime.Stdole.StdFontObject reads back, and named where it is.
Exceptions
- ArgumentNullException
fontis 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
fontStdFontObjectThe 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.