EmbeddedFontFormat Enumeration

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.

Namespace:  Aspose.Words.Fonts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0

Syntax

public enum EmbeddedFontFormat

Members

  Member nameValueDescription
EmbeddedOpenType0

Specifies Embedded OpenType (EOT) File Format.

This format of embedded fonts used in DOC files.

OpenType1

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.

Examples

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

// Get the FontInfo for the embedded font
FontInfo embeddedFont = doc.FontInfos["Alte DIN 1451 Mittelschrift"];

// We can now extract this embedded font
byte[] embeddedFontBytes = embeddedFont.GetEmbeddedFont(EmbeddedFontFormat.OpenType, EmbeddedFontStyle.Regular);
Assert.IsNotNull(embeddedFontBytes);

// Then we can save the font to our directory
File.WriteAllBytes(ArtifactsDir + "Alte DIN 1451 Mittelschrift.ttf", embeddedFontBytes);

// 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(MyDir + "Embedded font.doc");

Assert.IsNull(doc.FontInfos["Alte DIN 1451 Mittelschrift"].GetEmbeddedFont(EmbeddedFontFormat.OpenType, EmbeddedFontStyle.Regular));
Assert.IsNotNull(doc.FontInfos["Alte DIN 1451 Mittelschrift"].GetEmbeddedFont(EmbeddedFontFormat.EmbeddedOpenType, EmbeddedFontStyle.Regular));

See Also