Class FileSystemFontProvider


  • final class FileSystemFontProvider
    extends FontProvider
    A FontProvider which searches for fonts on the local filesystem.
    • Constructor Detail

      • FileSystemFontProvider

        FileSystemFontProvider​(FontCache cache)
        Constructor.
    • Method Detail

      • scanFonts

        private void scanFonts​(java.util.List<java.io.File> files)
      • getDiskCacheFile

        private java.io.File getDiskCacheFile()
      • saveDiskCache

        private void saveDiskCache()
        Saves the font metadata cache to disk.
      • loadDiskCache

        private java.util.List<FileSystemFontProvider.FSFontInfo> loadDiskCache​(java.util.List<java.io.File> files)
        Loads the font metadata cache from disk.
      • addTrueTypeCollection

        private void addTrueTypeCollection​(java.io.File ttcFile)
                                    throws java.io.IOException
        Adds a TTC or OTC to the file cache. To reduce memory, the parsed font is not cached.
        Throws:
        java.io.IOException
      • addTrueTypeFont

        private void addTrueTypeFont​(java.io.File ttfFile)
                              throws java.io.IOException
        Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached.
        Throws:
        java.io.IOException
      • addTrueTypeFontImpl

        private void addTrueTypeFontImpl​(TrueTypeFont ttf,
                                         java.io.File file)
                                  throws java.io.IOException
        Adds an OTF or TTF font to the file cache. To reduce memory, the parsed font is not cached.
        Throws:
        java.io.IOException
      • addType1Font

        private void addType1Font​(java.io.File pfbFile)
                           throws java.io.IOException
        Adds a Type 1 font to the file cache. To reduce memory, the parsed font is not cached.
        Throws:
        java.io.IOException
      • toDebugString

        public java.lang.String toDebugString()
        Description copied from class: FontProvider
        Returns 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:
        toDebugString in class FontProvider
      • getFontInfo

        public java.util.List<? extends FontInfo> getFontInfo()
        Description copied from class: FontProvider
        Returns a list of information about fonts on the system.
        Specified by:
        getFontInfo in class FontProvider