SupportFontFaceRules

HtmlLoadOptions.SupportFontFaceRules property

Gets or sets a value indicating whether to support @font-face rules and whether to load declared fonts. Default value is false.

public bool SupportFontFaceRules { get; set; }

Remarks

If this option is enabled, fonts declared in @font-face rules are loaded and embedded into the resulting document’s font definitions (see FontInfos). This makes the loaded fonts available for rendering but doesn’t automatically enable embedding of the fonts upon saving. In order to save the document with loaded fonts, the EmbedTrueTypeFonts property of the FontInfos collection should be set to true.

Supported font formats are TTF, EOT, and WOFF.

@font-face rules are not supported when loading SVG images.

Examples

Shows how to load declared “@font-face” rules.

HtmlLoadOptions loadOptions = new HtmlLoadOptions();
loadOptions.SupportFontFaceRules = true;
Document doc = new Document(MyDir + "Html with FontFace.html", loadOptions);

Assert.AreEqual("Squarish Sans CT Regular", doc.FontInfos[0].Name);

See Also