Aspose::Words::Fonts::FileFontSource::FileFontSource constructor

FileFontSource::FileFontSource(const System::String&) constructor

Ctor.

Aspose::Words::Fonts::FileFontSource::FileFontSource(const System::String &filePath)
ParameterTypeDescription
filePathconst System::String&Path 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());

See Also

FileFontSource::FileFontSource(const System::String&, int32_t) constructor

Ctor.

Aspose::Words::Fonts::FileFontSource::FileFontSource(const System::String &filePath, int32_t priority)
ParameterTypeDescription
filePathconst System::String&Path to font file.
priorityint32_tFont 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());

See Also

FileFontSource::FileFontSource(const System::String&, int32_t, const System::String&) constructor

Ctor.

Aspose::Words::Fonts::FileFontSource::FileFontSource(const System::String &filePath, int32_t priority, const System::String &cacheKey)
ParameterTypeDescription
filePathconst System::String&Path to font file.
priorityint32_tFont source priority. See the Priority property description for more information.
cacheKeyconst System::String&The key of this source in the cache. See CacheKey property description for more information.

See Also