HtmlForgeX

API Reference

Class

FontLoader

Namespace HtmlForgeX.Resources
Assembly HtmlForgeX
Modifiers static

Utility methods for embedding custom fonts.

Inheritance

  • Object
  • FontLoader

Methods

LoadFontAsStyle 2 overloads
public static Style LoadFontAsStyle(String fontFamily, String fontFilePath) #
Returns: Style

Loads a font file and returns a Style object representing a CSS @font-face rule with the font embedded as Base64.

Parameters

fontFamily System.String requiredposition: 0
Font family name.
fontFilePath System.String requiredposition: 1
Path to the font file.

Returns

A Style containing the @font-face rule.

Exceptions

  • FileNotFoundException – Thrown when fontFilePath does not exist.
public static Style LoadFontAsStyle(String fontFamily, Stream fontStream, String extension) #
Returns: Style

Loads a font from a stream and returns a style representing the @font-face rule.

Parameters

fontFamily System.String requiredposition: 0
Font family name.
fontStream System.IO.Stream requiredposition: 1
Stream containing the font data.
extension System.String requiredposition: 2
File extension used to determine MIME type.

Returns

A Style containing the @font-face rule.

Exceptions

  • ArgumentNullException – Thrown when fontStream is null.