FontData Class
Stores data about a font.
public class FontData : DisposableObject, IDisposable
- Inheritance:
- object MarshalByRefObject DisposableObject object
- Implements:
- IDisposable
Constructors
FontData(string, float, FontStyle)
Initializes an instance of the FontData class.
public FontData(string fontFamilyName, float fontSize, FontStyle fontStyle)
| Parameter | Type | Description |
|---|---|---|
| fontFamilyName | string | The font family name. |
| fontSize | float | The font size. |
| fontStyle | FontStyle | The font style. |
Properties
Ascent
Gets the ascent (also known as baseline) distance.
Descent
Gets the descent distance.
ExternalLeading
Gets the external leading distance.
Font
Gets the Font.
HFont
Gets the hFont handle.
Height
Gets the font height.
InternalLeading
Gets the internal leading distance.
ScriptCache
Gets a handle to the script cache for this font.
public nint ScriptCache { get; set; }
Property Value
- nint:
A handle to the script cache for this font.
SystemDeviceDpi
Gets the DPI of the system device.
VerticalAlignmentOffset
Gets an additional offset value for vertically aligning certain fonts in GDI.
public float VerticalAlignmentOffset { get; }
Property Value
- float:
An additional offset value for vertically aligning certain fonts in GDI.
Methods
Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected override void Dispose(bool disposing)
| Parameter | Type | Description |
|---|---|---|
| disposing | bool |
|
Remarks
This method is called by the public Dispose method and the Finalize method.
Dispose invokes this method with the disposing parameter set to true.
Finalize invokes this method with disposing set to false.
Equals(object)
Determines whether the specified Object is equal to the current Object.
public override bool Equals(object obj)
| Parameter | Type | Description |
|---|---|---|
| obj | object | The |
Returns
- bool:
trueif the specifiedObjectis equal to the currentObject; otherwise,false.
FitToHeight(float)
Ensures the returned FontData fits within the specified height.
public FontData FitToHeight(float maxHeight)
| Parameter | Type | Description |
|---|---|---|
| maxHeight | float | The maximum height. |
Returns
Remarks
If the current FontData instance fits within the specified height, it is returned. Otherwise, this instance is disposed and a new instance is returned that does fit.
GetHashCode()
Returns a hash code for this object.
public override int GetHashCode()
Returns
- int:
An integer value that specifies a hash value for this object.
Fields
AdditionalAscent
Additional ascent added to match other UI frameworks.
public const int AdditionalAscent = 1
Inherited Members
- DisposableObject.Dispose()
- DisposableObject.VerifyNotDisposed()
- DisposableObject.IsDisposed
- DisposableObject.Disposed
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.MemberwiseClone(bool)
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)