Class KerningOptimizer

  • All Implemented Interfaces:

    @API(since = "5.5", status = API.Status.INTERNAL) 
    public class KerningOptimizer
    
                        

    Text rendering might be slow for long lines when kerning is enabled, so it is worth disabling kerning for long texts.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void setMaxTextLengthWithKerning(int length) Configures the maximum document length for rendering with kerning enabled.
      int getMaxTextLengthWithKerning()
      void configureKerning(JComponent component, int documentLength) Configures text kerning according to the expected document length.
      void installKerningListener(JTextComponent textComponent) Adds a listener that disables kerning if text length reaches a certain threshold.
      void uninstallKerningListener(JTextComponent textComponent) Removes the listener that disables kerning if text length reaches a certain threshold.
      • Methods inherited from class java.lang.Object

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

      • KerningOptimizer

        KerningOptimizer()
    • Method Detail

      • setMaxTextLengthWithKerning

         void setMaxTextLengthWithKerning(int length)

        Configures the maximum document length for rendering with kerning enabled.

        Parameters:
        length - maximum document length for rendering with kerning enabled
      • configureKerning

         void configureKerning(JComponent component, int documentLength)

        Configures text kerning according to the expected document length. This might be useful before setting the document so the kerning is disabled before updating the document.

        Parameters:
        component - text component for kerning configuration
        documentLength - expected document length
      • installKerningListener

         void installKerningListener(JTextComponent textComponent)

        Adds a listener that disables kerning if text length reaches a certain threshold.

        Parameters:
        textComponent - text component for kerning configuration
      • uninstallKerningListener

         void uninstallKerningListener(JTextComponent textComponent)

        Removes the listener that disables kerning if text length reaches a certain threshold.

        Parameters:
        textComponent - text component for kerning configuration