Mercurial > hg > icedtea9-forest > jdk
changeset 5757:9881db0a65bf
7145771: [macosx] CreateFont/Register.java test fails because of cached results of getAllFonts()
Reviewed-by: igor, flar
author | prr |
---|---|
date | Tue, 26 Jun 2012 09:38:25 -0700 |
parents | b8ff85860648 |
children | c689cc1ef29a |
files | src/macosx/classes/sun/awt/CGraphicsEnvironment.java |
diffstat | 1 files changed, 11 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Tue Jun 19 09:07:31 2012 -0700 +++ b/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Tue Jun 26 09:38:25 2012 -0700 @@ -200,29 +200,25 @@ return true; } - private Font[] allFontsWithLogical; static String[] sLogicalFonts = { "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" }; @Override public Font[] getAllFonts() { - if (allFontsWithLogical == null) - { - Font[] newFonts; - Font[] superFonts = super.getAllFonts(); - int numLogical = sLogicalFonts.length; - int numOtherFonts = superFonts.length; + Font[] newFonts; + Font[] superFonts = super.getAllFonts(); + + int numLogical = sLogicalFonts.length; + int numOtherFonts = superFonts.length; - newFonts = new Font[numOtherFonts + numLogical]; - System.arraycopy(superFonts,0,newFonts,numLogical,numOtherFonts); + newFonts = new Font[numOtherFonts + numLogical]; + System.arraycopy(superFonts,0,newFonts,numLogical,numOtherFonts); - for (int i = 0; i < numLogical; i++) - { - newFonts[i] = new Font(sLogicalFonts[i], Font.PLAIN, 1); - } - allFontsWithLogical = newFonts; + for (int i = 0; i < numLogical; i++) + { + newFonts[i] = new Font(sLogicalFonts[i], Font.PLAIN, 1); } - return java.util.Arrays.copyOf(allFontsWithLogical, allFontsWithLogical.length); + return newFonts; } }