Aspose::Words::Fonts::FontSourceBase class

FontSourceBase class

This is an abstract base class for the classes that allow the user to specify various font sources. To learn more, visit the Working with Fonts documentation article.

class FontSourceBase : public Aspose::Fonts::IFontSource

Methods

MethodDescription
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.
GetAvailableFonts()Returns list of fonts available via this source.
GetType() const override
Is(const System::TypeInfo&) const override
set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback>&)Setter for Aspose::Words::Fonts::FontSourceBase::get_WarningCallback.
static Type()

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());

See Also