HtmlSaveOptions.FontResourcesSubsettingSizeThreshold

HtmlSaveOptions FontResourcesSubsettingSizeThreshold property. Controls which font resources need subsetting when saving to HTML MHTML or EPUB. Default is 0.

HtmlSaveOptions.FontResourcesSubsettingSizeThreshold property

Controls which font resources need subsetting when saving to HTML, MHTML or EPUB. Default is 0.

public int FontResourcesSubsettingSizeThreshold { get; set; }

Remarks

ExportFontResources allows exporting fonts as subsidiary files or as parts of the output package. If the document uses many fonts, especially with large number of glyphs, then output size can grow significantly. Font subsetting reduces the size of the exported font resource by filtering out glyphs that are not used by the current document.

Font subsetting works as follows:

  • By default, all exported fonts are subsetted.
  • Setting FontResourcesSubsettingSizeThreshold to a positive value instructs Wordize to subset fonts which file size is larger than the specified value.
  • Setting the property to MaxValue suppresses font subsetting.

Examples

Shows how to configure exporting fonts to HTML.

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
// Enable exporting font resources
htmlSaveOptions.ExportFontResources = true;
// Configure folder and it's alias where fonts will be written to.
htmlSaveOptions.FontsFolder = ArtifactsDir+"fonts";
htmlSaveOptions.FontsFolderAlias = "fonts";
// Disable font subsetting by setting subsetting size threshold to maximum value.
htmlSaveOptions.FontResourcesSubsettingSizeThreshold = int.MaxValue;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "HtmlSaveOptions.FontsFolder.html", htmlSaveOptions)
    .Execute();

See Also