Package com.inet.html

Interface InetHtmlFontFactory

All Known Implementing Classes:
InetHtmlFactory.DefaultFontFactory

public interface InetHtmlFontFactory
Factory to resolve font requests. Can be overwritten to implement a font mapping.
  • Method Summary

    Modifier and Type
    Method
    Description
    getFont(String name, int style, float size, String text)
    Returns the font object for a requested font with a fractional size.
    getFont(String name, int style, int size, String text)
    Returns the font object for a requested font.
    boolean
    This method indicates whether the font factory requires the text part which will be displayed by a certain font instance.
    default Font
    searchFontFor(String characters, int style, float size)
    Searches for a font, which is able to display the complete string
  • Method Details

    • getFont

      Font getFont(String name, int style, int size, String text)
      Returns the font object for a requested font. Please note that the returned font may differ in type, size or style depending on the properties of the targeted render context.
      Parameters:
      name - The name / family of the requested font
      style - the style constant(s)
      size - the size in pixel
      text - the text part which should be displayed by the requested font, can be null!
      Returns:
      the best match for the requested font
      Since:
      1.05
    • getFont

      Font getFont(String name, int style, float size, String text)
      Returns the font object for a requested font with a fractional size. Please note that the returned font may differ in type, size or style depending on the properties of the targeted render context.
      However, the method will prioritize font name over character availability, so if a font with said name is available it will be returned even if not all characters can be displayed. A fallback can and will only be used if not font with the name is available.
      Parameters:
      name - The name / family of the requested font
      style - the style constant(s)
      size - the size in pixel
      text - the text part which should be displayed by the requested font, can be null!
      Returns:
      the best match for the requested font
      Since:
      1.08
    • requiresText

      boolean requiresText()
      This method indicates whether the font factory requires the text part which will be displayed by a certain font instance. An factory, which requires to adopt the font according to it's displayable characters should return true here. Please note returning true here has a negative performance impact.
      Returns:
      true if the text should be set when getFont is called, false if not
      Since:
      1.05
    • searchFontFor

      default Font searchFontFor(String characters, int style, float size)
      Searches for a font, which is able to display the complete string
      Parameters:
      characters - the string to display
      style - the style for the new Font
      size - the size for the new Font
      Returns:
      a font, which can display the string or null, if none was found
      Since:
      1.12