Class DocumentFontsSubsystem

DocumentFontsSubsystem class

Simple implementation of Aspose.Note.Fonts.FontsSubsystem. Retrieves FontFamily object from OS.

public class DocumentFontsSubsystem : FontsSubsystem

Constructors

NameDescription
DocumentFontsSubsystem(Dictionary<string, string>)Initializes a new instance of the DocumentFontsSubsystem class.
DocumentFontsSubsystem(Stream, Dictionary<string, string>)Initializes a new instance of the DocumentFontsSubsystem class.
DocumentFontsSubsystem(string, Dictionary<string, string>)Initializes a new instance of the DocumentFontsSubsystem class.

Properties

NameDescription
static Default { get; set; }Gets or sets the static default instance.
DefaultFont { get; }Gets or sets default font.

Methods

NameDescription
static UsingDefaultFont(string, Dictionary<string, string>)Create new DocumentFontsSubsystem instance using specified default font name.
static UsingDefaultFontFromFile(string, Dictionary<string, string>)Create new DocumentFontsSubsystem instance using a font from specified file as default.
static UsingDefaultFontFromStream(Stream, Dictionary<string, string>)Create new DocumentFontsSubsystem instance using a font from specified stream as default.
AddFont(Stream)Add the font.
AddFont(string)Add the font.
AddFont(Stream, string)Add the font.
AddFontSubstitution(string, string)Adds font substitution.
virtual GetFontFamily(string)Gets font family.
LoadFontsFromFolder(string)Loads all TrueType fonts from specified folder to internal collection.

Examples

Shows how to save a document in pdf format using specified default font.

// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

// Load the document into Aspose.Note.
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

// Save the document as PDF
dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
oneFile.Save(dataDir, new PdfSaveOptions() 
                      {
                          FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFont("Times New Roman")
                      });

Shows how to save a document in pdf format using default font from a file.

// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

string fontFile = Path.Combine(dataDir, "geo_1.ttf");

// Load the document into Aspose.Note.
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

// Save the document as PDF
dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromFile_out.pdf";
oneFile.Save(dataDir, new PdfSaveOptions()
                          {
                              FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromFile(fontFile)
                          });

Shows how to save a document in pdf format using default font from a stream.

// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

string fontFile = Path.Combine(dataDir, "geo_1.ttf");

// Load the document into Aspose.Note.
Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

// Save the document as PDF
dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream_out.pdf";

using (var stream = File.Open(fontFile, FileMode.Open, FileAccess.Read, FileShare.Read))
{
    oneFile.Save(dataDir, new PdfSaveOptions()
                              {
                                  FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromStream(stream)
                              });
}

See Also