FontTypeface

WidgetReferences
[Handler(FontTypeface.IHandler)] public class FontTypeface : Widget
A font type that specifies the characteristics of a FontFamily variation
Remarks: Each FontFamily can have different variations, such as Bold, Italic, Bold and Italic, etc. This class represents each supported typeface of a particular font family, and can be used to create a Font instance that uses this typeface, using the Font constructor.

Constructors

FontTypeface

#
public FontTypeface(FontFamily family, IHandler handler)
Initializes a new instance of a FontTypeface class with the specified handler
Remarks: This allows the platform handlers to create instances of the FontTypeface class with a specific handler. It should not be called by user code.
family (FontFamily)Family this typeface is part of
handler (FontTypeface.IHandler)Handler to use for this typeface instance

FontTypeface

#
public FontTypeface(Stream stream)
Creates a new instance of the FontTypeface from a font in the specified stream.
Remarks: Note that calling this multiple times for the same stream may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
stream (Stream)Stream to a font file to load

FontTypeface

#
public FontTypeface(string fileName)
Creates a new instance of the FontTypeface from the specified font file on disk.
Remarks: Note that calling this multiple times for the same file may cause additional overhead or unpredictable results, so you should keep a copy of it in memory when you want to use it.
fileName (string)Path to the font file to load

Properties

Bold

#
public bool Bold { get; }
Gets a value indicating that this font typeface has a bold style

ControlObject

public object ControlObject { get; }
Gets the instance of the platform-specific object
inherited fromWidget
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.

FontStyle

#
public FontStyle FontStyle { get; }
Gets the style of this typeface
Remarks: This style does not fully describe the characteristics of the typeface, just very broad characteristics.

Handler

public object Handler { get; }
Gets the platform-specific handler for this widget
inherited fromWidget

IsDisposed

public bool IsDisposed { get; }
Gets or sets a value indicating whether this Widget has been disposed.
inherited fromWidget
Remarks: When the widget is disposed, it can no longer be used.
true if this instance has been disposed; otherwise, false.

IsSymbol

#
public bool IsSymbol { get; }
Gets a value indicating that this font is a symbol font and not generally used for text
Remarks: Some platforms (e.g. Gtk) might not support this and simply return false for all fonts.

Italic

#
public bool Italic { get; }
Gets a value indicating that this font typeface has an italic style

LocalizedName

#
public string LocalizedName { get; }
Gets the localized name of this typeface
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.

Name

#
public string Name { get; }
Gets the name of this typeface
Remarks: The name of the typeface typically includes hints to the style of the type

NativeHandle

public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget

Platform

public Platform Platform { get; }
Gets the platform that was used to create the Widget.Handler for this widget
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object

PostScriptName

#Since v2.11
public string PostScriptName { get; }
Gets the PostScript name of this typeface, which is a unique name for this typeface that is used by the operating system to identify it.
Remarks: The PostScript name is typically used to create a font from the operating system, and is not generally used for display purposes. The value of this property may be null if the platform does not support it, or if the font does not have a PostScript name. In some implementations and as a fallback, this can be a combination of the family name and typeface name, but this is not guaranteed to be unique across all fonts.

Properties

public PropertyStore Properties { get; }
Gets the dictionary of properties for this widget
inherited fromWidget

Style

public string Style { get; set; }
Gets or sets the style of this widget
inherited fromWidget
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.
// 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

protected virtual void Dispose(bool disposing)
Handles the disposal of this widget
inherited fromWidget
disposing (bool)True if the caller called Widget.Dispose() manually, false if being called from a finalizer

Equals

#
public bool Equals(FontTypeface other)
Tests this instance for equality with another font typeface
Remarks: Font typefaces are considered equal if the names are the same
other (FontTypeface)Other font typeface to test
True if the typefaces are equal, false otherwise

Equals

#
public override bool Equals(object obj)
Tests if this instance is equal to the specified object
obj (object)Object to test with
True if the specified object is a FontTypeface and is equal to this instance
Object.Equals

GetCallback

protected virtual object GetCallback()
Gets an instance of an object used to perform callbacks to the widget from handler implementations
inherited fromWidget
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.
The callback instance to use for this widget

GetHashCode

#
public override int GetHashCode()
Gets the hash code for this instance

HasCharacterRange

#
public bool HasCharacterRange(int start, int end)
Gets a value indicating that this font supports the character range specified
start (int)Start of the range
end (int)End of the range (inclusive)
True if the font supports the characters in the specified range, false otherwise

HasCharacterRange

#
public bool HasCharacterRange(Range<int> range)
Gets a value indicating that this font supports the character range specified
range (Range<int>)Range to test
True if the font supports the characters in the specified range, false otherwise

HasCharacterRanges

#
public bool HasCharacterRanges(IEnumerable<Range<int>> ranges)
Gets a value indicating that this font supports the character ranges specified
ranges (IEnumerable<Range<int>>)Ranges to test
True if the font supports all characters in the specified ranges, false otherwise

Initialize

protected void Initialize()
Initializes the widget handler
inherited fromWidget
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.

OnStyleChanged

protected virtual void OnStyleChanged(EventArgs e)
Handles when the Widget.Style is changed.
inherited fromWidget

ToString

#
public override string ToString()
Gets a string representation of this typeface

Events

Operators

OperationResultDescription
FontTypeface==FontTypefaceboolTests two FontTypeface objects for equality
FontTypeface!=FontTypefaceboolTests two FontTypeface objects for inequality