Aspose::Words::Themes::ThemeFonts Class Reference

Detailed Description

Represents a collection of fonts in the font scheme, allowing to specify different fonts for different languages Latin, EastAsian and ComplexScript.

Examples

Shows how to set custom colors and fonts for themes.

auto doc = MakeObject<Document>(MyDir + u"Theme colors.docx");
// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
SharedPtr<Theme> theme = doc->get_Theme();
// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme->get_MajorFonts()->set_Latin(u"Courier New");
theme->get_MinorFonts()->set_Latin(u"Agency FB");
// Other languages may also have their custom fonts in this theme.
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_EastAsian());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_EastAsian());
// The "Colors" property contains the color palette from Microsoft Word,
// which appears when changing shading or font color.
// Apply custom colors to the color palette so we have easy access to them in Microsoft Word
// when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
// or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
SharedPtr<ThemeColors> colors = theme->get_Colors();
colors->set_Light2(System::Drawing::Color::get_Khaki());
colors->set_Accent3(System::Drawing::Color::get_Yellow());
colors->set_Accent4(System::Drawing::Color::get_Gold());
// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors->set_Hyperlink(System::Drawing::Color::get_Black());
colors->set_FollowedHyperlink(System::Drawing::Color::get_Gray());
doc->Save(ArtifactsDir + u"Themes.CustomColorsAndFonts.docx");

#include <Aspose.Words.Cpp/Themes/ThemeFonts.h>

+ Inheritance diagram for Aspose::Words::Themes::ThemeFonts:

Public Member Functions

String get_ComplexScript ()
 Specifies font name for ComplexScript characters. More...
 
String get_EastAsian ()
 Specifies font name for EastAsian characters. More...
 
String get_Latin ()
 Specifies font name for Latin characters. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_ComplexScript (const String &value)
 Setter for get_ComplexScript. More...
 
void set_EastAsian (const String &value)
 Setter for get_EastAsian. More...
 
void set_Latin (const String &value)
 Setter for get_Latin. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Function Documentation

◆ get_ComplexScript()

System::String Aspose::Words::Themes::ThemeFonts::get_ComplexScript ( )

Specifies font name for ComplexScript characters.

Examples

Shows how to set custom colors and fonts for themes.

auto doc = MakeObject<Document>(MyDir + u"Theme colors.docx");
// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
SharedPtr<Theme> theme = doc->get_Theme();
// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme->get_MajorFonts()->set_Latin(u"Courier New");
theme->get_MinorFonts()->set_Latin(u"Agency FB");
// Other languages may also have their custom fonts in this theme.
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_EastAsian());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_EastAsian());
// The "Colors" property contains the color palette from Microsoft Word,
// which appears when changing shading or font color.
// Apply custom colors to the color palette so we have easy access to them in Microsoft Word
// when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
// or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
SharedPtr<ThemeColors> colors = theme->get_Colors();
colors->set_Light2(System::Drawing::Color::get_Khaki());
colors->set_Accent3(System::Drawing::Color::get_Yellow());
colors->set_Accent4(System::Drawing::Color::get_Gold());
// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors->set_Hyperlink(System::Drawing::Color::get_Black());
colors->set_FollowedHyperlink(System::Drawing::Color::get_Gray());
doc->Save(ArtifactsDir + u"Themes.CustomColorsAndFonts.docx");

◆ get_EastAsian()

System::String Aspose::Words::Themes::ThemeFonts::get_EastAsian ( )

Specifies font name for EastAsian characters.

Examples

Shows how to set custom colors and fonts for themes.

auto doc = MakeObject<Document>(MyDir + u"Theme colors.docx");
// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
SharedPtr<Theme> theme = doc->get_Theme();
// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme->get_MajorFonts()->set_Latin(u"Courier New");
theme->get_MinorFonts()->set_Latin(u"Agency FB");
// Other languages may also have their custom fonts in this theme.
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_EastAsian());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_EastAsian());
// The "Colors" property contains the color palette from Microsoft Word,
// which appears when changing shading or font color.
// Apply custom colors to the color palette so we have easy access to them in Microsoft Word
// when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
// or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
SharedPtr<ThemeColors> colors = theme->get_Colors();
colors->set_Light2(System::Drawing::Color::get_Khaki());
colors->set_Accent3(System::Drawing::Color::get_Yellow());
colors->set_Accent4(System::Drawing::Color::get_Gold());
// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors->set_Hyperlink(System::Drawing::Color::get_Black());
colors->set_FollowedHyperlink(System::Drawing::Color::get_Gray());
doc->Save(ArtifactsDir + u"Themes.CustomColorsAndFonts.docx");

◆ get_Latin()

System::String Aspose::Words::Themes::ThemeFonts::get_Latin ( )

Specifies font name for Latin characters.

Examples

Shows how to set custom colors and fonts for themes.

auto doc = MakeObject<Document>(MyDir + u"Theme colors.docx");
// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
SharedPtr<Theme> theme = doc->get_Theme();
// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme->get_MajorFonts()->set_Latin(u"Courier New");
theme->get_MinorFonts()->set_Latin(u"Agency FB");
// Other languages may also have their custom fonts in this theme.
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MajorFonts()->get_EastAsian());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_ComplexScript());
ASSERT_EQ(String::Empty, theme->get_MinorFonts()->get_EastAsian());
// The "Colors" property contains the color palette from Microsoft Word,
// which appears when changing shading or font color.
// Apply custom colors to the color palette so we have easy access to them in Microsoft Word
// when we, for example, change the font color via "Home" -> "Font" -> "Font Color",
// or insert a shape, and then set a color for it via "Shape Format" -> "Shape Styles".
SharedPtr<ThemeColors> colors = theme->get_Colors();
colors->set_Light2(System::Drawing::Color::get_Khaki());
colors->set_Accent3(System::Drawing::Color::get_Yellow());
colors->set_Accent4(System::Drawing::Color::get_Gold());
// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors->set_Hyperlink(System::Drawing::Color::get_Black());
colors->set_FollowedHyperlink(System::Drawing::Color::get_Gray());
doc->Save(ArtifactsDir + u"Themes.CustomColorsAndFonts.docx");

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Themes::ThemeFonts::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ Is()

virtual bool Aspose::Words::Themes::ThemeFonts::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ set_ComplexScript()

void Aspose::Words::Themes::ThemeFonts::set_ComplexScript ( const System::String value)

◆ set_EastAsian()

void Aspose::Words::Themes::ThemeFonts::set_EastAsian ( const System::String value)

◆ set_Latin()

void Aspose::Words::Themes::ThemeFonts::set_Latin ( const System::String value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Themes::ThemeFonts::Type ( )
static