Aspose::Words::Fonts::FileFontSource Class Reference

Detailed Description

Represents the single TrueType font file stored in the file system.

Examples

Shows how to use a font file in the local file system as a font source.

auto fileFontSource = MakeObject<FileFontSource>(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({fileFontSource}));
ASSERT_EQ(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", fileFontSource->get_FilePath());
ASSERT_EQ(FontSourceType::FontFile, fileFontSource->get_Type());
ASSERT_EQ(0, fileFontSource->get_Priority());

#include <Aspose.Words.Cpp/Fonts/FileFontSource.h>

+ Inheritance diagram for Aspose::Words::Fonts::FileFontSource:

Public Member Functions

 FileFontSource (const String &filePath)
 Ctor. More...
 
 FileFontSource (const String &filePath, int32_t priority)
 Ctor. More...
 
 FileFontSource (const String &filePath, int32_t priority, const String &cacheKey)
 Ctor. More...
 
String get_CacheKey () const
 The key of this source in the cache. More...
 
String get_FilePath () const
 Path to the font file. More...
 
FontSourceType get_Type () override
 Returns the type of the font source. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
- Public Member Functions inherited from FontSourceBase
int32_t get_Priority () const
 Returns the font source priority. More...
 
virtual FontSourceType get_Type ()=0
 Returns the type of the font source. More...
 
SharedPtr< IWarningCallbackget_WarningCallback () const
 Called during processing of font source when an issue is detected that might result in formatting fidelity loss. More...
 
SharedPtr< IList< SharedPtr< PhysicalFontInfo > > > GetAvailableFonts ()
 Returns list of fonts available via this source. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_WarningCallback (const SharedPtr< IWarningCallback > &value)
 Setter for get_WarningCallback. More...
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from FontSourceBase
static const TypeInfoType ()
 

Constructor & Destructor Documentation

◆ FileFontSource() [1/3]

Aspose::Words::Fonts::FileFontSource::FileFontSource ( const System::String filePath)

Ctor.

Parameters
filePathPath to font file.
Examples

Shows how to use a font file in the local file system as a font source.

auto fileFontSource = MakeObject<FileFontSource>(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({fileFontSource}));
ASSERT_EQ(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", fileFontSource->get_FilePath());
ASSERT_EQ(FontSourceType::FontFile, fileFontSource->get_Type());
ASSERT_EQ(0, fileFontSource->get_Priority());

◆ FileFontSource() [2/3]

Aspose::Words::Fonts::FileFontSource::FileFontSource ( const System::String filePath,
int32_t  priority 
)

Ctor.

Parameters
filePathPath to font file.
priorityFont source priority. See the Priority property description for more information.
Examples

Shows how to use a font file in the local file system as a font source.

auto fileFontSource = MakeObject<FileFontSource>(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({fileFontSource}));
ASSERT_EQ(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", fileFontSource->get_FilePath());
ASSERT_EQ(FontSourceType::FontFile, fileFontSource->get_Type());
ASSERT_EQ(0, fileFontSource->get_Priority());

◆ FileFontSource() [3/3]

Aspose::Words::Fonts::FileFontSource::FileFontSource ( const System::String filePath,
int32_t  priority,
const System::String cacheKey 
)

Ctor.

Parameters
filePathPath to font file.
priorityFont source priority. See the Priority property description for more information.
cacheKeyThe key of this source in the cache. See CacheKey property description for more information.

Member Function Documentation

◆ get_CacheKey()

System::String Aspose::Words::Fonts::FileFontSource::get_CacheKey ( ) const

The key of this source in the cache.

This key is used to identify cache item when saving/loading font search cache with SaveSearchCache() and SetFontsSources() methods.

If key is not specified then FilePath will be used as a key instead.

◆ get_FilePath()

System::String Aspose::Words::Fonts::FileFontSource::get_FilePath ( ) const

Path to the font file.

Examples

Shows how to use a font file in the local file system as a font source.

auto fileFontSource = MakeObject<FileFontSource>(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({fileFontSource}));
ASSERT_EQ(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", fileFontSource->get_FilePath());
ASSERT_EQ(FontSourceType::FontFile, fileFontSource->get_Type());
ASSERT_EQ(0, fileFontSource->get_Priority());

◆ get_Type()

Aspose::Words::Fonts::FontSourceType Aspose::Words::Fonts::FileFontSource::get_Type ( )
overridevirtual

Returns the type of the font source.

Examples

Shows how to use a font file in the local file system as a font source.

auto fileFontSource = MakeObject<FileFontSource>(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", 0);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({fileFontSource}));
ASSERT_EQ(MyDir + u"Alte DIN 1451 Mittelschrift.ttf", fileFontSource->get_FilePath());
ASSERT_EQ(FontSourceType::FontFile, fileFontSource->get_Type());
ASSERT_EQ(0, fileFontSource->get_Priority());

Implements Aspose::Words::Fonts::FontSourceBase.

◆ GetType()

virtual const System::TypeInfo & Aspose::Words::Fonts::FileFontSource::GetType ( ) const
overridevirtual

◆ Is()

virtual bool Aspose::Words::Fonts::FileFontSource::Is ( const System::TypeInfo target) const
overridevirtual

◆ Type()

static const System::TypeInfo & Aspose::Words::Fonts::FileFontSource::Type ( )
static