jxl.biff
Class FontRecord

java.lang.Object
  |
  +--jxl.biff.RecordData
        |
        +--jxl.biff.WritableRecordData
              |
              +--jxl.biff.FontRecord
All Implemented Interfaces:
ByteData, Font
Direct Known Subclasses:
WritableFontRecord

public class FontRecord
extends WritableRecordData
implements Font

A record containing the necessary data for the font information


Inner Class Summary
private static class FontRecord.Biff7
          Dummy indicators for overloading the constructor
 
Field Summary
static FontRecord.Biff7 biff7
           
private  int boldWeight
          The bold weight for this font (normal or bold)
private  byte characterSet
          The character set
private  int colourIndex
          The index into the colour palette
private  byte fontFamily
          The font family
private  int fontIndex
          The index of this font in the font list
private  boolean initialized
          Flag to indicate whether the derived data (such as the font index) has been initialized or not
private  boolean italic
          Indicates whether or not this font is italic
private  java.lang.String name
          The name of this font
private  int pointHeight
          The point height of this font
private  int scriptStyle
          The style of the script (italic or normal)
private  boolean struckout
          Indicates whether or not this font is struck out
private  int underlineStyle
          The underline style for this font (none, single, double etc)
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
protected FontRecord(Font f)
          Publicly available copy constructor
  FontRecord(Record t, WorkbookSettings ws)
          Constructs this object from the raw data.
  FontRecord(Record t, WorkbookSettings ws, FontRecord.Biff7 dummy)
          Constructs this object from the raw data.
protected FontRecord(java.lang.String fn, int ps, int bold, boolean it, int us, int ci, int ss)
          Constructor, used when creating a new font for writing out.
 
Method Summary
 boolean equals(java.lang.Object o)
          Standard equals method
 int getBoldWeight()
          Gets the bold weight for this font
 Colour getColour()
          Gets the colour for this font
 byte[] getData()
          Gets the byte data for writing out
 int getFontIndex()
          Accessor for the font index
 java.lang.String getName()
          Gets the name of this font
 int getPointSize()
          Gets the point size for this font, if the font hasn't been initialized
 ScriptStyle getScriptStyle()
          Gets the script style
 UnderlineStyle getUnderlineStyle()
          Gets the underline style for this font
 void initialize(int pos)
          Sets the font index of this record.
 boolean isInitialized()
          Accessor to see whether this object is initialized or not.
 boolean isItalic()
          Returns the italic flag
 boolean isStruckout()
          Accessor for the strike out flag
protected  void setFontBoldStyle(int bs)
          Sets the bold style for this font, if the font hasn't been initialized
protected  void setFontColour(int c)
          Sets the colour for this font, if the font hasn't been initialized
protected  void setFontItalic(boolean i)
          Sets the italic indicator for this font, if the font hasn't been initialized
protected  void setFontPointSize(int ps)
          Sets the point size for this font, if the font hasn't been initialized
