Aspose::Words::Fonts::FolderFontSource Class Reference

Detailed Description

Represents the folder that contains TrueType font files.

Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

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

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

Public Member Functions

 FolderFontSource (const String &folderPath, bool scanSubfolders)
 Ctor. More...
 
 FolderFontSource (const String &folderPath, bool scanSubfolders, int32_t priority)
 Ctor. More...
 
String get_FolderPath () const
 Path to the folder. More...
 
bool get_ScanSubfolders () const
 Determines whether or not to scan the subfolders. 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

◆ FolderFontSource() [1/2]

Aspose::Words::Fonts::FolderFontSource::FolderFontSource ( const System::String folderPath,
bool  scanSubfolders 
)

Ctor.

Parameters
folderPathPath to folder.
scanSubfoldersDetermines whether or not to scan subfolders.
Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

◆ FolderFontSource() [2/2]

Aspose::Words::Fonts::FolderFontSource::FolderFontSource ( const System::String folderPath,
bool  scanSubfolders,
int32_t  priority 
)

Ctor.

Parameters
folderPathPath to folder.
scanSubfoldersDetermines whether or not to scan subfolders.
priorityFont source priority. See the Priority property description for more information.
Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

Member Function Documentation

◆ get_FolderPath()

System::String Aspose::Words::Fonts::FolderFontSource::get_FolderPath ( ) const

Path to the folder.

Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

◆ get_ScanSubfolders()

bool Aspose::Words::Fonts::FolderFontSource::get_ScanSubfolders ( ) const

Determines whether or not to scan the subfolders.

Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

◆ get_Type()

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

Returns the type of the font source.

Examples

Shows how to use a local system folder which contains fonts as a font source.

// Create a font source from a folder that contains font files.
auto folderFontSource = MakeObject<FolderFontSource>(FontsDir, false, 1);
auto doc = MakeObject<Document>();
doc->set_FontSettings(MakeObject<FontSettings>());
doc->get_FontSettings()->SetFontsSources(MakeArray<SharedPtr<FontSourceBase>>({folderFontSource}));
ASSERT_EQ(FontsDir, folderFontSource->get_FolderPath());
ASPOSE_ASSERT_EQ(false, folderFontSource->get_ScanSubfolders());
ASSERT_EQ(FontSourceType::FontsFolder, folderFontSource->get_Type());
ASSERT_EQ(1, folderFontSource->get_Priority());

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

◆ GetType()

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

◆ Is()

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

◆ Type()

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