Skip to content
Permalink
Browse files
8198336: java/awt/FontMetrics/FontCrash.java fails in headless mode
Reviewed-by: serb
  • Loading branch information
prrace committed Oct 22, 2021
1 parent 88bbf3c commit 6523c558d92dedf350576126960dee6cff8f6067
Showing 5 changed files with 0 additions and 98 deletions.
@@ -3177,17 +3177,6 @@ final Graphics getGraphics_NoClientCode() {
* @since 1.0
*/
public FontMetrics getFontMetrics(Font font) {
// This is an unsupported hack, but left in for a customer.
// Do not remove.
FontManager fm = FontManagerFactory.getInstance();
if (fm instanceof SunFontManager
&& ((SunFontManager) fm).usePlatformFontMetrics()) {

if (peer != null &&
!(peer instanceof LightweightPeer)) {
return peer.getFontMetrics(font);
}
}
return sun.font.FontDesignMetrics.getMetrics(font);
}

@@ -230,12 +230,6 @@ public boolean accept(File dir, String name) {
/* Used to indicate required return type from toArray(..); */
private static String[] STR_ARRAY = new String[0];

/**
* Deprecated, unsupported hack - actually invokes a bug!
* Left in for a customer, don't remove.
*/
private boolean usePlatformFontMetrics = false;

/**
* Returns the global SunFontManager instance. This is similar to
* {@link FontManagerFactory#getInstance()} but it returns a
@@ -454,22 +448,6 @@ public Void run() {
}
});

boolean platformFont = AccessController.doPrivileged(
new PrivilegedAction<Boolean>() {
public Boolean run() {
String prop = System.getProperty("java2d.font.usePlatformFont");
String env = System.getenv("JAVA2D_USEPLATFORMFONT");
return "true".equals(prop) || env != null;
}
});

if (platformFont) {
usePlatformFontMetrics = true;
System.out.println("Enabling platform font metrics for win32. This is an unsupported option.");
System.out.println("This yields incorrect composite font metrics as reported by 1.1.x releases.");
System.out.println("It is appropriate only for use by applications which do not use any Java 2");
System.out.println("functionality. This property will be removed in a later release.");
}
}

public Font2DHandle getNewComposite(String family, int style,
@@ -2188,15 +2166,6 @@ public Font2D findFont2D(String name, int style, int fallback) {
}
}

/*
* Workaround for apps which are dependent on a font metrics bug
* in JDK 1.1. This is an unsupported win32 private setting.
* Left in for a customer - do not remove.
*/
public boolean usePlatformFontMetrics() {
return usePlatformFontMetrics;
}

public int getNumFonts() {
return physicalFonts.size()+maxCompFont;
}
@@ -684,19 +684,6 @@ public int getScreenResolution() {

private native Insets getScreenInsets(int screen);


@Override
public FontMetrics getFontMetrics(Font font) {
// This is an unsupported hack, but left in for a customer.
// Do not remove.
FontManager fm = FontManagerFactory.getInstance();
if (fm instanceof SunFontManager
&& ((SunFontManager) fm).usePlatformFontMetrics()) {
return WFontMetrics.getFontMetrics(font);
}
return super.getFontMetrics(font);
}

@Override
public FontPeer getFontPeer(String name, int style) {
FontPeer retval = null;
@@ -237,7 +237,6 @@ java/awt/Window/AlwaysOnTop/AutoTestOnTop.java 6847593 linux-all
java/awt/Window/GrabSequence/GrabSequence.java 6848409 macosx-all,linux-all
java/awt/Window/LocationAtScreenCorner/LocationAtScreenCorner.java 8203371 linux-all
java/awt/font/TextLayout/TextLayoutBounds.java 8169188 generic-all
java/awt/FontMetrics/FontCrash.java 8198336 windows-all
java/awt/image/BufferedImage/ICMColorDataTest/ICMColorDataTest.java 8233028 generic-all
java/awt/image/DrawImage/IncorrectAlphaSurface2SW.java 8056077 linux-all
java/awt/image/multiresolution/MultiresolutionIconTest.java 8169187,8252812 macosx-all,windows-all,linux-x64

This file was deleted.

1 comment on commit 6523c55

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 6523c55 Oct 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.