C# Class ARCed.Helpers.FontHelper

Static class for loading and creating Fonts in memory without the need to have them installed.
In order for a memory font to be drawn on a control, it must be rendered with GDI+, so "SetCompatibleTextRenderingDefault" must be set for the application, or "UseCompatibleTextRendering" for individual controls.
Afficher le fichier Open project: borisblizzard/arcreator

Méthodes publiques

Méthode Description
AddFileFont ( string filename ) : void

Adds a private memory font from a file

AddFont ( Stream stream ) : void

Adds a private memory font from a stream

The stream will be closed automatically after the font is loaded

AddResourceFont ( byte bytes ) : void

Adds a font from an array of bytes

AddResourceFont ( string resourceName ) : void

Adds a private memory font from an embedded resource

GetFont ( string familyName, float size, FontStyle style ) : Font

Creates and returns a font, first checking memorized fonts.

GetMemoryFont ( string familyName, float size, FontStyle style ) : Font

Finds and creates a font from a font family previously loaded into memory

IsInstalled ( string fontName ) : bool

Checks if a font is installed on the machine and returns the result

LoadUserFonts ( ) : void

Loads all TrueType fonts found in the application's "Fonts" folder into memory.

This method also loads resource fonts embedded into the application.

Method Details

AddFileFont() public static méthode

Adds a private memory font from a file
public static AddFileFont ( string filename ) : void
filename string The path of the file
Résultat void

AddFont() public static méthode

Adds a private memory font from a stream
The stream will be closed automatically after the font is loaded
public static AddFont ( Stream stream ) : void
stream Stream The stream to load the font from
Résultat void

AddResourceFont() public static méthode

Adds a font from an array of bytes
public static AddResourceFont ( byte bytes ) : void
bytes byte Array of bytes to read
Résultat void

AddResourceFont() public static méthode

Adds a private memory font from an embedded resource
public static AddResourceFont ( string resourceName ) : void
resourceName string The full names, including namespaces, of the resource file
Résultat void

GetFont() public static méthode

Creates and returns a font, first checking memorized fonts.
public static GetFont ( string familyName, float size, FontStyle style ) : Font
familyName string Name of the font family
size float Size of the font
style FontStyle Style to apply to the font
Résultat System.Drawing.Font

GetMemoryFont() public static méthode

Finds and creates a font from a font family previously loaded into memory
public static GetMemoryFont ( string familyName, float size, FontStyle style ) : Font
familyName string Name of the font family
size float Size of the font
style FontStyle Style to apply to the font
Résultat System.Drawing.Font

IsInstalled() public static méthode

Checks if a font is installed on the machine and returns the result
public static IsInstalled ( string fontName ) : bool
fontName string The names of the font to check for
Résultat bool

LoadUserFonts() public static méthode

Loads all TrueType fonts found in the application's "Fonts" folder into memory.
This method also loads resource fonts embedded into the application.
public static LoadUserFonts ( ) : void
Résultat void