Package org.apache.pdfbox.pdmodel.font
Class FileSystemFontProvider
java.lang.Object
org.apache.pdfbox.pdmodel.font.FontProvider
org.apache.pdfbox.pdmodel.font.FileSystemFontProvider
A FontProvider which searches for fonts on the local filesystem.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FontCacheprivate static final Stringprivate final List<FileSystemFontProvider.FSFontInfo> private static final org.apache.commons.logging.Logprivate static final booleanThis option changes publicly visible behaviour: ".pdfbox.cache" file will have hash="-" for all files. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddTrueTypeCollection(File ttcFile) Adds a TTC or OTC to the file cache.private voidaddTrueTypeFont(File ttfFile) Adds an OTF or TTF font to the file cache.private voidaddTrueTypeFontImpl(FontHeaders fontHeaders, File file, String hash) Adds an OTF or TTF font to the file cache.private voidaddType1Font(File pfbFile) Adds a Type 1 font to the file cache.private static StringcreateFSIgnored(File file, FontFormat format, String postScriptName) private FileReturns a list of information about fonts on the system.private static booleanprivate List<FileSystemFontProvider.FSFontInfo> loadDiskCache(List<File> files) Loads the font metadata cache from disk.private voidSaves the font metadata cache to disk.private voidReturns a string containing debugging information.private voidwriteFontInfo(BufferedWriter writer, FileSystemFontProvider.FSFontInfo fontInfo)
-
Field Details
-
LOG
private static final org.apache.commons.logging.Log LOG -
SKIP_CHECKSUMS
private static final boolean SKIP_CHECKSUMSThis option changes publicly visible behaviour: ".pdfbox.cache" file will have hash="-" for all files. After implementingFontHeaders, parsing font headers is faster than checksumming anyway. -
CHECKSUM_PLACEHOLDER
- See Also:
-
fontInfoList
-
cache
-
-
Constructor Details
-
FileSystemFontProvider
FileSystemFontProvider(FontCache cache) Constructor.
-
-
Method Details
-
createFSIgnored
private FileSystemFontProvider.FSFontInfo createFSIgnored(File file, FontFormat format, String postScriptName) -
scanFonts
-
getDiskCacheFile
-
isBadPath
-
saveDiskCache
private void saveDiskCache()Saves the font metadata cache to disk. -
writeFontInfo
private void writeFontInfo(BufferedWriter writer, FileSystemFontProvider.FSFontInfo fontInfo) throws IOException - Throws:
IOException
-
loadDiskCache
Loads the font metadata cache from disk. -
addTrueTypeCollection
Adds a TTC or OTC to the file cache. To reduce memory, the parsed font is not cached. -
addTrueTypeFont
Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached. -
addTrueTypeFontImpl
Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached. -
addType1Font
Adds a Type 1 font to the file cache. To reduce memory, the parsed font is not cached. -
toDebugString
Description copied from class:FontProviderReturns a string containing debugging information. This will be written to the log if no suitable fonts are found and no fallback fonts are available. May be null.- Specified by:
toDebugStringin classFontProvider- Returns:
- string with debug information or null
-
getFontInfo
Description copied from class:FontProviderReturns a list of information about fonts on the system.- Specified by:
getFontInfoin classFontProvider- Returns:
- a list of FntInfo instances for all fonts on the system
-
computeHash
- Throws:
IOException
-