ThemeFonts Class

Represents a collection of fonts in the font scheme, allowing to specify different fonts for different languages Latin, EastAsian and ComplexScript.
Inheritance Hierarchy
SystemObject
  Aspose.Words.ThemesThemeFonts

Namespace:  Aspose.Words.Themes
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public class ThemeFonts

The ThemeFonts type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleComplexScript
Specifies font name for ComplexScript characters.
Public propertyCode exampleEastAsian
Specifies font name for EastAsian characters.
Public propertyCode exampleLatin
Specifies font name for Latin characters.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to set custom theme colors and fonts.
Document doc = new Document(MyDir + "Theme colors.docx");

// This object gives us access to the document theme, which is a source of default fonts and colors
Theme theme = doc.Theme;

// These fonts will be inherited by some styles like "Heading 1" and "Subtitle"
theme.MajorFonts.Latin = "Courier New";
theme.MinorFonts.Latin = "Agency FB";

Assert.AreEqual(string.Empty, theme.MajorFonts.ComplexScript);
Assert.AreEqual(string.Empty, theme.MajorFonts.EastAsian);
Assert.AreEqual(string.Empty, theme.MinorFonts.ComplexScript);
Assert.AreEqual(string.Empty, theme.MinorFonts.EastAsian);

// This collection of colors corresponds to the color palette from Microsoft Word which appears when changing shading or font color 
ThemeColors colors = theme.Colors;

// We will set the color of each color palette column going from left to right like this
colors.Dark1 = Color.MidnightBlue;
colors.Light1 = Color.PaleGreen;
colors.Dark2 = Color.Indigo;
colors.Light2 = Color.Khaki;

colors.Accent1 = Color.OrangeRed;
colors.Accent2 = Color.LightSalmon;
colors.Accent3 = Color.Yellow;
colors.Accent4 = Color.Gold;
colors.Accent5 = Color.BlueViolet;
colors.Accent6 = Color.DarkViolet;

// We can also set colors for hyperlinks like this
colors.Hyperlink = Color.Black;
colors.FollowedHyperlink = Color.Gray;

doc.Save(ArtifactsDir + "Themes.CustomColorsAndFonts.docx");
See Also