Package org.apache.fop.fonts.autodetect
Class FontFileFinder
java.lang.Object
org.apache.commons.io.DirectoryWalker
org.apache.fop.fonts.autodetect.FontFileFinder
- All Implemented Interfaces:
FontFinder
Helps to autodetect/locate available operating system fonts.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.io.DirectoryWalker
org.apache.commons.io.DirectoryWalker.CancelException
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
default depth limit of recursion when searching for font files -
Constructor Summary
ConstructorsConstructorDescriptionFontFileFinder
(int depthLimit, FontEventListener listener) ConstructorFontFileFinder
(FontEventListener listener) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionfind()
Automagically finds a list of font files on local systemSearches a given directory for font filesprotected static org.apache.commons.io.filefilter.IOFileFilter
Font directory filter.protected static org.apache.commons.io.filefilter.IOFileFilter
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) Methods inherited from class org.apache.commons.io.DirectoryWalker
checkIfCancelled, filterDirectoryContents, handleCancelled, handleDirectoryStart, handleEnd, handleIsCancelled, handleRestricted, handleStart, walk
-
Field Details
-
DEFAULT_DEPTH_LIMIT
public static final int DEFAULT_DEPTH_LIMITdefault depth limit of recursion when searching for font files- See Also:
-
-
Constructor Details
-
FontFileFinder
Default constructor- Parameters:
listener
- for throwing font related events
-
FontFileFinder
Constructor- Parameters:
depthLimit
- recursion depth limitlistener
- for throwing font related events
-
-
Method Details
-
getDirectoryFilter
protected static org.apache.commons.io.filefilter.IOFileFilter getDirectoryFilter()Font directory filter. Currently ignores hidden directories.- Returns:
- IOFileFilter font directory filter
-
getFileFilter
protected static org.apache.commons.io.filefilter.IOFileFilter getFileFilter()Font file filter. Currently searches for files with .ttf, .ttc, .otf, and .pfb extensions.- Returns:
- IOFileFilter font file filter
-
handleDirectory
- Overrides:
handleDirectory
in classorg.apache.commons.io.DirectoryWalker
- Parameters:
directory
- directory to handledepth
- recursion depthresults
- collection- Returns:
- whether directory should be handled
-
handleFile
- Overrides:
handleFile
in classorg.apache.commons.io.DirectoryWalker
- Parameters:
file
- file to handledepth
- recursion depthresults
- collection
-
handleDirectoryEnd
- Overrides:
handleDirectoryEnd
in classorg.apache.commons.io.DirectoryWalker
- Parameters:
directory
- the directory being processeddepth
- the current directory levelresults
- the collection of results objects
-
find
Automagically finds a list of font files on local system- Specified by:
find
in interfaceFontFinder
- Returns:
- List<URL> of font files
- Throws:
IOException
- io exception In case of an I/O problem
-
find
Searches a given directory for font files- Parameters:
dir
- directory to search- Returns:
- list of font files
- Throws:
IOException
- thrown if an I/O exception of some sort has occurred
-