Class FontProperties

FontProperties

public class FontProperties

FontProperties represents a font entity. It encapsulates all the information required for font formatting, primarily the font and the spacing to be used.

Any reference to a "font formatting" string implies that the string must be well-formed: <font>*</font>


Constructor Summary
FontProperties(var $font, var $spacing)
          Constructs a FontProperties.
 
Method Summary
 java.lang.String getFont()
          Gets the font formatting of the object.
 int getSpacing()
          Gets the spacing of the object.
 void setFont(var $font)
          Sets the font formatting of the object.
 void setSpacing(var $spacing)
          Sets the amount of spacing of the object.
 boolean validateFont(var $font)
          Checks if string is of proper font formatting syntax.
 java.lang.String wrapData(var $data)
          Wraps the data specified with font formatting.
 

Constructor Detail

FontProperties

public FontProperties(var $font,
                      var $spacing)
Constructs a FontProperties. If not given any parameters, will use the default font and spacing. Otherwise, will set font and spacing to the specified values.
Parameters:
$font - String specifying font formatting
$spacing - int specifying spacing
$font - Default Value: ""
$spacing - Default Value: 0
Method Detail

getFont

public java.lang.String getFont()
Gets the font formatting of the object.

getSpacing

public int getSpacing()
Gets the spacing of the object.

setFont

public void setFont(var $font)
Sets the font formatting of the object. If the value specified isn't in proper syntax, then a default font formatting will be used.

The syntax must be of the form: <font>*</font>

Parameters:
$font - String specifying the font formatting
$font - Default Value: ""

setSpacing

public void setSpacing(var $spacing)
Sets the amount of spacing of the object. The spacing is used by the wrapData method to determine how much spacing (using an HTLM space) is appended after the data being wrapped with the font formatting.
Parameters:
$spacing - int specifying the amount of spacing
$spacing - Default Value: 0

validateFont

public boolean validateFont(var $font)
Checks if string is of proper font formatting syntax. Does a simple check to determine if there are greater than 1 '>' and '<' and greater than 0 '/' and '*'. Returns 1 if so, and returns 0 otherwise.
Parameters:
$font - String specifying the font formatting

wrapData

public java.lang.String wrapData(var $data)
Wraps the data specified with font formatting. Will also append the data with the current amount of spacing. Returns a String of the wrapped data.
Parameters:
$data - String specifying the data to be wrapped