Specifies a family for a Font object
Remarks: A font family defines the overall look of the font, such as "Times New Roman", "Helvetica", etc. Each family consists of one or more Typefaces, which define the variations of each font family. The variations can include Light, Bold, Italic, Oblique, etc. Only the styles in FontStyle are discoverable, other than looking at the FontTypeface.Name for hints as to what the variation will look like.
Constructors
FontFamily
#public FontFamily(IHandler handler)
Initializes a new instance of the FontFamily class with the specified handler
Remarks: Used by platform implementations to create instances of the FontFamily class directly
Parameters:
| handler (FontFamily.IHandler) | Handler to use |
Properties
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.
IsDisposed
Gets or sets a value indicating whether this Widget has been disposed.
Remarks: When the widget is disposed, it can no longer be used.
Value:
true if this instance has been disposed; otherwise, false.LocalizedName
#Gets the localized name of the font for the current UI language
Remarks: This will return a name suitable to display to the user in their own language, if the font provides a specific name for their UI language. For platforms that do not support localized font names, or for fonts that do not have a specific name for the current language, the value of Name will be returned.
Value: The localized name of this font.
Name
#Gets the name of this font family
Remarks: This is a non-localized version of the name, suitable for internal use.
See Also: LocalizedName
NativeHandle
public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
Example:
// in your UI
var control = new Button { Style = "mystyle" };
// in your platform assembly
using Eto.Mac.Forms.Controls;
Styles.AddHandler<ButtonHandler>("mystyle", handler => {
// this is where you can use handler.Control to set properties, handle events, etc.
handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});Methods
Dispose
public void Dispose()
Disposes of this widget, supressing the finalizer
Parameters:
| disposing (bool) | True if the caller called Widget.Dispose() manually, false if being called from a finalizer |
Equals
#Tests this instance for equality with another font family
Remarks: Font families are considered equal if the names are the same
Parameters:
| other (FontFamily) | Other font to test |
Returns: True if the families are equal, false otherwise
Equals
#Tests if this instance is equal to the specified object
Parameters:
| obj (object) | Object to test with |
Returns: True if the specified object is a FontFamily and is equal to this instance
Overrides: Object.Equals
FromFiles
#Creates a new instance of the FontFamily class with the specified font files.
Remarks: All font files specified must be a part of the same typographical font family. Also, calling this multiple times for the same streams may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
Parameters:
| fileNames (IEnumerable<string>) | Path to the file(s) to include in this font family |
Returns: A new instance of the FontFamily class
FromFiles
#Creates a new instance of the FontFamily class with the specified font files.
Remarks: All font files specified must be a part of the same typographical font family. Also, calling this multiple times for the same streams may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
Parameters:
| fileNames (params string[]) | Path to the file(s) to include in this font family |
Returns: A new instance of the FontFamily class
FromStreams
#Creates a new instance of the FontFamily class with the specified font file streams.
Remarks: All font files specified must be a part of the same typographical font family. Also, calling this multiple times for the same streams may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
Parameters:
| streams (IEnumerable<Stream>) | Streams of the font file(s) to include in this font family |
Returns: A new instance of the FontFamily class
FromStreams
#Creates a new instance of the FontFamily class with the specified font file streams.
Remarks: All font files specified must be a part of the same typographical font family. Also, calling this multiple times for the same streams may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
Parameters:
| streams (params Stream[]) | Streams of the font file(s) to include in this font family |
Returns: A new instance of the FontFamily class
GetCallback
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
Returns: The callback instance to use for this widget
GetHashCode
#Gets the hash code for this instance
Returns: Hash code for this instance
Overrides: Object.GetHashCode
Initialize
protected void Initialize()
Initializes the widget handler
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.
inherited fromWidget
ToString
#Gets a string representation of this font family
Returns: String representation of this font family
Overrides: Widget.ToString
Events
inherited fromWidget
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| FontFamily | == | FontFamily | bool | Tests two FontFamily objects for equality |
| FontFamily | != | FontFamily | bool | Tests two FontFamily objects for inequality |