Package loci.poi.hssf.record
Class FontRecord
- java.lang.Object
-
- loci.poi.hssf.record.Record
-
- loci.poi.hssf.record.FontRecord
-
public class FontRecord extends Record
Title: Font Record - descrbes a font in the workbook (index = 0-3,5-infinity - skip 4)Description: An element in the Font Table
REFERENCE: PG 315 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
- Version:
- 2.0-pre
- Author:
- Andrew C. Oliver (acoliver at apache dot org)
-
-
Field Summary
Fields Modifier and Type Field Description static shortsidstatic shortSS_NONEstatic shortSS_SUBstatic shortSS_SUPERstatic byteU_DOUBLEstatic byteU_DOUBLE_ACCOUNTINGstatic byteU_NONEstatic byteU_SINGLEstatic byteU_SINGLE_ACCOUNTING
-
Constructor Summary
Constructors Constructor Description FontRecord()FontRecord(RecordInputStream in)Constructs a Font record and sets its fields appropriately.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfillFields(RecordInputStream in)called by the constructor, should set class level fields.shortgetAttributes()get the font attributes (see individual bit getters that reference this method)shortgetBoldWeight()get the bold weight for this font (100-1000dec or 0x64-0x3e8).bytegetCharset()get the character setshortgetColorPaletteIndex()get the font's color palette indexbytegetFamily()get the font family (TODO)shortgetFontHeight()gets the height of the font in 1/20th point unitsjava.lang.StringgetFontName()get the name of the fontbytegetFontNameLength()get the length of the fontname stringintgetRecordSize()gives the current serialized size of the record.shortgetSid()return the non static version of the id for this record.shortgetSuperSubScript()get the type of super or subscript for the fontbytegetUnderline()get the type of underlining for the fontbooleanisItalic()get whether the font is to be italics or notbooleanisMacoutlined()whether to use the mac outline font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)booleanisMacshadowed()whether to use the mac shado font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)booleanisStruckout()get whether the font is to be stricken out or notintserialize(int offset, byte[] data)called by the class that is responsible for writing this sucker.voidsetAttributes(short attributes)set the font attributes (see individual bit setters that reference this method)voidsetBoldWeight(short bw)set the bold weight for this font (100-1000dec or 0x64-0x3e8).voidsetCharset(byte charset)set the character setvoidsetColorPaletteIndex(short cpi)set the font's color palette indexvoidsetFamily(byte f)set the font family (TODO)voidsetFontHeight(short height)sets the height of the font in 1/20th point unitsvoidsetFontName(java.lang.String fn)set the name of the fontvoidsetFontNameLength(byte len)set the length of the fontname stringvoidsetItalic(boolean italics)set the font to be italics or notvoidsetMacoutline(boolean mac)whether to use the mac outline font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)voidsetMacshadow(boolean mac)whether to use the mac shado font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)voidsetStrikeout(boolean strike)set the font to be stricken out or notvoidsetSuperSubScript(short sss)set the type of super or subscript for the fontvoidsetUnderline(byte u)set the type of underlining for the fontjava.lang.StringtoString()get a string representation of the record (for biffview/debugging)protected voidvalidateSid(short id)called by constructor, should throw runtime exception in the event of a record passed with a differing ID.-
Methods inherited from class loci.poi.hssf.record.Record
clone, isInValueSection, isValue, serialize
-
-
-
-
Field Detail
-
sid
public static final short sid
- See Also:
- Constant Field Values
-
SS_NONE
public static final short SS_NONE
- See Also:
- Constant Field Values
-
SS_SUPER
public static final short SS_SUPER
- See Also:
- Constant Field Values
-
SS_SUB
public static final short SS_SUB
- See Also:
- Constant Field Values
-
U_NONE
public static final byte U_NONE
- See Also:
- Constant Field Values
-
U_SINGLE
public static final byte U_SINGLE
- See Also:
- Constant Field Values
-
U_DOUBLE
public static final byte U_DOUBLE
- See Also:
- Constant Field Values
-
U_SINGLE_ACCOUNTING
public static final byte U_SINGLE_ACCOUNTING
- See Also:
- Constant Field Values
-
U_DOUBLE_ACCOUNTING
public static final byte U_DOUBLE_ACCOUNTING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FontRecord
public FontRecord()
-
FontRecord
public FontRecord(RecordInputStream in)
Constructs a Font record and sets its fields appropriately.- Parameters:
in- the RecordInputstream to read the record from
-
-
Method Detail
-
validateSid
protected void validateSid(short id)
Description copied from class:Recordcalled by constructor, should throw runtime exception in the event of a record passed with a differing ID.- Specified by:
validateSidin classRecord- Parameters:
id- alleged id for this record
-
fillFields
protected void fillFields(RecordInputStream in)
Description copied from class:Recordcalled by the constructor, should set class level fields. Should throw runtime exception for bad/icomplete data.- Specified by:
fillFieldsin classRecord- Parameters:
in- the RecordInputstream to read the record from
-
setFontHeight
public void setFontHeight(short height)
sets the height of the font in 1/20th point units- Parameters:
height- fontheight (in points/20)
-
setAttributes
public void setAttributes(short attributes)
set the font attributes (see individual bit setters that reference this method)- Parameters:
attributes- the bitmask to set
-
setItalic
public void setItalic(boolean italics)
set the font to be italics or not- Parameters:
italics- - whether the font is italics or not- See Also:
setAttributes(short)
-
setStrikeout
public void setStrikeout(boolean strike)
set the font to be stricken out or not- Parameters:
strike- - whether the font is stricken out or not- See Also:
setAttributes(short)
-
setMacoutline
public void setMacoutline(boolean mac)
whether to use the mac outline font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)- Parameters:
mac- - whether to do that mac font outline thing or not- See Also:
setAttributes(short)
-
setMacshadow
public void setMacshadow(boolean mac)
whether to use the mac shado font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)- Parameters:
mac- - whether to do that mac font shadow thing or not- See Also:
setAttributes(short)
-
setColorPaletteIndex
public void setColorPaletteIndex(short cpi)
set the font's color palette index- Parameters:
cpi- - font color index
-
setBoldWeight
public void setBoldWeight(short bw)
set the bold weight for this font (100-1000dec or 0x64-0x3e8). Default is 0x190 for normal and 0x2bc for bold- Parameters:
bw- - a number between 100-1000 for the fonts "boldness"
-
setSuperSubScript
public void setSuperSubScript(short sss)
set the type of super or subscript for the font
-
setUnderline
public void setUnderline(byte u)
set the type of underlining for the font- Parameters:
u- super or subscript option- See Also:
U_NONE,U_SINGLE,U_DOUBLE,U_SINGLE_ACCOUNTING,U_DOUBLE_ACCOUNTING
-
setFamily
public void setFamily(byte f)
set the font family (TODO)- Parameters:
f- family
-
setCharset
public void setCharset(byte charset)
set the character set- Parameters:
charset- - characterset
-
setFontNameLength
public void setFontNameLength(byte len)
set the length of the fontname string- Parameters:
len- length of the font name- See Also:
setFontName(String)
-
setFontName
public void setFontName(java.lang.String fn)
set the name of the font- Parameters:
fn- - name of the font (i.e. "Arial")
-
getFontHeight
public short getFontHeight()
gets the height of the font in 1/20th point units- Returns:
- fontheight (in points/20)
-
getAttributes
public short getAttributes()
get the font attributes (see individual bit getters that reference this method)- Returns:
- attribute - the bitmask
-
isItalic
public boolean isItalic()
get whether the font is to be italics or not- Returns:
- italics - whether the font is italics or not
- See Also:
getAttributes()
-
isStruckout
public boolean isStruckout()
get whether the font is to be stricken out or not- Returns:
- strike - whether the font is stricken out or not
- See Also:
getAttributes()
-
isMacoutlined
public boolean isMacoutlined()
whether to use the mac outline font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)- Returns:
- mac - whether to do that mac font outline thing or not
- See Also:
getAttributes()
-
isMacshadowed
public boolean isMacshadowed()
whether to use the mac shado font style thing (mac only) - Some mac person should comment this instead of me doing it (since I have no idea)- Returns:
- mac - whether to do that mac font shadow thing or not
- See Also:
getAttributes()
-
getColorPaletteIndex
public short getColorPaletteIndex()
get the font's color palette index- Returns:
- cpi - font color index
-
getBoldWeight
public short getBoldWeight()
get the bold weight for this font (100-1000dec or 0x64-0x3e8). Default is 0x190 for normal and 0x2bc for bold- Returns:
- bw - a number between 100-1000 for the fonts "boldness"
-
getSuperSubScript
public short getSuperSubScript()
get the type of super or subscript for the font
-
getUnderline
public byte getUnderline()
get the type of underlining for the font- Returns:
- super or subscript option
- See Also:
U_NONE,U_SINGLE,U_DOUBLE,U_SINGLE_ACCOUNTING,U_DOUBLE_ACCOUNTING
-
getFamily
public byte getFamily()
get the font family (TODO)- Returns:
- family
-
getCharset
public byte getCharset()
get the character set- Returns:
- charset - characterset
-
getFontNameLength
public byte getFontNameLength()
get the length of the fontname string- Returns:
- length of the font name
- See Also:
getFontName()
-
getFontName
public java.lang.String getFontName()
get the name of the font- Returns:
- fn - name of the font (i.e. "Arial")
-
toString
public java.lang.String toString()
Description copied from class:Recordget a string representation of the record (for biffview/debugging)
-
serialize
public int serialize(int offset, byte[] data)Description copied from class:Recordcalled by the class that is responsible for writing this sucker. Subclasses should implement this so that their data is passed back in a byte array.
-
getRecordSize
public int getRecordSize()
Description copied from class:Recordgives the current serialized size of the record. Should include the sid and reclength (4 bytes).- Overrides:
getRecordSizein classRecord
-
-