Aspose::Words::Fonts::FileFontSource class

FileFontSource class

Represents the single TrueType font file stored in the file system. To learn more, visit the Working with Fonts documentation article.

class FileFontSource : public FontSourceBase

Methods

MethodDescription
FileFontSource(const System::String &)Ctor.
FileFontSource(const System::String &, int32_t)Ctor.
FileFontSource(const System::String &, int32_t, const System::String &)Ctor.
get_CacheKey() constThe key of this source in the cache.
get_FilePath() constPath to the font file.
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 font file in the local file system as a font source.

auto fileFontSource = System::MakeObject<Aspose::Words::Fonts::FileFontSource>(get_MyDir() + u"Alte DIN 1451 Mittelschrift.ttf", 0);

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>>({fileFontSource}));

ASSERT_EQ(fileFontSource->get_FilePath(), get_MyDir() + u"Alte DIN 1451 Mittelschrift.ttf");
ASSERT_EQ(fileFontSource->get_Type(), FontSourceType::FontFile);
ASSERT_EQ(fileFontSource->get_Priority(), 0);

See Also