Aspose::Words::Saving::ExportFontFormat enum

ExportFontFormat enum

Indicates the format that is used to export fonts while rendering to HTML fixed format.

enum class ExportFontFormat

Values

NameValueDescription
Woff0WOFF (Web Open Font Format).
Ttf1TTF (TrueType Font format).

Examples

Shows how use fonts only from the target machine when saving a document to HTML.

auto doc = MakeObject<Document>(MyDir + u"Bullet points with alternative font.docx");

auto saveOptions = MakeObject<HtmlFixedSaveOptions>();
saveOptions->set_ExportEmbeddedCss(true);
saveOptions->set_UseTargetMachineFonts(useTargetMachineFonts);
saveOptions->set_FontFormat(ExportFontFormat::Ttf);
saveOptions->set_ExportEmbeddedFonts(false);

doc->Save(ArtifactsDir + u"HtmlFixedSaveOptions.UsingMachineFonts.html", saveOptions);

String outDocContents = System::IO::File::ReadAllText(ArtifactsDir + u"HtmlFixedSaveOptions.UsingMachineFonts.html");

if (useTargetMachineFonts)
{
    ASSERT_FALSE(System::Text::RegularExpressions::Regex::Match(outDocContents, u"@font-face")->get_Success());
}
else
{
    ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(
                    outDocContents, String(u"@font-face { font-family:'Arial'; font-style:normal; font-weight:normal; src:local[(]'☺'[)], ") +
                                        u"url[(]'HtmlFixedSaveOptions.UsingMachineFonts/font001.ttf'[)] format[(]'truetype'[)]; }")
                    ->get_Success());
}

See Also