EmbeddedFontStyle Enumeration

Specifies the style of an embedded font inside a FontInfo object.

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

Syntax

[FlagsAttribute]
public enum EmbeddedFontStyle

Members

  Member nameValueDescription
Regular0 Specifies the Regular embedded font.
Bold1 Specifies the Bold embedded font.
Italic2 Specifies the Italic embedded font.
BoldItalic3 Specifies the Bold-Italic embedded font.

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