--- old/make/tools/Makefile 2009-10-26 21:00:01.191217405 +0000 +++ new/make/tools/Makefile 2009-10-26 21:00:00.996542395 +0000 @@ -38,7 +38,6 @@ compile_properties \ dir_diff \ dtdbuilder \ - fontchecker \ freetypecheck \ generate_break_iterator \ GenerateCharacter \ --- old/make/tools/fontchecker/Makefile 2009-10-26 21:00:02.169631475 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,43 +0,0 @@ -# -# Copyright 1998-2005 Sun Microsystems, Inc. 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 -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Sun designates this -# particular file as subject to the "Classpath" exception as provided -# by Sun in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -# - -# -# Makefile for building the fontchecker tool -# - -BUILDDIR = ../.. -PACKAGE = build.tools.fontchecker -PRODUCT = tools -PROGRAM = fontchecker -include $(BUILDDIR)/common/Defs.gmk - -BUILDTOOL_SOURCE_ROOT = $(BUILDDIR)/tools/src -BUILDTOOL_MAIN = $(PKGDIR)/FontChecker.java - -# -# Build tool jar rules. -# -include $(BUILDDIR)/common/BuildToolJar.gmk - --- old/make/tools/src/build/tools/fontchecker/FontCheckDummy.java 2009-10-26 21:00:02.751983957 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,175 +0,0 @@ -/* - * Copyright 2002-2004 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package build.tools.fontchecker; - -import java.awt.*; -import java.awt.image.*; -import java.io.*; - -/** - * FontCheckDummy (not unlike Crash Test Dummy). - * - *
- * FontCheckDummy is the "child" process. Its task is to verify
- * integrity of system fonts. Since unexpected crashes are known
- * to occur when certain fonts are manipulated, the process is
- * "monitored" by the parent process, which might have to restart
- * the "child" if it crashes.
- * 
- * - * @author Ilya Bagrak - */ -public class FontCheckDummy implements FontCheckerConstants { - - /** - * Input stream from parent process. - */ - private BufferedReader is; - - /** - * Output stream to parent process. - */ - private BufferedOutputStream os; - - /** - * Image on which font characters will be drawn. - */ - private BufferedImage bi; - - /** - * graphics object on which characters will be drawn. - */ - private Graphics graphics; - - /** - * This constructor wraps the process's standard output and input streams - * to enable easier communication with parent process. It also initializes - * the graphics object used for drawing font characters. - *

- * @see FontCheckerConstants - */ - public FontCheckDummy() { - is = new BufferedReader(new InputStreamReader(System.in)); - os = new BufferedOutputStream(System.out); - /* make suffficient space for 12 point font */ - bi = new BufferedImage(40, 40, BufferedImage.TYPE_INT_RGB); - graphics = bi.getGraphics(); - try { - os.write(CHILD_STARTED_OK); - os.flush(); - } catch (IOException e) { - System.exit(-1); - } - } - - /** - * Initializes an instance of Font from given font path. - *
- * This methods attempts to create an instance of font from - * a string that represents path to the font file. - *

- * @param fontPath string representing path to font file - * @param flag indicating whether or not checking of non-TrueType fonts - * is necessary - */ - private void testFont(String fontPath, boolean checkNonTTF) { - - FontFileFilter fff = new FontFileFilter(checkNonTTF); - File fontFile = new File(fontPath); - if (!fontFile.canRead()) { - try { - os.write(ERR_FONT_NOT_FOUND); - os.flush(); - } catch (IOException e) { - System.exit(-1); - } - } - Font font = null; - try { - File file = new File(fontPath); - font = Font.createFont(fff.getFontType(fontPath), file); - } catch (FontFormatException e1) { - } catch (IOException e2) { - } - if (font == null) { - return; - } - font = font.deriveFont(Font.PLAIN, 12); - String name = font.getFontName(); - String family = font.getFamily(); - - char[] testChars = { '0' }; - if (font.canDisplay(testChars[0])) { - graphics.setFont(font); - graphics.drawChars(testChars, 0, 1, 20, 20); - } - try { - os.write(ERR_FONT_OK); - os.flush(); - } catch (IOException e) { - System.exit(-1); - } - } - - /** - * Begins synchronous communication betweeen parent and child processes. - *
- * This method begins communication between parent and child processes. - * FontCheckDummy reads a line of text from input stream (@see #is). - */ - public void run() { - String command = null; - while (true) { - try { - command = is.readLine(); - } catch (IOException e) { - System.exit(-1); - } - if (command != null && command.length() >= 1) { - int cmd = Integer.parseInt(command.substring(0,1)); - if (cmd == EXITCOMMAND) { - return; - } - boolean checkNonTTF = ((cmd == 1) ? true : false); - String fontPath = command.substring(1); - testFont(fontPath, checkNonTTF); - } else { - return; - } - } - } - - public static void main(String[] args) { - try { - /* Background app. */ - System.setProperty("java.awt.headless", "true"); - System.setProperty("sun.java2d.noddraw", "true"); - new FontCheckDummy().run(); - } catch (Throwable t) { - } - System.exit(0); - } -} --- old/make/tools/src/build/tools/fontchecker/FontChecker.java 2009-10-26 21:00:03.216585936 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,452 +0,0 @@ -/* - * Copyright 2002-2004 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package build.tools.fontchecker; - -import java.io.*; -import java.util.*; -import java.awt.event.*; -import sun.font.FontManager; - -/** - * FontChecker. - * - *
- * This is a FontChecker program. This class is a "parent" process
- * which invokes a "child" process. The child process will test
- * series of fonts and may crash as it encounters invalid fonts.
- * The "parent" process must then interpret error codes passed to it
- * by the "child" process and restart the "child" process if necessary.
- *
- * usage: java FontChecker [-v] -o outputfile
- *
- *        -o is the name of the file to contains canonical path names of
- *           bad fonts that are identified. This file is not created if
- *           no bad fonts are found.
- *        -v verbose: prints progress messages.
- *
- * 
- * - * @author Ilya Bagrak - */ -public class FontChecker implements ActionListener, FontCheckerConstants { - - /** - * Output stream to subprocess. - * Corresponds to the subprocess's System.in". - */ - private PrintWriter procPipeOut; - - /** - * Input stream from subprocess. - * Corresponds to the subprocess's System.out". - */ - private BufferedInputStream procPipeIn; - - /** - * Child process. - */ - private Process childProc; - - /** - * Name of output file to write file names of bad fonts - */ - private String outputFile; - - /** - * Reference to currently executing thread. - */ - private Thread currThread; - - /** - * Timeout timer for a single font check - */ - private javax.swing.Timer timeOne; - - /** - * Timeout timer for all font checks - */ - private javax.swing.Timer timeAll; - - /** - * max time (in milliseconds) allowed for checking a single font. - */ - private static int timeoutOne = 10000; - - /** - * max time (in milliseconds) allowed for checking all fonts. - */ - private static int timeoutAll = 120000; - - /** - * Boolean flag indicating whether FontChecker is required to - * check non-TrueType fonts. - */ - private boolean checkNonTTF = false; - - /** - * List of bad fonts found in the system. - */ - private Vector badFonts = new Vector(); - - /** - * whether to print warnings messges etc to stdout/err - * default is false - */ - private static boolean verbose = false; - - /* Command to use to exec sub-process. */ - private static String javaCmd = "java"; - - static void printlnMessage(String s) { - if (verbose) { - System.out.println(s); - } - } - - /** - * Event handler for timer event. - *
- * Stops the timer and interrupts the current thread which is - * still waiting on I/O from the child process. - *

- * @param evt timer event - */ - public void actionPerformed(ActionEvent evt) { - if (evt.getSource() == timeOne) { - timeOne.stop(); - printlnMessage("Child timed out: killing"); - childProc.destroy(); - } else { - doExit(); // went on too long (ie timeAll timed out). - } - } - - /** - * Initializes a FontChecker. - *
- * This method is usually called after an unrecoverable error has - * been detected and a child process has either crashed or is in bad - * state. The method creates a new child process from - * scratch and initializes it's input/output streams. - */ - public void initialize() { - try { - if (childProc != null) { - childProc.destroy(); - } - String fileSeparator = System.getProperty("file.separator"); - String javaHome = System.getProperty("java.home"); - String classPath = System.getProperty("java.class.path"); - classPath = "\"" + classPath + "\""; - String opt = "-cp " + classPath + " -Dsun.java2d.fontpath=\"" + - javaHome + fileSeparator + "lib" + fileSeparator + "fonts\""; - - /* command to exec the child process with the same JRE */ - String cmd = - new String(javaHome + fileSeparator + "bin" + - fileSeparator + javaCmd + - " -XXsuppressExitMessage " + opt + - " com.sun.java2d.fontchecker.FontCheckDummy"); - printlnMessage("cmd="+cmd); - childProc = Runtime.getRuntime().exec(cmd); - - } catch (IOException e) { - printlnMessage("can't execute child process"); - System.exit(0); - } catch (SecurityException e) { - printlnMessage("Error: access denied"); - System.exit(0); - } - - /* initialize input/output streams to/from child process */ - procPipeOut = new PrintWriter(childProc.getOutputStream()); - procPipeIn = new BufferedInputStream(childProc.getInputStream()); - - try { - int code = procPipeIn.read(); - if (code != CHILD_STARTED_OK) { - printlnMessage("bad child process start status="+code); - doExit(); - } - } catch (IOException e) { - printlnMessage("can't read child process start status unknown"); - doExit(); - } - } - - private void doExit() { - try { - if (procPipeOut != null) { - /* Tell the child to exit */ - procPipeOut.write(EXITCOMMAND+System.getProperty("line.separator")); - procPipeOut.flush(); - procPipeOut.close(); - } - } catch (Throwable t) { - } - System.exit(0); - } - - /** - * Tries to verify integrity of a font specified by a path. - *
- * This method is used to test whether a font specified by the given - * path is valid and does not crash the system. - *

- * @param fontPath a string representation of font path - * to standard out during while this font is tried - * @return returns true if font is OK, and - * false otherwise. - */ - public boolean tryFont(File fontFile) { - int bytesRead = 0; - String fontPath = fontFile.getAbsolutePath(); - - printlnMessage("Checking font "+fontPath); - - /* store reference to the current thread, so that when the timer - * fires it can be interrupted - */ - currThread = Thread.currentThread(); - timeOne.restart(); - - /* write a string command out to child process - * The command is formed by appending whether to test non-TT fonts - * and font path to be tested - */ - String command = Integer.toString(checkNonTTF ? 1 : 0) + - fontPath + - System.getProperty("line.separator"); - procPipeOut.write(command); - procPipeOut.flush(); - - /* check if underlying stream has encountered an error after - * command has been issued - */ - if (procPipeOut.checkError()){ - printlnMessage("Error: font crashed"); - initialize(); - return false; - } - - /* trying reading error code back from child process */ - try { - bytesRead = procPipeIn.read(); - } catch(InterruptedIOException e) { - /* A timeout timer fired before the operation completed */ - printlnMessage("Error: timeout occured"); - initialize(); - return false; - } catch(IOException e) { - /* there was an error reading from the stream */ - timeOne.stop(); - printlnMessage("Error: font crashed"); - initialize(); - return false; - } catch (Throwable t) { - bytesRead = ERR_FONT_READ_EXCPT; - } finally { - timeOne.stop(); - } - - if (bytesRead == ERR_FONT_OK) { - printlnMessage("Font integrity verified"); - return true; - } else if (bytesRead > 0) { - - switch(bytesRead){ - case ERR_FONT_NOT_FOUND: - printlnMessage("Error: font not found!"); - break; - case ERR_FONT_BAD_FORMAT: - printlnMessage("Error: incorrect font format"); - break; - case ERR_FONT_READ_EXCPT: - printlnMessage("Error: exception reading font"); - break; - case ERR_FONT_DISPLAY: - printlnMessage("Error: can't display characters"); - break; - case ERR_FONT_CRASH: - printlnMessage("Error: font crashed"); - break; - default: - printlnMessage("Error: invalid error code:"+bytesRead); - break; - - } - } else if (bytesRead == ERR_FONT_EOS) { - printlnMessage("Error: end of stream marker encountered"); - } else { - printlnMessage("Error: invalid error code:"+bytesRead); - } - - /* if we still haven't returned from this method, some error - * condition has occured and it is safer to re-initialize - */ - initialize(); - return false; - } - - /** - * Checks the integrity of all system fonts. - *
- * This method goes through every font in system's font path and verifies - * its integrity via the tryFont method. - *

- * @param restart true if checking of fonts should continue - * after the first bad font is found, and false otherwise - * @return returns true if all fonts are valid, - * false otherwise - * @see #tryFont(String, boolean, boolean) - */ - public boolean checkFonts(boolean restart) { - - /* file filter to filter out none-truetype font files */ - FontFileFilter fff = new FontFileFilter(checkNonTTF); - boolean checkOk = true; - - /* get platform-independent font path. Note that this bypasses - * the normal GraphicsEnvironment initialisation. In conjunction with - * the headless setting above, so we want to add - * java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(); - * to trigger a more normal initialisation. - */ - java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(); - String fontPath = FontManager.getFontPath(true); - StringTokenizer st = - new StringTokenizer(fontPath, - System.getProperty("path.separator")); - - /* some systems may have multiple font paths separated by - * platform-dependent characters, so fontPath string needs to be - * parsed - */ - timeOne = new javax.swing.Timer(timeoutOne, this); - timeAll = new javax.swing.Timer(timeoutAll, this); - timeAll.restart(); - while (st.hasMoreTokens()) { - File fontRoot = new File(st.nextToken()); - File[] fontFiles = fontRoot.listFiles(fff); - - for (int i = 0; i < fontFiles.length; i++) { - /* for each font file that is not a directory and passes - * through the font filter run the test - */ - if (!fontFiles[i].isDirectory() && - !tryFont(fontFiles[i])) { - - checkOk = false; - badFonts.add(fontFiles[i].getAbsolutePath()); - if (!restart) { - break; - } - } - } - } - - /* Tell the child to exit */ - procPipeOut.write(EXITCOMMAND+System.getProperty("line.separator")); - procPipeOut.flush(); - procPipeOut.close(); - - return checkOk; - } - - public static void main(String args[]){ - try { - /* Background app. */ - System.setProperty("java.awt.headless", "true"); - System.setProperty("sun.java2d.noddraw", "true"); - - boolean restart = true; - boolean errorFlag = false; - - FontChecker fc = new FontChecker(); - int arg = 0; - - while (arg < args.length && errorFlag == false) { - if (args[arg].equals("-v")) { - verbose = true; - } - else if (args[arg].equals("-w") && - System.getProperty("os.name", "unknown"). - startsWith("Windows")) { - javaCmd = "javaw"; - } - else if (args[arg].equals("-o")) { - /* set output file */ - if (++arg < args.length) - fc.outputFile = args[arg]; - else { - /* invalid argument format */ - printlnMessage("Error: invalid argument format"); - errorFlag = true; - } - } - else { - /* invalid command line argument */ - printlnMessage("Error: invalid argument value"); - errorFlag = true; - } - arg++; - } - - if (errorFlag || fc.outputFile == null) { - System.exit(0); - } - - File outfile = new File(fc.outputFile); - if (outfile.exists()) { - outfile.delete(); - } - - fc.initialize(); - - if (!fc.checkFonts(restart)) { - String[] badFonts = (String[])fc.badFonts.toArray(new String[0]); - if (badFonts.length > 0) { - printlnMessage("Bad Fonts:"); - try { - FileOutputStream fos = - new FileOutputStream(fc.outputFile); - PrintStream ps = new PrintStream(fos); - for (int i = 0; i < badFonts.length; i++) { - ps.println(badFonts[i]); - printlnMessage(badFonts[i]); - } - fos.close(); - } catch (IOException e) { - } - } - } else { - printlnMessage("No bad fonts found."); - } - } catch (Throwable t) { - } - System.exit(0); - } -} --- old/make/tools/src/build/tools/fontchecker/FontCheckerConstants.java 2009-10-26 21:00:03.659738493 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,45 +0,0 @@ -/* - * Copyright 2002-2004 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -package build.tools.fontchecker; - -public interface FontCheckerConstants { - - /* code sent to indicate child process started OK */ - public static final int CHILD_STARTED_OK = 100; - - /* error codes returned from child process */ - public static final int ERR_FONT_OK = 65; - public static final int ERR_FONT_NOT_FOUND = 60; - public static final int ERR_FONT_BAD_FORMAT = 61; - public static final int ERR_FONT_READ_EXCPT = 62; - public static final int ERR_FONT_DISPLAY = 64; - public static final int ERR_FONT_EOS = -1; - /* nl char sent after child crashes */ - public static final int ERR_FONT_CRASH = 10; - - /* 0 and 1 are reserved, and commands can only be a single digit integer */ - public static final int EXITCOMMAND = 2; -} --- old/make/tools/src/build/tools/fontchecker/FontFileFilter.java 2009-10-26 21:00:04.085316379 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,97 +0,0 @@ -/* - * Copyright 2002-2003 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - *
- * This class filters TrueType font files from other file
- * found in the font path.
- *
- * 
- * - * @author Ilya Bagrak - */ - -package build.tools.fontchecker; - -import java.awt.*; -import java.io.*; - -public class FontFileFilter implements java.io.FileFilter, FontCheckerConstants { - - /** - * Boolean flag indicating whether this filter filters out - * non-TrueType fonts. - */ - private boolean checkNonTTF; - - public FontFileFilter() { - this(false); - } - - public FontFileFilter(boolean checkNonTTF) { - super(); - this.checkNonTTF = checkNonTTF; - } - - /** - * Checks whether a file is accepted by this filter. - *
- * This method checks whehter a file is accepted by this filter. - * This filter is made to accept all the file whose extension is - * either .ttf or .TTF. These files are assumed to be TrueType fonts. - *

- * @return returns a boolean value indicating whether or not a file is - * accepted - */ - public boolean accept(File pathname) { - - String name = pathname.getName(); - return (name.endsWith(".ttf") || - name.endsWith(".TTF") || - name.endsWith(".ttc") || - name.endsWith(".TTC")) || - (name.endsWith(".pfb") || - name.endsWith(".PFB") || - name.endsWith(".pfa") || - name.endsWith(".PFA") && - checkNonTTF == true); - } - - public static int getFontType(String filename) { - if (filename.endsWith(".ttf") || - filename.endsWith(".TTF") || - filename.endsWith(".ttc") || - filename.endsWith(".TTC")) - return Font.TRUETYPE_FONT; - else if (filename.endsWith(".pfb") || - filename.endsWith(".PFB") || - filename.endsWith(".pfa") || - filename.endsWith(".PFA")) - return Font.TYPE1_FONT; - else - return 999; - } - -} --- old/make/tools/src/build/tools/fontchecker/README.txt 2009-10-26 21:00:04.503410171 +0000 +++ /dev/null 2009-10-14 20:51:54.219592243 +0100 @@ -1,91 +0,0 @@ -/* - * Copyright 2002-2003 Sun Microsystems, Inc. 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ -Instructions for running FontChecker ------------------------------------- - -FontChecker is a program designed to identify fonts that may cause JRE -crashes. Such fonts may be corrupted files, or badly constructed fonts. -Some crashes may also be due to bugs in the JRE's font code. -This test is designed to run quickly and silently as part of the JRE -installation process. It will only benefit users who install the JRE -via that mechanism. It cannot guarantee to identify all "bad fonts" because -the tests are minimal. Nor can it prevent problems due to fonts installed -subsequently to the JRE's installation. However it does ensure that the -vast majority of problem fonts are identified. This is important -"RAS" functionality. It is targeted at the consumer/plugin market where -there is substantial likelihood of end-users having installed software -packages which may be delivered with fonts that are not up to commercial -standards. - -The test is designed to be "fail safe". If the program fails to run -properly it has no impact on the installer or on JRE execution. -Thus there is no need to monitor successful execution of the test. - -The test is not a new "tool" in the sense of "javah" etc. -The test is not designed to be user executable or visible, and should -be unpacked by the installer into a temporary location, and executed -once the rest of the JRE is installed (ie as a postinstall step), and -can then be deleted from the temporary location once installation is -complete. Not deleting the jar file before execution is complete is -probably the sole reason that the installer may want to wait for -the program to complete. - -The FontChecker application can be run directly from the jar -file with this command: - %java -jar fontchecker.jar -o - -The output file is a required parameter in this version of the application. -The JRE installer should use the above form, and use it to create an -output file which must be named "badfonts.txt" and be placed into -the JRE's lib\fonts directory eg:- - - java -jar fontchecker.jar -o "C:\Program Files\jre\lib\fonts\badfonts.txt" - -Note the lower case "badfonts.txt", and the string quotes because of the spaces -in the path name. -The location given here is an example and needs to be calculated at install -time as $JREHOME\lib\fonts\badfonts.txt -The location and name are important, because the JRE at runtime will -look for this exactly located name and file. -This location is private to that JRE instance. It will not affect -any other JRE installed on the system. - -If running from a different directory than that containing the jar file, -use the form containing the full path to the jar file, eg : - - java -jar C:\fc\fontchecker.jar -o "C:\Program Files\jre\lib\fonts\badfonts.txt" - -FontChecker application accepts following command line flags. -usage: java -jar fontchecker.jar -o outputfile - -v - - -o is the name of the file to contains canonical path names of - bad fonts that are identified. This file is not created if - no bad fonts are found. - - -v verbose mode: print progress/warning messages. Not recommended - for installer use. - - -w if running on Windows, use "javaw" to exec the sub-process.