FontData Class
Stores data about a font.
public class FontData : DisposableObjectBase, IDisposable
- Inheritance:
- object DisposableObjectBase object
- Implements:
- IDisposable
Constructors
FontData(string, float, FontStyle)
Initializes an instance of the 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
The ascent (also known as baseline) distance.
Descent
The descent distance.
ExternalLeading
The external leading distance.
Font
The Font.
HFont
The hFont handle.
Height
The font height.
InternalLeading
The internal leading distance.
ScriptCache
A handle to the script cache for this font.
SystemDeviceDpi
The DPI of the system device.
VerticalAlignmentOffset
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 object to compare with the current object. |
Returns
- bool:
trueif the specified object is equal to the current object; 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()
Serves as the default hash function.
Inherited Members
- DisposableObjectBase.Dispose()
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)