diff --git a/src/java.desktop/macosx/classes/sun/font/CFontManager.java b/src/java.desktop/macosx/classes/sun/font/CFontManager.java index 5c2afd718ed..8c41efffe9c 100644 --- a/src/java.desktop/macosx/classes/sun/font/CFontManager.java +++ b/src/java.desktop/macosx/classes/sun/font/CFontManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,8 +96,8 @@ public Font2D registerGenericFont(Font2D f, boolean logicalFont) // already existing fonts in this list if (logicalFont || !genericFonts.containsKey(fontName)) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().info("Add to Family "+familyName + - ", Font " + fontName + " rank="+rank); + FontUtilities.logInfo("Add to Family " + familyName + + ", Font " + fontName + " rank=" + rank); } FontFamily family = FontFamily.getFamily(familyName); if (family == null) { diff --git a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java index b1e92350e19..efcecb5df89 100644 --- a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java +++ b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java @@ -83,8 +83,7 @@ public abstract class FontConfiguration { */ public FontConfiguration(SunFontManager fm) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .info("Creating standard Font Configuration"); + FontUtilities.logInfo("Creating standard Font Configuration"); } if (FontUtilities.debugFonts() && logger == null) { logger = PlatformLogger.getLogger("sun.awt.FontConfiguration"); @@ -116,8 +115,7 @@ public FontConfiguration(SunFontManager fm, boolean preferPropFonts) { fontManager = fm; if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .info("Creating alternate Font Configuration"); + FontUtilities.logInfo("Creating alternate Font Configuration"); } this.preferLocaleFonts = preferLocaleFonts; this.preferPropFonts = preferPropFonts; diff --git a/src/java.desktop/share/classes/sun/font/CMap.java b/src/java.desktop/share/classes/sun/font/CMap.java index 4efa952d4e7..a2488d82d67 100644 --- a/src/java.desktop/share/classes/sun/font/CMap.java +++ b/src/java.desktop/share/classes/sun/font/CMap.java @@ -400,10 +400,8 @@ static CMap createCMap(ByteBuffer buffer, int offset, char[] xlat) { } else { subtableLength = buffer.getInt(offset+4) & INTMASK; } - if (offset+subtableLength > buffer.capacity()) { - if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning("Cmap subtable overflows buffer."); - } + if (FontUtilities.isLogging() && offset + subtableLength > buffer.capacity()) { + FontUtilities.logWarning("Cmap subtable overflows buffer."); } switch (subtableFormat) { case 0: return new CMapFormat0(buffer, offset); @@ -422,11 +420,8 @@ private void createUVS(ByteBuffer buffer, int offset) { int subtableFormat = buffer.getChar(offset); if (subtableFormat == 14) { long subtableLength = buffer.getInt(offset + 2) & INTMASK; - if (offset + subtableLength > buffer.capacity()) { - if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .warning("Cmap UVS subtable overflows buffer."); - } + if (FontUtilities.isLogging() && offset + subtableLength > buffer.capacity()) { + FontUtilities.logWarning("Cmap UVS subtable overflows buffer."); } try { this.uvs = new UVS(buffer, offset); diff --git a/src/java.desktop/share/classes/sun/font/FileFontStrike.java b/src/java.desktop/share/classes/sun/font/FileFontStrike.java index 6ce82fa675a..ea2a1608f2d 100644 --- a/src/java.desktop/share/classes/sun/font/FileFontStrike.java +++ b/src/java.desktop/share/classes/sun/font/FileFontStrike.java @@ -223,8 +223,7 @@ public class FileFontStrike extends PhysicalStrike { useNatives = true; } if (FontUtilities.isLogging() && FontUtilities.isWindows) { - FontUtilities.getLogger().info - ("Strike for " + fileFont + " at size = " + intPtSize + + FontUtilities.logInfo("Strike for " + fileFont + " at size = " + intPtSize + " use natives = " + useNatives + " useJavaRasteriser = " + fileFont.useJavaRasterizer + " AAHint = " + desc.aaHint + @@ -319,10 +318,9 @@ long getGlyphImageFromWindows(int glyphCode) { return ptr; } else { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning( - "Failed to render glyph using GDI: code=" + glyphCode - + ", fontFamily=" + family + ", style=" + style - + ", size=" + size); + FontUtilities.logWarning("Failed to render glyph using GDI: code=" + glyphCode + + ", fontFamily=" + family + ", style=" + style + + ", size=" + size); } return fileFont.getGlyphImage(pScalerContext, glyphCode); } @@ -356,14 +354,13 @@ long getGlyphImagePtr(int glyphCode) { if (useNatives) { glyphPtr = getGlyphImageFromNative(glyphCode); if (glyphPtr == 0L && FontUtilities.isLogging()) { - FontUtilities.getLogger().info - ("Strike for " + fileFont + + FontUtilities.logInfo("Strike for " + fileFont + " at size = " + intPtSize + " couldn't get native glyph for code = " + glyphCode); - } - } if (glyphPtr == 0L) { - glyphPtr = fileFont.getGlyphImage(pScalerContext, - glyphCode); + } + } + if (glyphPtr == 0L) { + glyphPtr = fileFont.getGlyphImage(pScalerContext, glyphCode); } return setCachedGlyphPtr(glyphCode, glyphPtr); } diff --git a/src/java.desktop/share/classes/sun/font/FontFamily.java b/src/java.desktop/share/classes/sun/font/FontFamily.java index 16d1d41dd7b..dcec9545dfe 100644 --- a/src/java.desktop/share/classes/sun/font/FontFamily.java +++ b/src/java.desktop/share/classes/sun/font/FontFamily.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -181,7 +181,7 @@ private boolean preferredWidth(Font2D font) { Math.abs(Font2D.FWIDTH_NORMAL - familyWidth)) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().info( + FontUtilities.logInfo( "Found more preferred width. New width = " + newWidth + " Old width = " + familyWidth + " in font " + font + " nulling out fonts plain: " + plain + " bold: " + bold + @@ -191,7 +191,7 @@ private boolean preferredWidth(Font2D font) { plain = bold = italic = bolditalic = null; return true; } else if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().info( + FontUtilities.logInfo( "Family rejecting font " + font + " of less preferred width " + newWidth); } @@ -208,7 +208,7 @@ private boolean closerWeight(Font2D currFont, Font2D font, int style) { } if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().info( + FontUtilities.logInfo( "New weight for style " + style + ". Curr.font=" + currFont + " New font="+font+" Curr.weight="+ + currFont.getWeight()+ " New weight="+font.getWeight()); @@ -242,18 +242,17 @@ public void setFont(Font2D font, int style) { msg = "Request to add " + font + " with style " + style + " to family " + this; } - FontUtilities.getLogger().info(msg); + FontUtilities.logInfo(msg); } /* Allow a lower-rank font only if its a file font * from the exact same source as any previous font. */ if ((font.getRank() > familyRank) && !isFromSameSource(font)) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .warning("Rejecting adding " + font + - " of lower rank " + font.getRank() + - " to family " + this + - " of rank " + familyRank); + FontUtilities.logWarning("Rejecting adding " + font + + " of lower rank " + font.getRank() + + " to family " + this + + " of rank " + familyRank); } return; } diff --git a/src/java.desktop/share/classes/sun/font/FontUtilities.java b/src/java.desktop/share/classes/sun/font/FontUtilities.java index b0770220da5..fa384a0c038 100644 --- a/src/java.desktop/share/classes/sun/font/FontUtilities.java +++ b/src/java.desktop/share/classes/sun/font/FontUtilities.java @@ -26,10 +26,6 @@ package sun.font; import java.awt.Font; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; import java.lang.ref.SoftReference; import java.util.concurrent.ConcurrentHashMap; import java.security.AccessController; @@ -112,10 +108,6 @@ public Object run() { } else if (debugLevel.equals("severe")) { logger.setLevel(PlatformLogger.Level.SEVERE); } - } - - if (debugFonts) { - logger = PlatformLogger.getLogger("sun.java2d"); logging = logger.isEnabled(); } @@ -324,6 +316,17 @@ public static boolean debugFonts() { return debugFonts; } + public static void logWarning(String s) { + getLogger().warning(s); + } + + public static void logInfo(String s) { + getLogger().info(s); + } + + public static void logSevere(String s) { + getLogger().severe(s); + } // The following methods are used by Swing. diff --git a/src/java.desktop/share/classes/sun/font/GlyphLayout.java b/src/java.desktop/share/classes/sun/font/GlyphLayout.java index 01a3f9fe9e0..2b40ec914fc 100644 --- a/src/java.desktop/share/classes/sun/font/GlyphLayout.java +++ b/src/java.desktop/share/classes/sun/font/GlyphLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -478,8 +478,7 @@ public StandardGlyphVector layout(Font font, FontRenderContext frc, if (_gvdata._count < 0) { gv = new StandardGlyphVector(font, text, offset, count, frc); if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().warning("OpenType layout failed on font: " + - font); + FontUtilities.logWarning("OpenType layout failed on font: " + font); } } else { gv = _gvdata.createGlyphVector(font, frc, result); diff --git a/src/java.desktop/share/classes/sun/font/SunFontManager.java b/src/java.desktop/share/classes/sun/font/SunFontManager.java index 94552645a30..40bc03439c7 100644 --- a/src/java.desktop/share/classes/sun/font/SunFontManager.java +++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java @@ -320,7 +320,7 @@ public Void run() { break; } else { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().warning("read bad font: " + name); + FontUtilities.logWarning("read bad font: " + name); } badFonts.add(name); } @@ -354,7 +354,7 @@ public Void run() { String[] fontInfo = getDefaultPlatformFont(); defaultFontName = fontInfo[0]; if (defaultFontName == null && FontUtilities.debugFonts()) { - FontUtilities.getLogger().warning("defaultFontName is null"); + FontUtilities.logWarning("defaultFontName is null"); } defaultFontFileName = fontInfo[1]; @@ -403,10 +403,9 @@ public Void run() { } if (FontUtilities.debugFonts()) { - PlatformLogger logger = FontUtilities.getLogger(); - logger.info("JRE font directory: " + jreFontDirName); - logger.info("Extra font path: " + extraFontPath); - logger.info("Debug font path: " + dbgFontPath); + FontUtilities.logInfo("JRE font directory: " + jreFontDirName); + FontUtilities.logInfo("Extra font path: " + extraFontPath); + FontUtilities.logInfo("Debug font path: " + dbgFontPath); } if (dbgFontPath != null) { @@ -562,10 +561,9 @@ protected static void registerCompositeFont(String compositeName, } private void addCompositeToFontList(CompositeFont f, int rank) { - if (FontUtilities.isLogging()) { - FontUtilities.getLogger().info("Add to Family "+ f.familyName + - ", Font " + f.fullName + " rank="+rank); + FontUtilities.logInfo("Add to Family " + f.familyName + + ", Font " + f.fullName + " rank=" + rank); } f.setRank(rank); compositeFonts.put(f.fullName, f); @@ -625,8 +623,8 @@ protected PhysicalFont addToFontList(PhysicalFont f, int rank) { f.setRank(rank); if (!physicalFonts.containsKey(fontName)) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().info("Add to Family "+familyName + - ", Font " + fontName + " rank="+rank); + FontUtilities.logInfo("Add to Family " + familyName + + ", Font " + fontName + " rank=" + rank); } physicalFonts.put(fontName, f); FontFamily family = FontFamily.getFamily(familyName); @@ -699,21 +697,18 @@ protected PhysicalFont addToFontList(PhysicalFont f, int rank) { */ if (oldFont.platName.startsWith(jreFontDirName)) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .warning("Unexpected attempt to replace a JRE " + - " font " + fontName + " from " + - oldFont.platName + + FontUtilities.logWarning("Unexpected attempt to replace a JRE " + + " font " + fontName + " from " + oldFont.platName + " with " + newFont.platName); } return oldFont; } if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Replace in Family " + familyName + - ",Font " + fontName + " new rank="+rank + - " from " + oldFont.platName + - " with " + newFont.platName); + FontUtilities.logInfo("Replace in Family " + familyName + + ",Font " + fontName + " new rank="+rank + + " from " + oldFont.platName + + " with " + newFont.platName); } replaceFont(oldFont, newFont); physicalFonts.put(fontName, newFont); @@ -903,8 +898,7 @@ PhysicalFont initialiseDeferredFont(String fileNameKey) { return null; } if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Opening deferred font file " + fileNameKey); + FontUtilities.logInfo("Opening deferred font file " + fileNameKey); } PhysicalFont physicalFont = null; @@ -991,14 +985,12 @@ public PhysicalFont registerFontFile(String fileName, } if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Registered file " + fileName + " as font " + - physicalFont + " rank=" + fontRank); + FontUtilities.logInfo("Registered file " + fileName + " as font " + + physicalFont + " rank=" + fontRank); } } catch (FontFormatException ffe) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning("Unusable font: " + - fileName + " " + ffe.toString()); + FontUtilities.logInfo("Unusable font: " + fileName + " " + ffe.toString()); } } if (physicalFont != null && @@ -1042,8 +1034,7 @@ public PhysicalFont getDefaultPhysicalFont() { defaultPhysicalFont = (PhysicalFont)font2d; } else { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .warning("Font returned by findFont2D for default font name " + + FontUtilities.logWarning("Font returned by findFont2D for default font name " + defaultFontName + " is not a physical font: " + font2d.getFontName(null)); } } @@ -1304,8 +1295,7 @@ private void resolveWindowsFonts() { } fontToFamilyNameMap.remove(name); if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("No file for font:" + name); + FontUtilities.logInfo("No file for font:" + name); } } } @@ -1355,8 +1345,7 @@ private synchronized void checkForUnreferencedFontFiles() { for (String pathFile : getFontFilesFromPath(false)) { if (!registryFiles.contains(pathFile)) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Found non-registry file : " + pathFile); + FontUtilities.logInfo("Found non-registry file : " + pathFile); } PhysicalFont f = registerFontFile(getPathName(pathFile)); if (f == null) { @@ -1400,8 +1389,7 @@ private void resolveFontFiles(HashSet unmappedFiles, TrueTypeFont ttf; String fullPath = getPathName(file); if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Trying to resolve file " + fullPath); + FontUtilities.logInfo("Trying to resolve file " + fullPath); } do { ttf = new TrueTypeFont(fullPath, null, fn++, false); @@ -1411,9 +1399,8 @@ private void resolveFontFiles(HashSet unmappedFiles, fontToFileMap.put(fontName, file); unmappedFonts.remove(fontName); if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Resolved absent registry entry for " + - fontName + " located in " + fullPath); + FontUtilities.logInfo("Resolved absent registry entry for " + + fontName + " located in " + fullPath); } } } @@ -1538,8 +1525,7 @@ Font2D findFontFromPlatformMap(String lcName, int style) { if (failure) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger(). - info("Hardcoded file missing looking for " + lcName); + FontUtilities.logInfo("Hardcoded file missing looking for " + lcName); } platformFontMap.remove(firstWord); return null; @@ -1566,8 +1552,7 @@ public Boolean run() { if (failure) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger(). - info("Hardcoded file missing looking for " + lcName); + FontUtilities.logInfo("Hardcoded file missing looking for " + lcName); } platformFontMap.remove(firstWord); return null; @@ -1834,9 +1819,8 @@ private Font2D findFontFromPlatform(String lcName, int style) { String fileName = fontToFileMap.get(fontNameLC); if (fileName == null) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Platform lookup : No file for font " + - fontList[f] + " in family " +familyName); + FontUtilities.logInfo("Platform lookup : No file for font " + + fontList[f] + " in family " +familyName); } return null; } @@ -1905,9 +1889,8 @@ public Font2D findFont2D(String name, int style, int fallback) { if (font != null) { return font; } - if (FontUtilities.isLogging()) { - FontUtilities.getLogger().info("Search for font: " + name); + FontUtilities.logInfo("Search for font: " + name); } // The check below is just so that the bitmap fonts being set by @@ -2021,9 +2004,9 @@ public Font2D findFont2D(String name, int style, int fallback) { font = findFontFromPlatformMap(lowerCaseName, style); if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("findFontFromPlatformMap returned " + font); + FontUtilities.logInfo("findFontFromPlatformMap returned " + font); } + if (font != null) { fontNameCache.put(mapName, font); return font; @@ -2042,10 +2025,9 @@ public Font2D findFont2D(String name, int style, int fallback) { font = findFontFromPlatform(lowerCaseName, style); if (font != null) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Found font via platform API for request:\"" + - name + "\":, style="+style+ - " found font: " + font); + FontUtilities.logInfo("Found font via platform API for request:\"" + + name + "\":, style="+style+ + " found font: " + font); } fontNameCache.put(mapName, font); return font; @@ -2116,8 +2098,7 @@ public Font2D findFont2D(String name, int style, int fallback) { */ if (!loadedAllFonts) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Load fonts looking for:" + name); + FontUtilities.logInfo("Load fonts looking for:" + name); } loadFonts(); loadedAllFonts = true; @@ -2126,8 +2107,7 @@ public Font2D findFont2D(String name, int style, int fallback) { if (!loadedAllFontFiles) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Load font files looking for:" + name); + FontUtilities.logInfo("Load font files looking for:" + name); } loadFontFiles(); loadedAllFontFiles = true; @@ -2185,9 +2165,8 @@ public Font2D findFont2D(String name, int style, int fallback) { fontNameCache.put(mapName, font); return font; } - if (FontUtilities.isLogging()) { - FontUtilities.getLogger().info("No font found for:" + name); + FontUtilities.logInfo("No font found for:" + name); } switch (fallback) { @@ -2362,8 +2341,7 @@ public synchronized void deRegisterBadFont(Font2D font2D) { return; } else { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .severe("Deregister bad font: " + font2D); + FontUtilities.logSevere("Deregister bad font: " + font2D); } replaceFont((PhysicalFont)font2D, getDefaultPhysicalFont()); } @@ -2386,8 +2364,7 @@ public synchronized void replaceFont(PhysicalFont oldFont, */ if (oldFont == newFont) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .severe("Can't replace bad font with itself " + oldFont); + FontUtilities.logSevere("Can't replace bad font with itself " + oldFont); } PhysicalFont[] physFonts = getPhysicalFonts(); for (int i=0; i() { public Void run() { @@ -3133,10 +3106,8 @@ public Void run() { private void initCompositeFonts(FontConfiguration fontConfig, ConcurrentHashMap altNameCache) { - if (FontUtilities.isLogging()) { - FontUtilities.getLogger() - .info("Initialising composite fonts"); + FontUtilities.logInfo("Initialising composite fonts"); } int numCoreFonts = fontConfig.getNumberCoreFonts(); @@ -3236,8 +3207,7 @@ public Void run() { true); } if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .info("registered " + descriptor.getFaceName()); + FontUtilities.logInfo("registered " + descriptor.getFaceName()); } } } diff --git a/src/java.desktop/share/classes/sun/font/TrueTypeFont.java b/src/java.desktop/share/classes/sun/font/TrueTypeFont.java index 174ceab94a3..ff1a7d0aabb 100644 --- a/src/java.desktop/share/classes/sun/font/TrueTypeFont.java +++ b/src/java.desktop/share/classes/sun/font/TrueTypeFont.java @@ -244,7 +244,7 @@ private synchronized FileChannel open(boolean usePool) throws FontFormatException { if (disposerRecord.channel == null) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().info("open TTF: " + platName); + FontUtilities.logInfo("open TTF: " + platName); } try { RandomAccessFile raf = AccessController.doPrivileged( @@ -310,9 +310,9 @@ int readBlock(ByteBuffer buffer, int offset, int length) { */ if (FontUtilities.isLogging()) { String msg = "Read offset is " + offset + - " file size is " + fileSize+ - " file is " + platName; - FontUtilities.getLogger().severe(msg); + " file size is " + fileSize+ + " file is " + platName; + FontUtilities.logSevere(msg); } return -1; } else { @@ -331,7 +331,7 @@ int readBlock(ByteBuffer buffer, int offset, int length) { " and now is " + currSize; } if (FontUtilities.isLogging()) { - FontUtilities.getLogger().severe(msg); + FontUtilities.logSevere(msg); } // We could still flip() the buffer here because // it's possible that we did read some data in @@ -346,9 +346,8 @@ int readBlock(ByteBuffer buffer, int offset, int length) { if (bread > length/2 || bread > 16384) { buffer.flip(); if (FontUtilities.isLogging()) { - msg = "Returning " + bread + - " bytes instead of " + length; - FontUtilities.getLogger().severe(msg); + msg = "Returning " + bread + " bytes instead of " + length; + FontUtilities.logSevere(msg); } } else { bread = -1; @@ -364,8 +363,7 @@ int readBlock(ByteBuffer buffer, int offset, int length) { } } catch (FontFormatException e) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().severe( - "While reading " + platName, e); + FontUtilities.getLogger().severe("While reading " + platName, e); } bread = -1; // signal EOF deregisterFontAndClearStrikeCache(); @@ -385,8 +383,7 @@ int readBlock(ByteBuffer buffer, int offset, int length) { * file are handled as a FontFormatException. */ if (FontUtilities.isLogging()) { - FontUtilities.getLogger().severe( - "While reading " + platName, e); + FontUtilities.getLogger().severe("While reading " + platName, e); } if (bread == 0) { bread = -1; // signal EOF @@ -523,7 +520,7 @@ && getDirectoryEntry(hheaTag) == null) { initNames(); } catch (Exception e) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().severe(e.toString()); + FontUtilities.logSevere(e.toString()); } if (e instanceof FontFormatException) { throw (FontFormatException)e; @@ -1073,7 +1070,7 @@ private String makeString(byte[] bytes, int len, return new String(bytes, 0, len, charset); } catch (UnsupportedEncodingException e) { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning(e + " EncodingID=" + encoding); + FontUtilities.logWarning(e + " EncodingID=" + encoding); } return new String(bytes, 0, len); } catch (Throwable t) { diff --git a/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java b/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java index c8208941ff9..7fa9a1246a2 100644 --- a/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java +++ b/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java @@ -74,10 +74,9 @@ private char getGlyphFromCMAP(int charCode) { return glyphCode; } else { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning - (font + " out of range glyph id=" + - Integer.toHexString((int)glyphCode) + - " for char " + Integer.toHexString(charCode)); + FontUtilities.logWarning(font + " out of range glyph id=" + + Integer.toHexString((int)glyphCode) + + " for char " + Integer.toHexString(charCode)); } return (char)missingGlyph; } @@ -99,8 +98,7 @@ private char getGlyphFromCMAP(int charCode, int variationSelector) { return glyphCode; } else { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().warning - (font + " out of range glyph id=" + + FontUtilities.logWarning(font + " out of range glyph id=" + Integer.toHexString((int)glyphCode) + " for char " + Integer.toHexString(charCode) + " for vs " + Integer.toHexString(variationSelector)); @@ -115,9 +113,10 @@ private char getGlyphFromCMAP(int charCode, int variationSelector) { private void handleBadCMAP() { if (FontUtilities.isLogging()) { - FontUtilities.getLogger().severe("Null Cmap for " + font + - "substituting for this font"); + FontUtilities.logSevere("Null Cmap for " + font + + "substituting for this font"); } + SunFontManager.getInstance().deRegisterBadFont(font); /* The next line is not really a solution, but might * reduce the exceptions until references to this font2D diff --git a/src/java.desktop/unix/classes/sun/awt/X11FontManager.java b/src/java.desktop/unix/classes/sun/awt/X11FontManager.java index 17c87d5fc27..16f487626f3 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11FontManager.java +++ b/src/java.desktop/unix/classes/sun/awt/X11FontManager.java @@ -224,15 +224,13 @@ public String getFileNameFromPlatformName(String platName) { if (fontPath == null && (fileName == null || !fileName.startsWith("/"))) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .warning("** Registering all font paths because " + - "can't find file for " + platName); + FontUtilities.logWarning("** Registering all font paths because " + + "can't find file for " + platName); } fontPath = getPlatformFontPath(noType1Font); registerFontDirs(fontPath); if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .warning("** Finished registering all font paths"); + FontUtilities.logWarning("** Finished registering all font paths"); } fileName = fontNameMap.get(fontID); } @@ -289,7 +287,7 @@ protected void registerFontDir(String path) { * ... */ if (FontUtilities.debugFonts()) { - FontUtilities.getLogger().info("ParseFontDir " + path); + FontUtilities.logInfo("ParseFontDir " + path); } File fontsDotDir = new File(path + File.separator + "fonts.dir"); FileReader fr = null; @@ -368,10 +366,9 @@ protected void registerFontDir(String path) { String sVal = fontNameMap.get(fontID); if (FontUtilities.debugFonts()) { - PlatformLogger logger = FontUtilities.getLogger(); - logger.info("file=" + fileName + + FontUtilities.logInfo("file=" + fileName + " xlfd=" + fontPart); - logger.info("fontID=" + fontID + + FontUtilities.logInfo("fontID=" + fontID + " sVal=" + sVal); } String fullPath = null; @@ -394,16 +391,14 @@ protected void registerFontDir(String path) { } Vector xVal = xlfdMap.get(fullPath); if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .info("fullPath=" + fullPath + - " xVal=" + xVal); + FontUtilities.logInfo("fullPath=" + fullPath + + " xVal=" + xVal); } if ((xVal == null || !xVal.contains(fontPart)) && (sVal == null) || !sVal.startsWith("/")) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .info("Map fontID:"+fontID + - "to file:" + fullPath); + FontUtilities.logInfo("Map fontID:"+fontID + + "to file:" + fullPath); } fontNameMap.put(fontID, fullPath); if (xVal == null) { @@ -481,8 +476,7 @@ private String specificFontIDForName(String name) { if (hyphenCnt != 14) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .severe("Font Configuration Font ID is malformed:" + name); + FontUtilities.logSevere("Font Configuration Font ID is malformed:" + name); } return name; // what else can we do? } @@ -511,8 +505,7 @@ private String switchFontIDForName(String name) { if (hyphenCnt != 14) { if (FontUtilities.debugFonts()) { - FontUtilities.getLogger() - .severe("Font Configuration Font ID is malformed:" + name); + FontUtilities.logSevere("Font Configuration Font ID is malformed:" + name); } return name; // what else can we do? } @@ -675,7 +668,7 @@ private void getPlatformFontPathFromFontConfig() { if (FontUtilities.debugFonts() && fontConfigDirs != null) { String[] names = fontConfigDirs.toArray(new String[0]); for (int i=0;i