Aspose::Words::Fonts::FolderFontSource class

FolderFontSource class

Represents the folder that contains TrueType font files. To learn more, visit the Working with Fonts documentation article.

class FolderFontSource : public FontSourceBase

Methods

MethodDescription
FolderFontSource(const System::String &, bool)Ctor.
FolderFontSource(const System::String &, bool, int32_t)Ctor.
get_FolderPath() constPath to the folder.
get_ScanSubfolders() constDetermines whether or not to scan the subfolders.
get_Type() overrideReturns the type of the font source.
GetAvailableFonts()Returns list of fonts available via this source.
get_Priority() constReturns the font source priority.
virtual get_Type()Returns the type of the font source.
get_WarningCallback() constCalled during processing of font source when an issue is detected that might result in formatting fidelity loss.
set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback> &)Called during processing of font source when an issue is detected that might result in formatting fidelity loss.

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 = System::MakeObject<Aspose::Words::Fonts::FolderFontSource>(get_FontsDir(), false, 1);

auto doc = System::MakeObject<Aspose::Words::Document>();
doc->set_FontSettings(System::MakeObject<Aspose::Words::Fonts::FontSettings>());
doc->get_FontSettings()->SetFontsSources(System::MakeArray<System::SharedPtr<Aspose::Words::Fonts::FontSourceBase>>({folderFontSource}));

ASSERT_EQ(folderFontSource->get_FolderPath(), get_FontsDir());
ASPOSE_ASSERT_EQ(folderFontSource->get_ScanSubfolders(), false);
ASSERT_EQ(folderFontSource->get_Type(), FontSourceType::FontsFolder);
ASSERT_EQ(folderFontSource->get_Priority(), 1);

See Also