ExportFontFormat
Contents
[
Hide
]Inheritance: java.lang.Object
public class ExportFontFormat
Indicates the format that is used to export fonts while rendering to HTML fixed format.
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[(]'\u263a'[)], " +
"url[(]'HtmlFixedSaveOptions.UsingMachineFonts/font001.ttf'[)] format[(]'truetype'[)]; [}]").matcher(outDocContents).find());
Fields
Field | Description |
---|---|
TTF | TTF (TrueType Font format). |
WOFF | WOFF (Web Open Font Format). |
length |
Methods
Method | Description |
---|---|
fromName(String exportFontFormatName) | |
getName(int exportFontFormat) | |
getValues() | |
toString(int exportFontFormat) |
TTF
public static int TTF
TTF (TrueType Font format).
WOFF
public static int WOFF
WOFF (Web Open Font Format).
length
public static int length
fromName(String exportFontFormatName)
public static int fromName(String exportFontFormatName)
Parameters:
Parameter | Type | Description |
---|---|---|
exportFontFormatName | java.lang.String |
Returns: int
getName(int exportFontFormat)
public static String getName(int exportFontFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
exportFontFormat | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int exportFontFormat)
public static String toString(int exportFontFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
exportFontFormat | int |
Returns: java.lang.String