Class FontCache


  • public final class FontCache
    extends java.lang.Object
    An in-memory cache for system fonts. This allows PDFBox to manage caching for a FontProvider. PDFBox is free to purge this cache at will.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<FontInfo,​java.lang.ref.SoftReference<FontBoxFont>> cache  
    • Constructor Summary

      Constructors 
      Constructor Description
      FontCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFont​(FontInfo info, FontBoxFont font)
      Adds the given FontBox font to the cache.
      FontBoxFont getFont​(FontInfo info)
      Returns the FontBox font associated with the given FontInfo.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        private final java.util.Map<FontInfo,​java.lang.ref.SoftReference<FontBoxFont>> cache
    • Constructor Detail

      • FontCache

        public FontCache()
    • Method Detail

      • addFont

        public void addFont​(FontInfo info,
                            FontBoxFont font)
        Adds the given FontBox font to the cache.
      • getFont

        public FontBoxFont getFont​(FontInfo info)
        Returns the FontBox font associated with the given FontInfo.