java.lang.Object
com.aspose.words.EmbeddedFontStyle
public class EmbeddedFontStyle
- extends java.lang.Object
Utility class containing constants.
Specifies the style of an embedded font inside a FontInfo object.
Example:
Shows how to extract embedded font from a document.
Document doc = new Document(getMyDir() + "Font.Embedded.docx");
// Let's get the font we are interested in
FontInfo mittelschriftInfo = doc.getFontInfos().get(2);
// We can now extract this embedded font
byte[] embeddedFontBytes = mittelschriftInfo.getEmbeddedFont(EmbeddedFontFormat.OPEN_TYPE, EmbeddedFontStyle.REGULAR);
Assert.assertNotNull(embeddedFontBytes);
// Then we can save the font to our directory
Files.write(Paths.get(getArtifactsDir() + "Alte DIN 1451 Mittelschrift.ttf"), embeddedFontBytes,
new StandardOpenOption[]{StandardOpenOption.CREATE, StandardOpenOption.APPEND});
// If we want to extract a font from a .doc as opposed to a .docx, we need to make sure to set the appropriate embedded font format
doc = new Document(getMyDir() + "Font.Embedded.doc");
Assert.assertNull(doc.getFontInfos().get("Alte DIN 1451 Mittelschrift").getEmbeddedFont(EmbeddedFontFormat.OPEN_TYPE, EmbeddedFontStyle.REGULAR));
Assert.assertNotNull(doc.getFontInfos().get("Alte DIN 1451 Mittelschrift").getEmbeddedFont(EmbeddedFontFormat.EMBEDDED_OPEN_TYPE, EmbeddedFontStyle.REGULAR));
Field Summary |
static final int | REGULAR = 0 | |
Specifies the Regular embedded font.
|
static final int | BOLD = 1 | |
Specifies the Bold embedded font.
|
static final int | ITALIC = 2 | |
Specifies the Italic embedded font.
|
static final int | BOLD_ITALIC = 3 | |
Specifies the Bold-Italic embedded font.
|
REGULAR = 0 | |
public static final int REGULAR |
-
Specifies the Regular embedded font.
BOLD = 1 | |
public static final int BOLD |
-
Specifies the Bold embedded font.
ITALIC = 2 | |
public static final int ITALIC |
-
Specifies the Italic embedded font.
BOLD_ITALIC = 3 | |
public static final int BOLD_ITALIC |
-
Specifies the Bold-Italic embedded font.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.