visad.util
Class HersheyFont

java.lang.Object
  extended by visad.util.HersheyFont

public class HersheyFont
extends Object

HersheyFont supports the Hershey Fonts for VisAD. Adapted from the original code by Buzbee (see source)


Field Summary
protected  int[] characterMaxX
           
protected  int[] characterMinX
           
protected  int characterSetMaxX
           
protected  int characterSetMaxY
           
protected  int characterSetMinX
           
protected  int characterSetMinY
           
protected  int charactersInSet
           
protected  char[][][] characterVectors
           
protected  boolean fixedWidth
           
protected  String name
           
protected  int[] numberOfPoints
           
protected static int X
           
protected static int Y
           
 
Constructor Summary
HersheyFont()
          Default constructor.
HersheyFont(String fontName)
          Get a Hershey Font by name.
HersheyFont(URL base)
          Get a Hershey Font by URL.
HersheyFont(URL base, String fontName)
          Get a Hershey Font by URL and name.
 
Method Summary
protected  void calculateCharacterSize(int j, int xadj)
           
 boolean equals(Object o)
          See if o is equal to this
 int[] getCharacterMaxX()
          get the maximum X coordinate values for all characters
 int[] getCharacterMinX()
          get the minimum X coordinate values for all characters
 int getCharacterSetMaxX()
          get the maximum X coordiante value for all characters
 int getCharacterSetMaxY()
          get the maximum Y coordiante value for all characters
 int getCharacterSetMinX()
          get the minimum X coordiante value for all characters
 int getCharacterSetMinY()
          get the minimum Y coordiante value for all characters
 int getCharactersInSet()
          get the minimum Y coordiante value for all characters
 char[][] getCharacterVector(int i)
          get the vector of X and Y coordinates for the i-th character
 boolean getFixedWidth()
          indicate whether this is a fixed-width font
 boolean getIsCursive()
          indicate whether this is a cursive font
 int getMaxPoints()
          get the maximum number of points (segments) allowed
 int getNumberOfPoints(int i)
          get the number of points for the i-th character
 int hasCode()
          Get the hashcode
 void setFixedWidth(boolean fw)
          set whether this font is 'fixed width' or not (not = proportional spacing) Right now, only the 'wmo' font is defaulted to fixed.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X

protected static final int X
See Also:
Constant Field Values

Y

protected static final int Y
See Also:
Constant Field Values

name

protected String name

characterVectors

protected char[][][] characterVectors

numberOfPoints

protected int[] numberOfPoints

characterMinX

protected int[] characterMinX

characterMaxX

protected int[] characterMaxX

characterSetMinY

protected int characterSetMinY

characterSetMaxY

protected int characterSetMaxY

characterSetMinX

protected int characterSetMinX

characterSetMaxX

protected int characterSetMaxX

charactersInSet

protected int charactersInSet

fixedWidth

protected boolean fixedWidth
Constructor Detail

HersheyFont

public HersheyFont()
Default constructor. Use the font 'futural' Supplied fonts are: futural, timesr, timesrb, cursive, futuram, rowmans, rowmant, meteorology All other fonts supplied by Bizbee are available at the VisAD web site. More info at: http://batbox.org/font.html


HersheyFont

public HersheyFont(String fontName)
Get a Hershey Font by name. This constructor form will add a .jhf extension to the name given and read it as a Resourse from the visad/util directory. Supplied fonts are: futural, timesr, timesrb, cursive, futuram, rowmans, rowmant, meteorology All other fonts supplied by Bizbee are available at the VisAD web site.

Parameters:
fontName - name of the Hershey font to use

HersheyFont

public HersheyFont(URL base,
                   String fontName)
Get a Hershey Font by URL and name. You must give the complete filename (e.g., futural.jhf) as well as the URL

Parameters:
base - is the base URL of the file
fontName - the name of the fontfile (include .jhf extension)

HersheyFont

public HersheyFont(URL base)
Get a Hershey Font by URL. You must give the complete filename (e.g., futural.jhf) as part of the URL

Parameters:
base - is the URL of the file (e.g., http://www.ssec.wisc.edu/visad/futural.jhf)
Method Detail

equals

public boolean equals(Object o)
See if o is equal to this

Overrides:
equals in class Object
Returns:
true if they have the same name

hasCode

public int hasCode()
Get the hashcode

Returns:
the hashcode

getMaxPoints

public int getMaxPoints()
get the maximum number of points (segments) allowed

Returns:
value of max number of segments allowed.

getCharacterMinX

public int[] getCharacterMinX()
get the minimum X coordinate values for all characters

Returns:
array of minimum X coordinates

getCharacterMaxX

public int[] getCharacterMaxX()
get the maximum X coordinate values for all characters

Returns:
array of maximum X coordinates

getCharacterSetMinY

public int getCharacterSetMinY()
get the minimum Y coordiante value for all characters

Returns:
minimum Y coordinate value for all characters in thie font

getCharacterSetMaxY

public int getCharacterSetMaxY()
get the maximum Y coordiante value for all characters

Returns:
maximum Y coordinate value for all characters in thie font

getCharacterSetMinX

public int getCharacterSetMinX()
get the minimum X coordiante value for all characters

Returns:
minimum X coordinate value for all characters in thie font

getCharacterSetMaxX

public int getCharacterSetMaxX()
get the maximum X coordiante value for all characters

Returns:
maximum X coordinate value for all characters in thie font

getCharactersInSet

public int getCharactersInSet()
get the minimum Y coordiante value for all characters

Returns:
minimum Y coordinate value for all characters in thie font

getNumberOfPoints

public int getNumberOfPoints(int i)
get the number of points for the i-th character

Parameters:
i - the index of the character
Returns:
the number of data points for this character

getCharacterVector

public char[][] getCharacterVector(int i)
get the vector of X and Y coordinates for the i-th character

Parameters:
i - the index of the character
Returns:
array[2][number_points] for this character

setFixedWidth

public void setFixedWidth(boolean fw)
set whether this font is 'fixed width' or not (not = proportional spacing) Right now, only the 'wmo' font is defaulted to fixed.


getFixedWidth

public boolean getFixedWidth()
indicate whether this is a fixed-width font

Returns:
true if name indicates fixed with (wmo...)

getIsCursive

public boolean getIsCursive()
indicate whether this is a cursive font

Returns:
true if name contains "cursive"

calculateCharacterSize

protected void calculateCharacterSize(int j,
                                      int xadj)

toString

public String toString()
Overrides:
toString in class Object