com.aspose.words

Class FontPitch

  • java.lang.Object
    • com.aspose.words.FontPitch
public class FontPitch 
extends java.lang.Object

Utility class containing constants. Represents the font pitch.
The pitch indicates if the font is fixed pitch, proportionally spaced, or relies on a default setting.

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 intDEFAULT = 0
Specifies that no information is available about the pitch of a font.
static final intFIXED = 1
Specifies that this is a fixed width font.
static final intVARIABLE = 2
Specifies that this is a proportional width font.
 

    • Field Detail

      • DEFAULT = 0

        public static final int DEFAULT
        Specifies that no information is available about the pitch of a font.
      • FIXED = 1

        public static final int FIXED
        Specifies that this is a fixed width font.
      • VARIABLE = 2

        public static final int VARIABLE
        Specifies that this is a proportional width font.