public class ExportFontFormat
Example:
Document doc = new Document(getMyDir() + "Bullet points with alternative font.docx");
HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions();
{
saveOptions.setExportEmbeddedCss(true);
saveOptions.setUseTargetMachineFonts(useTargetMachineFonts);
saveOptions.setFontFormat(ExportFontFormat.TTF);
saveOptions.setExportEmbeddedFonts(false);
}
doc.save(getArtifactsDir() + "HtmlFixedSaveOptions.UsingMachineFonts.html", saveOptions);
String outDocContents = FileUtils.readFileToString(new File(getArtifactsDir() + "HtmlFixedSaveOptions.UsingMachineFonts.html"), StandardCharsets.UTF_8);
if (useTargetMachineFonts)
Assert.assertFalse(Pattern.compile("@font-face").matcher(outDocContents).find());
else
Assert.assertTrue(Pattern.compile(
"@font-face [{] font-family:'Arial'; font-style:normal; font-weight:normal; src:local[(]'☺'[)], " +
"url[(]'HtmlFixedSaveOptions.UsingMachineFonts/font001.ttf'[)] format[(]'truetype'[)]; [}]").matcher(outDocContents).find());
Field Summary | ||
---|---|---|
static final int | WOFF | |
WOFF (Web Open Font Format).
|
||
static final int | TTF | |
TTF (TrueType Font format).
|