org.foray.font.config
Class ConfigGenerator

java.lang.Object
  extended by org.foray.font.config.ConfigGenerator

public class ConfigGenerator
extends Object

Creates a default axsl-compliant font-configuration file from fonts in a set of directories. It is tempting to think that this class should be an axsl class. However, we need to use the FOray font parsing tools to be able to build this file.


Field Summary
static String[] FONT_FILE_EXTENSIONS
          The list of font file extensions supported by this class.
 
Constructor Summary
ConfigGenerator(FontServer4a fontServer)
          Basic Constructor.
 
Method Summary
static FilenameFilter getDefaultFilter()
          Returns the list of files that should be processed for a given directory.
 Document getDom()
          Returns the default configuration as a DOM document.
 int getFailureCount()
          Returns the quantity of files that could not be processed.
 int getSuccessCount()
          Returns the quantity of files that were successfully processed.
static void main(String[] args)
          Command-line interface for ConfigGenerator.
 void processDirectory(String dirName, FilenameFilter filter)
          Process one directory, finding all files in that directory and processing them.
 void write(File file)
          Writes the DOM created by this configuration to a given file.
 void write(OutputStream output)
          Writes the DOM created by this configuration to a given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_FILE_EXTENSIONS

public static final String[] FONT_FILE_EXTENSIONS
The list of font file extensions supported by this class.

Constructor Detail

ConfigGenerator

public ConfigGenerator(FontServer4a fontServer)
Basic Constructor.

Parameters:
fontServer - The font server.
Method Detail

getDom

public Document getDom()
Returns the default configuration as a DOM document.

Returns:
The default configuration or null if no directories were provided.

write

public void write(OutputStream output)
           throws org.axsl.font.FontException
Writes the DOM created by this configuration to a given output stream.

Parameters:
output - The output stream to which this configuration should be written.
Throws:
org.axsl.font.FontException - For errors writing the output.
See Also:
write(File)

write

public void write(File file)
           throws org.axsl.font.FontException
Writes the DOM created by this configuration to a given file.

Parameters:
file - The file to which this configuration should be written.
Throws:
org.axsl.font.FontException - For errors writing the output.
See Also:
write(OutputStream)

processDirectory

public void processDirectory(String dirName,
                             FilenameFilter filter)
Process one directory, finding all files in that directory and processing them.

Parameters:
dirName - The location of the directory.
filter - The filter that should be used to decide which files should be processed.

main

public static void main(String[] args)
Command-line interface for ConfigGenerator. Arguments contain the list of directories for which the configuration should be created. The name "system" (case is irrelevant) indicates that all known font directories on this system should be included. The file is created in the current directory with the name "axsl-font-config-auto.xml".

Parameters:
args - The list of directories which should be traversed looking for fonts to configure.

getFailureCount

public int getFailureCount()
Returns the quantity of files that could not be processed.

Returns:
The quantity of files that could not be processed.

getSuccessCount

public int getSuccessCount()
Returns the quantity of files that were successfully processed.

Returns:
The quantity of files that were successfully processed.

getDefaultFilter

public static FilenameFilter getDefaultFilter()
Returns the list of files that should be processed for a given directory. Currently ignores hidden directories.

Returns:
IOFileFilter font directory filter


Copyright © 2017. All rights reserved.