Class AbstractFontManager

java.lang.Object
org.openscience.cdk.renderer.font.AbstractFontManager
All Implemented Interfaces:
IFontManager
Direct Known Subclasses:
AWTFontManager

public abstract class AbstractFontManager extends Object implements IFontManager
Implements the common parts of the IFontManager interface.
Source code:
main
Belongs to CDK module:
renderbasic
  • Field Details

    • currentFontIndex

      protected int currentFontIndex
  • Constructor Details

    • AbstractFontManager

      public AbstractFontManager()
      Call this in subclasses with the super() constructor.
  • Method Details

    • makeFonts

      protected abstract void makeFonts()
      Make widget-specific fonts.
    • getFontName

      public String getFontName()
      Get the font family name used in this font manager.
      Returns:
      the font name
    • setFontName

      public void setFontName(String fontName)
      Set the font name ('Arial', 'Times New Roman') and so on.
      Specified by:
      setFontName in interface IFontManager
      Parameters:
      fontName - name of the font to use
    • setFontStyle

      public void setFontStyle(IFontManager.FontStyle fontStyle)
      Set the font style.
      Specified by:
      setFontStyle in interface IFontManager
      Parameters:
      fontStyle - an IFontManager.FontStyle type
    • getFontStyle

      public IFontManager.FontStyle getFontStyle()
      Get the font style, defined in the IFontManager interface.
      Returns:
      the font style
    • registerFontSizeMapping

      public void registerFontSizeMapping(double zoom, int size)
      For a particular zoom level, register a font point-size so that this size of font will be used when the zoom is at this level.
      Parameters:
      zoom - the zoom level
      size - the font size
    • getFontSizeForZoom

      protected Integer getFontSizeForZoom(double zoom)
      For a particular zoom, get the appropriate font size.
      Parameters:
      zoom - the zoom level
      Returns:
      an integer font size
    • getNumberOfFontSizes

      public int getNumberOfFontSizes()
      Get the number of font sizes used.
      Returns:
      the size of the zoom to font map
    • resetVirtualCounts

      public void resetVirtualCounts()
      Reset the virtual counts.
    • toMiddle

      public void toMiddle()
      Set the font size pointer to the middle of the range.
    • increaseFontSize

      public void increaseFontSize()
      Move the font size pointer up. If this would move the pointer past the maximum font size, track this increase with a virtual size.
    • decreaseFontSize

      public void decreaseFontSize()
      Move the font size pointer down. If this would move the pointer past the minimum font size, track this increase with a virtual size.
    • inRange

      public boolean inRange()
      Check that the font pointer is in the range (0, numberOfFonts - 1).
      Returns:
      true if the current font index is between 0 and |fonts| - 1
    • atLowerBoundary

      public boolean atLowerBoundary()
      Test the virtual font pointer to see if it is at the lower boundary of the font size range (0).
      Returns:
      true if the lower virtual count is zero
    • atUpperBoundary

      public boolean atUpperBoundary()
      Test the virtual font pointer to see if it is at the upper boundary of the font size range (|fonts| - 1).
      Returns:
      true if the upper virtual count is |fonts| - 1
    • inLower

      public boolean inLower()
      Test to see if the lower virtual pointer is in use.
      Returns:
      true if the lower virtual count is less than zero
    • inUpper

      public boolean inUpper()
      Test to see if the upper virtual pointer is in use.
      Returns:
      true if the upper virtual count is greater than |fonts| - 1
    • atMax

      public boolean atMax()
      Check if the font pointer is as the maximum value.
      Returns:
      true if the current font index is equal to |fonts| - 1
    • atMin

      public boolean atMin()
      Check if the font pointer is as the minimum value.
      Returns:
      true if the current font index is equal to zero