Aspose::Words::Fonts::FontConfigSubstitutionRule class
Contents
[
Hide
]FontConfigSubstitutionRule class
Font config substitution rule. To learn more, visit the Working with Fonts documentation article.
class FontConfigSubstitutionRule : public Aspose::Words::Fonts::FontSubstitutionRule
Methods
Method | Description |
---|---|
virtual get_Enabled() | Specifies whether the rule is enabled or not. |
GetType() const override | |
Is(const System::TypeInfo&) const override | |
IsFontConfigAvailable() | Check if fontconfig utility is available or not. |
ResetCache() | Resets the cache of fontconfig calling results. |
set_Enabled(bool) override | Specifies whether the rule is enabled or not. |
static Type() |
Remarks
This rule uses fontconfig utility on Linux (and other Unix-like) platforms to get the substitution if the original font is not available.
If fontconfig utility is not available then this rule will be ignored.
Examples
Shows operating system-dependent font config substitution.
auto fontSettings = System::MakeObject<Aspose::Words::Fonts::FontSettings>();
System::SharedPtr<Aspose::Words::Fonts::FontConfigSubstitutionRule> fontConfigSubstitution = fontSettings->get_SubstitutionSettings()->get_FontConfigSubstitution();
bool isWindows = System::MakeArray<System::PlatformID>({System::PlatformID::Win32NT, System::PlatformID::Win32S, System::PlatformID::Win32Windows, System::PlatformID::WinCE})->LINQ_Any(static_cast<System::Func<System::PlatformID, bool>>(static_cast<std::function<bool(System::PlatformID p)>>([](System::PlatformID p) -> bool
{
return System::Environment::get_OSVersion().get_Platform() == p;
})));
// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (isWindows)
{
ASSERT_FALSE(fontConfigSubstitution->get_Enabled());
ASSERT_FALSE(fontConfigSubstitution->IsFontConfigAvailable());
}
bool isLinuxOrMac = System::MakeArray<System::PlatformID>({System::PlatformID::Unix, System::PlatformID::MacOSX})->LINQ_Any(static_cast<System::Func<System::PlatformID, bool>>(static_cast<std::function<bool(System::PlatformID p)>>([](System::PlatformID p) -> bool
{
return System::Environment::get_OSVersion().get_Platform() == p;
})));
// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (isLinuxOrMac)
{
ASSERT_TRUE(fontConfigSubstitution->get_Enabled());
ASSERT_TRUE(fontConfigSubstitution->IsFontConfigAvailable());
fontConfigSubstitution->ResetCache();
}
See Also
- Class FontSubstitutionRule
- Namespace Aspose::Words::Fonts
- Library Aspose.Words for C++