protected  void setFontScriptStyle(int ss)
          Sets the script style (eg.
protected  void setFontStruckout(boolean os)
          Sets the struck out flag
protected  void setFontUnderlineStyle(int us)
          Sets the underline style for this font, if the font hasn't been initialized
 void uninitialize()
          Resets the initialize flag.
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes, handleContinueRecords
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

pointHeight

private int pointHeight
The point height of this font

colourIndex

private int colourIndex
The index into the colour palette

boldWeight

private int boldWeight
The bold weight for this font (normal or bold)

scriptStyle

private int scriptStyle
The style of the script (italic or normal)

underlineStyle

private int underlineStyle
The underline style for this font (none, single, double etc)

fontFamily

private byte fontFamily
The font family

characterSet

private byte characterSet
The character set

italic

private boolean italic
Indicates whether or not this font is italic

struckout

private boolean struckout
Indicates whether or not this font is struck out

name

private java.lang.String name
The name of this font

initialized

private boolean initialized
Flag to indicate whether the derived data (such as the font index) has been initialized or not

fontIndex

private int fontIndex
The index of this font in the font list

biff7

public static FontRecord.Biff7 biff7
Constructor Detail

FontRecord

protected FontRecord(java.lang.String fn,
                     int ps,
                     int bold,
                     boolean it,
                     int us,
                     int ci,
                     int ss)
Constructor, used when creating a new font for writing out.
Parameters:
bold - the bold indicator
ps - the point size
us - the underline style
fn - the name
it - italicised indicator
c - the colour
ss - the script style

FontRecord

public FontRecord(Record t,
                  WorkbookSettings ws)
Constructs this object from the raw data. Used when reading in a format record
Parameters:
t - the raw data

FontRecord

public FontRecord(Record t,
                  WorkbookSettings ws,
                  FontRecord.Biff7 dummy)
Constructs this object from the raw data. Used when reading in a format record
Parameters:
t - the raw data
dummy -  

FontRecord

protected FontRecord(Font f)
Publicly available copy constructor
Parameters:
the - font to copy
Method Detail

getData

public byte[] getData()
Gets the byte data for writing out
Overrides:
getData in class WritableRecordData
Returns:
the raw data

isInitialized

public final boolean isInitialized()
Accessor to see whether this object is initialized or not.
Returns:
TRUE if this font record has been initialized, FALSE otherwise

initialize

public final void initialize(int pos)
Sets the font index of this record. Called from the FormattingRecords object
Parameters:
pos - the position of this font in the workbooks font list

uninitialize

public final void uninitialize()
Resets the initialize flag. This is called by the constructor of WritableWorkbookImpl to reset the statically declared fonts

getFontIndex

public final int getFontIndex()
Accessor for the font index
Returns:
the font index

setFontPointSize

protected void setFontPointSize(int ps)
Sets the point size for this font, if the font hasn't been initialized
Parameters:
ps - the point size

getPointSize

public int getPointSize()
Gets the point size for this font, if the font hasn't been initialized
Specified by:
getPointSize in interface Font
Returns:
the point size

setFontBoldStyle

protected void setFontBoldStyle(int bs)
Sets the bold style for this font, if the font hasn't been initialized
Parameters:
bs - the bold style

getBoldWeight

public int getBoldWeight()
Gets the bold weight for this font
Specified by:
getBoldWeight in interface Font
Returns:
the bold weight for this font

setFontItalic

protected void setFontItalic(boolean i)
Sets the italic indicator for this font, if the font hasn't been initialized
Parameters:
i - the italic flag

isItalic

public boolean isItalic()
Returns the italic flag
Specified by:
isItalic in interface Font
Returns:
TRUE if this font is italic, FALSE otherwise

setFontUnderlineStyle

protected void setFontUnderlineStyle(int us)
Sets the underline style for this font, if the font hasn't been initialized
Parameters:
us - the underline style

getUnderlineStyle

public UnderlineStyle getUnderlineStyle()
Gets the underline style for this font
Specified by:
getUnderlineStyle in interface Font
Returns:
the underline style

setFontColour

protected void setFontColour(int c)
Sets the colour for this font, if the font hasn't been initialized
Parameters:
cthe - colour

getColour

public Colour getColour()
Gets the colour for this font
Specified by:
getColour in interface Font
Returns:
the colour

setFontScriptStyle

protected void setFontScriptStyle(int ss)
Sets the script style (eg. superscript, subscript) for this font, if the font hasn't been initialized
Parameters:
ss - the colour

getScriptStyle

public ScriptStyle getScriptStyle()
Gets the script style
Specified by:
getScriptStyle in interface Font
Returns:
the script style

getName

public java.lang.String getName()
Gets the name of this font
Specified by:
getName in interface Font
Returns:
the name of this font

equals

public boolean equals(java.lang.Object o)
Standard equals method
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare
Returns:
TRUE if the objects are equal, FALSE otherwise

isStruckout

public boolean isStruckout()
Accessor for the strike out flag
Returns:
TRUE if this font is struck out, FALSE otherwise

setFontStruckout

protected void setFontStruckout(boolean os)
Sets the struck out flag
Parameters:
so - TRUE if the font is struck out, false otherwise