com.aspose.words
Class FontFamily

java.lang.Object
    extended by com.aspose.words.FontFamily

public class FontFamily 
extends java.lang.Object

Utility class containing constants. Represents the font family.

A font family is a set of fonts having common stroke width and serif characteristics.

Example:

Shows how to get information about each font in a document.
Document doc = new Document(getMyDir() + "Font.Embedded.docx");

// We can iterate over all the fonts with an enumerator
Iterator<FontInfo> fontCollectionEnumerator = doc.getFontInfos().iterator();
// Print detailed information about each font to the console
while (fontCollectionEnumerator.hasNext()) {
    FontInfo fontInfo = fontCollectionEnumerator.next();
    if (fontInfo != null) {
        System.out.println("Font name: " + fontInfo.getName());
        System.out.println("Alt name: " + fontInfo.getAltName()); // Alt names are usually blank
        System.out.println("\t- Family: " + fontInfo.getFamily());
        System.out.println("\t- " + (fontInfo.isTrueType() ? "Is TrueType" : "Is not TrueType"));
        System.out.println("\t- Pitch: " + fontInfo.getPitch());
        System.out.println("\t- Charset: " + fontInfo.getCharset());
        System.out.println("\t- Panose:");
        System.out.println("\t\tFamily Kind: " + (fontInfo.getPanose()[0] & 0xFF));
        System.out.println("\t\tSerif Style: " + (fontInfo.getPanose()[1] & 0xFF));
        System.out.println("\t\tWeight: " + (fontInfo.getPanose()[2] & 0xFF));
        System.out.println("\t\tProportion: " + (fontInfo.getPanose()[3] & 0xFF));
        System.out.println("\t\tContrast: " + (fontInfo.getPanose()[4] & 0xFF));
        System.out.println("\t\tStroke Variation: " + (fontInfo.getPanose()[5] & 0xFF));
        System.out.println("\t\tArm Style: " + (fontInfo.getPanose()[6] & 0xFF));
        System.out.println("\t\tLetterform: " + (fontInfo.getPanose()[7] & 0xFF));
        System.out.println("\t\tMidline: " + (fontInfo.getPanose()[8] & 0xFF));
        System.out.println("\t\tX-Height: " + (fontInfo.getPanose()[9] & 0xFF));
    }
}

Field Summary
static final intAUTO = 0
           Specifies a generic family name. This name is used when information about a font does not exist or does not matter. The default font is used.
static final intROMAN = 1
           Specifies a proportional font with serifs. An example is Times New Roman.
static final intSWISS = 2
           Specifies a proportional font without serifs. An example is Arial.
static final intMODERN = 3
           Specifies a monospace font with or without serifs. Monospace fonts are usually modern; examples include Pica, Elite, and Courier New.
static final intSCRIPT = 4
           Specifies a font that is designed to look like handwriting; examples include Script and Cursive.
static final intDECORATIVE = 5
           Specifies a novelty font. An example is Old English.
 

Field Detail

AUTO = 0

public static final int AUTO
Specifies a generic family name. This name is used when information about a font does not exist or does not matter. The default font is used.

ROMAN = 1

public static final int ROMAN
Specifies a proportional font with serifs. An example is Times New Roman.

SWISS = 2

public static final int SWISS
Specifies a proportional font without serifs. An example is Arial.

MODERN = 3

public static final int MODERN
Specifies a monospace font with or without serifs. Monospace fonts are usually modern; examples include Pica, Elite, and Courier New.

SCRIPT = 4

public static final int SCRIPT
Specifies a font that is designed to look like handwriting; examples include Script and Cursive.

DECORATIVE = 5

public static final int DECORATIVE
Specifies a novelty font. An example is Old English.

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