Package com.jetbrains

Interface FontExtensions


@Service @Provided public interface FontExtensions
Font-related utilities.
  • Method Details

    • deriveFontWithFeatures

      Font deriveFontWithFeatures(Font font, String... features)
      This method derives a new Font object with a set of features. Feature syntax is <name> or <name>=<int>, like kern, or aalt=2. This method does not preserve features of the original font, they are completely overridden, if you need to append features to the font, use getEnabledFeatures(Font).
      Parameters:
      font - basic font
      features - set of OpenType's features
      Returns:
      new font
    • getEnabledFeatures

      String[] getEnabledFeatures(Font font)
      This method returns an array of features for the given font, set via deriveFontWithFeatures(java.awt.Font, java.lang.String...). Feature syntax is <name> or <name>=<int>, like kern, or aalt=2.
      Parameters:
      font - the font
      Returns:
      an array of features for the font
    • getAvailableFeatures

      Set<String> getAvailableFeatures(Font font)
      This method returns a set of OpenType features supported by the given font
      Parameters:
      font - the font
      Returns:
      set of supported features
    • getSubpixelResolution

      Dimension getSubpixelResolution()
      Get subpixel resolution for rendering text with greyscale antialiasing, set with -Djava2d.font.subpixelResolution=NxM, with integers between 1 and 16 instead of N and M. This only affects text rendered via glyph cache. Value of NxM means that each glyph has rasterized images for N distinct positions horizontally and M positions vertically. This effectively increases quality of glyph spacing in each direction at the cost of N*M times increased memory consumption.
      Returns:
      subpixel resolution (N, M)
    • canDisplayWithoutFallback

      @Extension(CAN_DISPLAY_WITHOUT_FALLBACK) boolean canDisplayWithoutFallback(Font font, int codePoint)
      Checks if the given font itself has a glyph for the specified character. Unlike Font.canDisplay(int), this method doesn't take into account fallback fonts which may be substituted by the platform for characters missing in the requested font. For example, on macOS Font.canDisplay(int) returns true for any character which can be displayed by any of the system fallback fonts. For logical fonts, all their component fonts are considered.
      Parameters:
      font - the font
      codePoint - the character (Unicode code point) for which a glyph is needed
      Returns:
      true if the font itself has a glyph for the character; false otherwise
      Throws:
      IllegalArgumentException - if the code point is not a valid Unicode code point
      See Also: