org.apache.fop.fonts

## Class FontManager

- java.lang.Object
- - org.apache.fop.fonts.FontManager

-     public class FontManager
      extends java.lang.Object

  The manager of fonts. The class holds a reference to the font cache and information about font substitution, referenced fonts and similar.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FontManager(InternalResourceResolver resourceResolver, FontDetector fontDetector, FontCacheManager fontCacheManager)` Main constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `autoDetectFonts(boolean autoDetectFonts, FontAdder fontAdder, boolean strict, FontEventListener listener, java.util.List<EmbedFontInfo> fontInfoList)` Detect fonts from the operating system via FOPs autodetect mechanism.
    `void` | `deleteCache()` Deletes the current FontCache file
    `void` | `disableFontCache()` Whether or not to cache results of font triplet detection/auto-config
    `FontCache` | `getFontCache()` Returns the font cache instance used by this font manager.
    `protected FontSubstitutions` | `getFontSubstitutions()` Returns the font substitution catalog
    `FontTriplet.Matcher` | `getReferencedFontsMatcher()` Gets the `FontTriplet.Matcher` that can be used to identify the fonts that shall be referenced rather than embedded.
    `InternalResourceResolver` | `getResourceResolver()`
    `boolean` | `isBase14KerningEnabled()`
    `void` | `saveCache()` Saves the FontCache as necessary
    `void` | `setBase14KerningEnabled(boolean value)` Controls whether kerning is activated on base 14 fonts.
    `void` | `setCacheFile(java.net.URI cacheFileURI)` Sets the font cache file
    `void` | `setFontSubstitutions(FontSubstitutions substitutions)` Sets the font substitutions
    `void` | `setReferencedFontsMatcher(FontTriplet.Matcher matcher)` Sets the `FontTriplet.Matcher` that can be used to identify the fonts that shall be referenced rather than embedded.
    `void` | `setResourceResolver(InternalResourceResolver resourceResolver)` Sets the font resource resolver
    `void` | `setup(FontInfo fontInfo, FontCollection[] fontCollections)` Sets up the fonts on a given FontInfo object.
    `void` | `updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList)` Updates the referenced font list using the FontManager's referenced fonts matcher (`getReferencedFontsMatcher()`).
    `void` | `updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList, FontTriplet.Matcher matcher)` Updates the referenced font list.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FontManager

          public FontManager(InternalResourceResolver resourceResolver,
                     FontDetector fontDetector,
                     FontCacheManager fontCacheManager)

      Main constructor
      Parameters:
        `resourceResolver` - the URI resolver
        `fontDetector` - the font detector
        `fontCacheManager` - the font cache manager

  - ### Method Detail

    - #### setResourceResolver

          public void setResourceResolver(InternalResourceResolver resourceResolver)

      Sets the font resource resolver
      Parameters:
        `resourceResolver` - resource resolver

    - #### getResourceResolver

          public InternalResourceResolver getResourceResolver()

    - #### isBase14KerningEnabled

          public boolean isBase14KerningEnabled()

      Returns:
        true if kerning on base 14 fonts is enabled

    - #### setBase14KerningEnabled

          public void setBase14KerningEnabled(boolean value)

      Controls whether kerning is activated on base 14 fonts.
      Parameters:
        `value` - true if kerning should be activated

    - #### setFontSubstitutions

          public void setFontSubstitutions(FontSubstitutions substitutions)

      Sets the font substitutions
      Parameters:
        `substitutions` - font substitutions

    - #### getFontSubstitutions

          protected FontSubstitutions getFontSubstitutions()

      Returns the font substitution catalog
      Returns:
        the font substitution catalog

    - #### setCacheFile

          public void setCacheFile(java.net.URI cacheFileURI)

      Sets the font cache file
      Parameters:
        `cacheFileURI` - the URI of the font cache file

    - #### disableFontCache

          public void disableFontCache()

      Whether or not to cache results of font triplet detection/auto-config

    - #### getFontCache

          public FontCache getFontCache()

      Returns the font cache instance used by this font manager.
      Returns:
        the font cache

    - #### saveCache

          public void saveCache()
                         throws FOPException

      Saves the FontCache as necessary
      Throws:
        `FOPException` - fop exception

    - #### deleteCache

          public void deleteCache()
                           throws FOPException

      Deletes the current FontCache file
      Throws:
        `FOPException` - if an error was thrown while deleting the cache

    - #### setup

          public void setup(FontInfo fontInfo,
                   FontCollection[] fontCollections)

      Sets up the fonts on a given FontInfo object. The fonts to setup are defined by an array of `FontCollection` objects.
      Parameters:
        `fontInfo` - the FontInfo object to set up
        `fontCollections` - the array of font collections/sources

    - #### setReferencedFontsMatcher

          public void setReferencedFontsMatcher(FontTriplet.Matcher matcher)

      Sets the `FontTriplet.Matcher` that can be used to identify the fonts that shall be referenced rather than embedded.
      Parameters:
        `matcher` - the font triplet matcher

    - #### getReferencedFontsMatcher

          public FontTriplet.Matcher getReferencedFontsMatcher()

      Gets the `FontTriplet.Matcher` that can be used to identify the fonts that shall be referenced rather than embedded.
      Returns:
        the font triplet matcher (or null if none is set)

    - #### updateReferencedFonts

          public void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList)

      Updates the referenced font list using the FontManager's referenced fonts matcher (`getReferencedFontsMatcher()`).
      Parameters:
        `fontInfoList` - a font info list

    - #### updateReferencedFonts

          public void updateReferencedFonts(java.util.List<EmbedFontInfo> fontInfoList,
                                   FontTriplet.Matcher matcher)

      Updates the referenced font list.
      Parameters:
        `fontInfoList` - a font info list
        `matcher` - the font triplet matcher to use

    - #### autoDetectFonts

          public void autoDetectFonts(boolean autoDetectFonts,
                             FontAdder fontAdder,
                             boolean strict,
                             FontEventListener listener,
                             java.util.List<EmbedFontInfo> fontInfoList)
                               throws FOPException

      Detect fonts from the operating system via FOPs autodetect mechanism.
      Parameters:
        `autoDetectFonts` - if autodetect has been enabled
        `fontAdder` - the font adding mechanism
        `strict` - whether to enforce strict validation
        `listener` - the listener for font related events
        `fontInfoList` - a list of font info objects
      Throws:
        `FOPException` - if an exception was thrown auto-detecting fonts

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