com.aspose.words
Class EmbeddedFontFormat

java.lang.Object
    extended by com.aspose.words.EmbeddedFontFormat

public class EmbeddedFontFormat 
extends java.lang.Object

Utility class containing constants.

Specifies format of particular embedded font inside FontInfo object.

When saving a document to a file, only embedded fonts of corresponding format are written down.

Example:

Shows how to extract embedded font from a document.
Document doc = new Document(getMyDir() + "Embedded font.docx");

// Get the FontInfo for the embedded font
FontInfo embeddedFont = doc.getFontInfos().get("Alte DIN 1451 Mittelschrift");

// We can now extract this embedded font
byte[] embeddedFontBytes = embeddedFont.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() + "Embedded font.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 intEMBEDDED_OPEN_TYPE = 0
          

Specifies Embedded OpenType (EOT) File Format.

This format of embedded fonts used in DOC files.

static final intOPEN_TYPE = 1
          

Specifies font, embedded as plain copy of OpenType (TrueType) font file.

This format of embedded fonts used in Open Office XML format, including DOCX files.

 

Field Detail

EMBEDDED_OPEN_TYPE = 0

public static final int EMBEDDED_OPEN_TYPE

Specifies Embedded OpenType (EOT) File Format.

This format of embedded fonts used in DOC files.

See http://www.w3.org/Submission/EOT for description of the format.


OPEN_TYPE = 1

public static final int OPEN_TYPE

Specifies font, embedded as plain copy of OpenType (TrueType) font file.

This format of embedded fonts used in Open Office XML format, including DOCX files.


See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.