Interface PlatformFontResolver

All Superinterfaces:
Serializable
All Known Implementing Classes:
PlatformFontResolverImpl

public interface PlatformFontResolver extends Serializable
This interface provides access to the methods that a client can use to build a font set that is used to resolve platform font names into actual Font objects.

Concurrency

All classes that implement this interface are in general not guaranteed to be threadsafe. Specific implementations may offer tighter guarantees.
  • Method Details

    • setResolutionPriority

      FontResolutionPriority setResolutionPriority(FontResolutionPriority priority)
      Set the resolution mechanism that the PlatformNameResoulver should use to decide which font should be chosen when two fonts have the same platform name.

      FontResolutionPriority.INTELLIGENT_FIRST specifies that an "intelligent" determination is made about the fonts and the "better" of the two font is chosen. If the "intelligent" resolver can make no distinction between the fonts then the first font to have been added first is chosen.

      FontResolutionPriority.INTELLIGENT_LAST specifies that an "intelligent" determination is made about the fonts and the "better" of the two font is chosen. If the "intelligent" resolver can make no distinction between the fonts then the first font to have been added last is chosen.

      FontResolutionPriority.FIRST specifies the first font added to the font set that matches the platform attributes is chosen.

      FontResolutionPriority.LAST specifies the last font added to the font set that matches the platform attributes is chosen.

      Parameters:
      priority - The resolution mechanism to use
      Returns:
      The old resolution priority setting.
    • addFont

      Adds a font to the set of fonts that are examined for resolving of platform names. If this font is indistinguishable from another font already in the font set then which of the two that is kept is determined by the settings of FontResolutionPriority.
      Parameters:
      font - the font to add to the fonts used for platform resolution
      Throws:
      UnsupportedFontException
      FontLoadingException
      InvalidFontException
    • addFont

      Adds a font to the set of fonts that are examined for resolving of platform names. If this font's PlatformFontDescription is indistinguishable from another font already in the font set then which of the two that is kept is determined by the settings of FontResolutionPriority.

      Note that the PlatformFontDescription is NOT pushed down into the Font. It is only an alias in the database. Thus, calling font.getPostscriptFontDescription() will not return the description passed in through this method but will instead return the original platform description of the font.

      Parameters:
      platformDesc - the platform description of the font
      font - the font to add to the fonts used for platform resolution
      Throws:
      UnsupportedFontException
      FontLoadingException
      InvalidFontException
    • isEmpty

      boolean isEmpty()
      Returns:
      true if the font set is empty (has no fonts); false otherwise
    • findFont

      Font findFont(PlatformFontSearchAttributes searchAttributes)
      Find a Font that matches the provided description. No analysis (e.g., removal of a CMap extension) is done by this function.
      Parameters:
      searchAttributes - the platform font attributes to search for
      Returns:
      the Font.