org.apache.fop.fonts.autodetect

Class FontFileFinder

Implemented Interfaces:
FontFinder

public class FontFileFinder
extends DirectoryWalker
implements FontFinder

Helps to autodetect/locate available operating system fonts.

Field Summary

static int
DEFAULT_DEPTH_LIMIT
default depth limit of recursion when searching for font files *

Constructor Summary

FontFileFinder()
Default constructor
FontFileFinder(int depthLimit)
Constructor

Method Summary

List
find()
Automagically finds a list of font files on local system
List
find(String dir)
Searches a given directory for font files
protected static IOFileFilter
getDirectoryFilter()
Font directory filter.
protected static IOFileFilter
getFileFilter()
Font file filter.
protected boolean
handleDirectory(File directory, int depth, Collection results)
protected void
handleDirectoryEnd(File directory, int depth, Collection results)
protected void
handleFile(File file, int depth, Collection results)

Field Details

DEFAULT_DEPTH_LIMIT

public static final int DEFAULT_DEPTH_LIMIT
default depth limit of recursion when searching for font files *
Field Value:
-1

Constructor Details

FontFileFinder

public FontFileFinder()
Default constructor

FontFileFinder

public FontFileFinder(int depthLimit)
Constructor
Parameters:
depthLimit - recursion depth limit

Method Details

find

public List find()
            throws IOException
Automagically finds a list of font files on local system
Specified by:
find in interface FontFinder
Returns:
List<URL> of font files

find

public List find(String dir)
            throws IOException
Searches a given directory for font files
Parameters:
dir - directory to search
Returns:
list of font files

getDirectoryFilter

protected static IOFileFilter getDirectoryFilter()
Font directory filter. Currently ignores hidden directories.
Returns:
IOFileFilter font directory filter

getFileFilter

protected static IOFileFilter getFileFilter()
Font file filter. Currently searches for files with .ttf and .pfb extensions.
Returns:
IOFileFilter font file filter

handleDirectory

protected boolean handleDirectory(File directory,
                                  int depth,
                                  Collection results)
Parameters:
directory - directory to handle
depth - recursion depth
results - collection
Returns:
whether directory should be handled

handleDirectoryEnd

protected void handleDirectoryEnd(File directory,
                                  int depth,
                                  Collection results)
Parameters:
directory - the directory being processed
depth - the current directory level
results - the collection of results objects

handleFile

protected void handleFile(File file,
                          int depth,
                          Collection results)
Parameters:
file - file to handle
depth - recursion depth
results - collection

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.