public class ExportFontFormat
extends java.lang.Object
Examples:
Shows how use fonts only from the target machine when saving a document to HTML.
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());
| Modifier and Type | Field and Description |
|---|---|
static int |
length |
static int |
TTF
TTF (TrueType Font format).
|
static int |
WOFF
WOFF (Web Open Font Format).
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String exportFontFormatName) |
static java.lang.String |
getName(int exportFontFormat) |
static int[] |
getValues() |
static java.lang.String |
toString(int exportFontFormat) |