Mercurial > hg > openjdk > icedtea > jdk7 > jdk
changeset 5444:3269bd0c4714
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:45:10 -0700 |
parents | d69bfcf16e6d |
children | 52c5a1917b6b |
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 26 19:48:11 2012 +0400 +++ b/src/macosx/classes/sun/awt/CGraphicsEnvironment.java Tue Jun 26 09:45:10 2012 -0700 @@ -194,29 +194,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; } }