com.aspose.words
Class ThemeFonts

java.lang.Object
    extended by com.aspose.words.ThemeFonts
All Implemented Interfaces:
java.lang.Cloneable

public class ThemeFonts 
extends java.lang.Object

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

Example:

Shows how to set custom colors and fonts for themes.
Document doc = new Document(getMyDir() + "Theme colors.docx");

// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
Theme theme = doc.getTheme();

// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

// Other languages may also have their custom fonts in this theme.
Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// 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".
ThemeColors colors = theme.getColors();
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

Property Getters/Setters Summary
java.lang.StringgetComplexScript()
voidsetComplexScript(java.lang.String value)
           Specifies font name for ComplexScript characters.
java.lang.StringgetEastAsian()
voidsetEastAsian(java.lang.String value)
           Specifies font name for EastAsian characters.
java.lang.StringgetLatin()
voidsetLatin(java.lang.String value)
           Specifies font name for Latin characters.
 

Property Getters/Setters Detail

getComplexScript/setComplexScript

public java.lang.String getComplexScript() / public void setComplexScript(java.lang.String value)
Specifies font name for ComplexScript characters.

Example:

Shows how to set custom colors and fonts for themes.
Document doc = new Document(getMyDir() + "Theme colors.docx");

// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
Theme theme = doc.getTheme();

// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

// Other languages may also have their custom fonts in this theme.
Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// 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".
ThemeColors colors = theme.getColors();
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getEastAsian/setEastAsian

public java.lang.String getEastAsian() / public void setEastAsian(java.lang.String value)
Specifies font name for EastAsian characters.

Example:

Shows how to set custom colors and fonts for themes.
Document doc = new Document(getMyDir() + "Theme colors.docx");

// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
Theme theme = doc.getTheme();

// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

// Other languages may also have their custom fonts in this theme.
Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// 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".
ThemeColors colors = theme.getColors();
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

getLatin/setLatin

public java.lang.String getLatin() / public void setLatin(java.lang.String value)
Specifies font name for Latin characters.

Example:

Shows how to set custom colors and fonts for themes.
Document doc = new Document(getMyDir() + "Theme colors.docx");

// The "Theme" object gives us access to the document theme, a source of default fonts and colors.
Theme theme = doc.getTheme();

// Some styles, such as "Heading 1" and "Subtitle", will inherit these fonts.
theme.getMajorFonts().setLatin("Courier New");
theme.getMinorFonts().setLatin("Agency FB");

// Other languages may also have their custom fonts in this theme.
Assert.assertEquals(theme.getMajorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMajorFonts().getEastAsian(), "");
Assert.assertEquals(theme.getMinorFonts().getComplexScript(), "");
Assert.assertEquals(theme.getMinorFonts().getEastAsian(), "");

// 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".
ThemeColors colors = theme.getColors();
colors.setDark1(Color.BLUE);
colors.setLight1(Color.GREEN);
colors.setDark2(Color.MAGENTA);
colors.setLight2(Color.BLACK);

colors.setAccent1(Color.RED);
colors.setAccent2(Color.PINK);
colors.setAccent3(Color.YELLOW);
colors.setAccent4(Color.orange);
colors.setAccent5(Color.cyan);
colors.setAccent6(Color.darkGray);

// Apply custom colors to hyperlinks in their clicked and un-clicked states.
colors.setHyperlink(Color.WHITE);
colors.setFollowedHyperlink(Color.lightGray);

doc.save(getArtifactsDir() + "Themes.CustomColorsAndFonts.docx");

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.