API Reference
Class
FontLoader
Utility methods for embedding custom fonts.
Inheritance
- Object
- FontLoader
Methods
LoadFontAsStyle 2 overloads
public static Style LoadFontAsStyle(String fontFamily, String fontFilePath) #Returns:
StyleLoads a font file and returns a Style object representing a CSS @font-face rule with the font embedded as Base64.
Parameters
- fontFamily System.String
- Font family name.
- fontFilePath System.String
- 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:
StyleLoads a font from a stream and returns a style representing the @font-face rule.
Parameters
- fontFamily System.String
- Font family name.
- fontStream System.IO.Stream
- Stream containing the font data.
- extension System.String
- File extension used to determine MIME type.
Returns
A Style containing the @font-face rule.
Exceptions
ArgumentNullException– Thrown when fontStream is null.