DocumentFontsSubsystem Class

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

Namespace:  Aspose.Note.Fonts
Assembly:  Aspose.Note (in Aspose.Note.dll) Version: 21.11
Syntax
public class DocumentFontsSubsystem : FontsSubsystem

The DocumentFontsSubsystem type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyStatic memberDefault
Gets or sets the static default instance.
Public propertyDefaultFont
Gets or sets default font.
(Inherited from FontsSubsystem.)
Methods
  NameDescription
Public methodAddFont(Stream)
Add the font.
(Inherited from FontsSubsystem.)
Public methodAddFont(String)
Add the font.
(Inherited from FontsSubsystem.)
Public methodAddFont(Stream, String)
Add the font.
(Inherited from FontsSubsystem.)
Public methodAddFontSubstitution
Adds font substitution.
(Inherited from FontsSubsystem.)
Public methodEquals (Inherited from Object.)
Protected methodFetchFontFamily
Fetches font family as a candidate for GetFontFamily.
(Overrides FontsSubsystemFetchFontFamily(String).)
Protected methodFinalize (Inherited from Object.)
Protected methodFindFontFamilyInInternalCollection
Tries to find font family in internal collection of GDI fonts.
(Inherited from FontsSubsystem.)
Public methodGetFontFamily
Gets font family.
(Inherited from FontsSubsystem.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodLoadFontsFromFolder
Loads all TrueType fonts from specified folder to internal collection.
(Inherited from FontsSubsystem.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Protected methodTranslateFontName
Tries to translate font name to its substitution via internal table.
(Inherited from FontsSubsystem.)
Public methodStatic memberCode exampleUsingDefaultFont
Create new DocumentFontsSubsystem instance using specified default font name.
Public methodStatic memberCode exampleUsingDefaultFontFromFile
Create new DocumentFontsSubsystem instance using a font from specified file as default.
Public methodStatic memberCode exampleUsingDefaultFontFromStream
Create new DocumentFontsSubsystem instance using a font from specified stream as default.
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")
                      });
Examples
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)
                          });
Examples
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