MemoryFontSource Class

Represents the single TrueType font file stored in memory.

Inheritance Hierarchy

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


public class MemoryFontSource : FontSourceBase

The MemoryFontSource type exposes the following members.



Public propertyCode exampleFontData
Binary font data.
Public propertyCode examplePriority
Returns the font source priority.
(Inherited from FontSourceBase.)
Public propertyCode exampleType
Returns the type of the font source.
(Overrides FontSourceBaseType.)


Public methodEquals (Inherited from Object.)
Public methodCode exampleGetAvailableFonts
Returns list of fonts available via this source.
(Inherited from FontSourceBase.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)


Shows how to create a memory font source.
Document doc = new Document();

// Create a font settings object for our document
doc.FontSettings = new FontSettings();

// Import a font file, putting its contents into a byte array
byte[] fontBytes = File.ReadAllBytes(MyDir + "Alte DIN 1451 Mittelschrift.ttf");

// Create a memory font source from our array
MemoryFontSource memoryFontSource = new MemoryFontSource(fontBytes, 0);

// Add that font source to our document
doc.FontSettings.SetFontsSources(new FontSourceBase[] { memoryFontSource });

Assert.AreEqual(FontSourceType.MemoryFont, memoryFontSource.Type);
Assert.AreEqual(0, memoryFontSource.Priority);

See Also