Java Code Examples for java.awt.Font#toString()

The following examples show how to use java.awt.Font#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test7022041.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 2
Source File: Test7022041.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 3
Source File: Test7022041.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 4
Source File: LabelMapLayer.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets an image of the label from cache or creates one if it doesn't exist.
 * @param label the label string.
 * @param font the font to use.
 * @param fontRenderContext the font render context to use.
 * @param labelColor the color of the label.
 * @param labelOutlineColor the color of the outline of the label.
 * @return buffered image of label.
 */
private BufferedImage getLabelImage(
	String label, Font font, FontRenderContext fontRenderContext, Color labelColor,
	Color labelOutlineColor
) {
	BufferedImage labelImage = null;
	String labelId = label + font.toString() + labelColor.toString() + labelOutlineColor.toString();
	if (labelImageCache.containsKey(labelId)) {
		labelImage = labelImageCache.get(labelId);
	} else {
		labelImage = createLabelImage(label, font, fontRenderContext, labelColor, labelOutlineColor);
		labelImageCache.put(labelId, labelImage);
	}
	return labelImage;
}
 
Example 5
Source File: Test7022041.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 6
Source File: Test7022041.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 7
Source File: Test7022041.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 8
Source File: Test7022041.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 9
Source File: Test7022041.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 10
Source File: Test7022041.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 11
Source File: Test7022041.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 12
Source File: Test7022041.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 13
Source File: Test7022041.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 14
Source File: Test7022041.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 15
Source File: MaxAdvanceIsMax.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    GraphicsEnvironment e =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font[] fonts = e.getAllFonts();
    BufferedImage bi = new BufferedImage(500, 500,
            BufferedImage.TYPE_INT_RGB);
    for (AntialiasHint antialiasHint : antialiasHints) {
        for (Font f : fonts) {
            for (StyleAndSize styleAndSize : stylesAndSizes) {
                f = f.deriveFont(styleAndSize.style, styleAndSize.size);
                Graphics2D g2d = bi.createGraphics();
                g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        antialiasHint.getHint());
                FontMetrics fm = g2d.getFontMetrics(f);
                int[] width;
                int maxWidth = -1;
                int maxAdvance = fm.getMaxAdvance();
                if (debug) {
                    System.out.println("Testing " + f + " in " +
                            antialiasHint);
                    System.out.println("getMaxAdvance: " + maxAdvance);
                }
                if (maxAdvance != -1) {
                    String failureMessage = null;
                    width = fm.getWidths();
                    for (int j = 0; j < width.length; j++) {
                        if (width[j] > maxWidth) {
                            maxWidth = width[j];
                        }
                        if (width[j] > maxAdvance) {
                            failureMessage = "FAILED: getMaxAdvance is " +
                                             "not max for font: " +
                                             f.toString() +
                                             " getMaxAdvance(): " +
                                             maxAdvance +
                                             " getWidths()[" + j + "]: " +
                                             width[j];
                            throw new Exception(failureMessage);
                        }
                    }
                }
                if (debug) {
                    System.out.println("Max char width: " + maxWidth);
                    System.out.println("PASSED");
                    System.out.println(".........................");
                }
            }
        }
    }
    System.out.println("TEST PASS - OK");
}
 
Example 16
Source File: MaxAdvanceIsMax.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    GraphicsEnvironment e =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font[] fonts = e.getAllFonts();
    BufferedImage bi = new BufferedImage(500, 500,
            BufferedImage.TYPE_INT_RGB);
    for (AntialiasHint antialiasHint : antialiasHints) {
        for (Font f : fonts) {
            for (StyleAndSize styleAndSize : stylesAndSizes) {
                f = f.deriveFont(styleAndSize.style, styleAndSize.size);
                Graphics2D g2d = bi.createGraphics();
                g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        antialiasHint.getHint());
                FontMetrics fm = g2d.getFontMetrics(f);
                int[] width;
                int maxWidth = -1;
                int maxAdvance = fm.getMaxAdvance();
                if (debug) {
                    System.out.println("Testing " + f + " in " +
                            antialiasHint);
                    System.out.println("getMaxAdvance: " + maxAdvance);
                }
                if (maxAdvance != -1) {
                    String failureMessage = null;
                    width = fm.getWidths();
                    for (int j = 0; j < width.length; j++) {
                        if (width[j] > maxWidth) {
                            maxWidth = width[j];
                        }
                        if (width[j] > maxAdvance) {
                            failureMessage = "FAILED: getMaxAdvance is " +
                                             "not max for font: " +
                                             f.toString() +
                                             " getMaxAdvance(): " +
                                             maxAdvance +
                                             " getWidths()[" + j + "]: " +
                                             width[j];
                            throw new Exception(failureMessage);
                        }
                    }
                }
                if (debug) {
                    System.out.println("Max char width: " + maxWidth);
                    System.out.println("PASSED");
                    System.out.println(".........................");
                }
            }
        }
    }
    System.out.println("TEST PASS - OK");
}
 
Example 17
Source File: MaxAdvanceIsMax.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    GraphicsEnvironment e =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font[] fonts = e.getAllFonts();
    BufferedImage bi = new BufferedImage(500, 500,
            BufferedImage.TYPE_INT_RGB);
    for (AntialiasHint antialiasHint : antialiasHints) {
        for (Font f : fonts) {
            for (StyleAndSize styleAndSize : stylesAndSizes) {
                f = f.deriveFont(styleAndSize.style, styleAndSize.size);
                Graphics2D g2d = bi.createGraphics();
                g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        antialiasHint.getHint());
                FontMetrics fm = g2d.getFontMetrics(f);
                int[] width;
                int maxWidth = -1;
                int maxAdvance = fm.getMaxAdvance();
                if (debug) {
                    System.out.println("Testing " + f + " in " +
                            antialiasHint);
                    System.out.println("getMaxAdvance: " + maxAdvance);
                }
                if (maxAdvance != -1) {
                    String failureMessage = null;
                    width = fm.getWidths();
                    for (int j = 0; j < width.length; j++) {
                        if (width[j] > maxWidth) {
                            maxWidth = width[j];
                        }
                        if (width[j] > maxAdvance) {
                            failureMessage = "FAILED: getMaxAdvance is " +
                                             "not max for font: " +
                                             f.toString() +
                                             " getMaxAdvance(): " +
                                             maxAdvance +
                                             " getWidths()[" + j + "]: " +
                                             width[j];
                            throw new Exception(failureMessage);
                        }
                    }
                }
                if (debug) {
                    System.out.println("Max char width: " + maxWidth);
                    System.out.println("PASSED");
                    System.out.println(".........................");
                }
            }
        }
    }
    System.out.println("TEST PASS - OK");
}