C# Class Xwt.Drawing.Font

Inheritance: XwtObject
显示文件 Open project: TheBrainTech/xwt Class Usage Examples

Public Methods

Method Description
Equals ( object obj ) : bool
FromName ( string name ) : Font

Creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"

Creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, weight or stretch, and SIZE is a decimal number (size in points). Any one of the options may be absent. If FAMILY-LIST is absent, the default font family will be used. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to the default font size. If the font doesn't exist, it returns the system font.

GetAvailableFontFaces ( ) : ReadOnlyCollection

Gets the available variants of the font with varying weight, style and stretch.

Not all weights, styles or strech variants and combinations are available for every font or family. In case of an invalid combination, most toolkits fallback to a system default variant. GetAvailableFontFaces helps to retrieve only valid combinations for a specific font family.

GetAvailableFontFaces ( string fontFamily ) : ReadOnlyCollection

Gets the available family/font variants with varying weight, style and stretch.

Not all weights, styles or strech variants and combinations are available for every font or family. In case of an invalid combination, most toolkits fallback to a system default variant. GetAvailableFontFaces helps to retrieve only valid combinations for a specific font family.

GetHashCode ( ) : int
RegisterFontFromFile ( string fontPath ) : bool

Register a font file with the system font manager that is then accessible through FromName. The font is only available during the lifetime of the process.

ToString ( ) : string
WithFamily ( string fontFamily ) : Font

Returns a copy of the font using the provided font family

WithScaledSize ( double scale ) : Font
WithSettings ( Font fromFont ) : Font
WithSettings ( double size, FontStyle style, FontWeight weight, FontStretch stretch ) : Font
WithSize ( double size ) : Font
WithStretch ( FontStretch stretch ) : Font
WithStyle ( FontStyle style ) : Font
WithWeight ( FontWeight weight ) : Font

Private Methods

Method Description
Font ( object backend ) : System
Font ( object backend, Toolkit toolkit ) : System
FromName ( string name, Toolkit toolkit ) : Font
GetDefaultFont ( string unknownFont ) : string
GetSupportedFont ( string fontNames ) : string
InitForToolkit ( Toolkit tk ) : void
IsFontSupported ( string fontNames ) : bool
LoadInstalledFonts ( ) : void
RegisterFontFromFile ( string fontPath, Toolkit toolkit ) : bool

Method Details

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

FromName() public static method

Creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]"
Creates a new font description from a string representation in the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace separated list of words where each WORD describes one of style, weight or stretch, and SIZE is a decimal number (size in points). Any one of the options may be absent. If FAMILY-LIST is absent, the default font family will be used. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to the default font size. If the font doesn't exist, it returns the system font.
public static FromName ( string name ) : Font
name string /// Font description ///
return Font

GetAvailableFontFaces() public method

Gets the available variants of the font with varying weight, style and stretch.
Not all weights, styles or strech variants and combinations are available for every font or family. In case of an invalid combination, most toolkits fallback to a system default variant. GetAvailableFontFaces helps to retrieve only valid combinations for a specific font family.
public GetAvailableFontFaces ( ) : ReadOnlyCollection
return ReadOnlyCollection

GetAvailableFontFaces() public static method

Gets the available family/font variants with varying weight, style and stretch.
Not all weights, styles or strech variants and combinations are available for every font or family. In case of an invalid combination, most toolkits fallback to a system default variant. GetAvailableFontFaces helps to retrieve only valid combinations for a specific font family.
public static GetAvailableFontFaces ( string fontFamily ) : ReadOnlyCollection
fontFamily string A comma separated list of families
return ReadOnlyCollection

GetHashCode() public method

public GetHashCode ( ) : int
return int

RegisterFontFromFile() public static method

Register a font file with the system font manager that is then accessible through FromName. The font is only available during the lifetime of the process.
public static RegisterFontFromFile ( string fontPath ) : bool
fontPath string Font path.
return bool

ToString() public method

public ToString ( ) : string
return string

WithFamily() public method

Returns a copy of the font using the provided font family
public WithFamily ( string fontFamily ) : Font
fontFamily string A comma separated list of families
return Font

WithScaledSize() public method

public WithScaledSize ( double scale ) : Font
scale double
return Font

WithSettings() public method

public WithSettings ( Font fromFont ) : Font
fromFont Font
return Font

WithSettings() public method

public WithSettings ( double size, FontStyle style, FontWeight weight, FontStretch stretch ) : Font
size double
style FontStyle
weight FontWeight
stretch FontStretch
return Font

WithSize() public method

public WithSize ( double size ) : Font
size double
return Font

WithStretch() public method

public WithStretch ( FontStretch stretch ) : Font
stretch FontStretch
return Font

WithStyle() public method

public WithStyle ( FontStyle style ) : Font
style FontStyle
return Font

WithWeight() public method

public WithWeight ( FontWeight weight ) : Font
weight FontWeight
return Font