uk.ac.starlink.ast.grf
Class DefaultGrfFontManager

java.lang.Object
  extended by uk.ac.starlink.ast.grf.DefaultGrfFontManager

public class DefaultGrfFontManager
extends Object

DefaultGrfFontManager is a singleton class for managing the list of known fonts known to the Grf class. Each font can be associated with its position in the list (hence providing the necessary mapping to an integer), but note that as fonts are removed these values change (so a request to map a Font to an integer should be made immediately) before passing to AST integer. A default font that is generally available is provided with index 0.

Version:
$Id$
Author:
Peter W. Draper

Field Summary
protected  Font defaultFont
          The default font (Lucida Sans 14).
protected  ArrayList fonts
          ArrayList of references to all fonts.
 
Method Summary
 int add(Font font)
          Add a font, returns its index.
 int count()
          Get the number of fonts.
 Font getFont(int index)
          Get a font by its index.
 int getIndex(Font font)
          Get the index of a known font.
static DefaultGrfFontManager getReference()
          Return reference to the only allowed instance of this class.
 int remove(Font font)
          Remove a font by name, returning its index.
 void remove(int index)
          Remove a font by index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultFont

protected Font defaultFont
The default font (Lucida Sans 14).


fonts

protected ArrayList fonts
ArrayList of references to all fonts.

Method Detail

getReference

public static DefaultGrfFontManager getReference()
Return reference to the only allowed instance of this class.


count

public int count()
Get the number of fonts.


add

public int add(Font font)
Add a font, returns its index.


remove

public int remove(Font font)
Remove a font by name, returning its index.


remove

public void remove(int index)
Remove a font by index.


getIndex

public int getIndex(Font font)
Get the index of a known font. If not known return the default font index.


getFont

public Font getFont(int index)
Get a font by its index. If not known return the default font.



Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.