Package org.apache.poi.hssf.record
Class FontRecord
java.lang.Object
org.apache.poi.hssf.record.RecordBase
org.apache.poi.hssf.record.Record
org.apache.poi.hssf.record.StandardRecord
org.apache.poi.hssf.record.FontRecord
- All Implemented Interfaces:
Duplicatable,GenericRecord
Describes a font in the workbook
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final shortstatic final shortstatic final shortstatic final shortstatic final bytestatic final bytestatic final bytestatic final bytestatic final byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneStyleFrom(FontRecord source) Clones all the font style information from another FontRecord, onto this one.copy()booleanshortget the font attributes (see individual bit getters that reference this method)shortget the bold weight for this font (100-1000dec or 0x64-0x3e8).byteget the character setshortget the font's color palette indexprotected intbyteget the font family (TODO)shortgets the height of the font in 1/20th point unitsget the name of the fontshortgetSid()return the non static version of the id for this record.shortget the type of super or subscript for the fontbyteget the type of underlining for the fontinthashCode()booleanisItalic()get whether the font is to be italics or notbooleanwhether 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)booleanwhether 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)booleanget whether the font is to be stricken out or notbooleansameProperties(FontRecord other) Does this FontRecord have all the same font properties as the supplied FontRecord? Note thatequals(Object)will check for exact objects, while this will check for exact contents, because normally the font record's position makes a big difference too.voidWrite the data content of this BIFF record.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(String fn) set the name of the fontvoidsetItalic(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 fontMethods inherited from class org.apache.poi.hssf.record.StandardRecord
getRecordSize, serializeMethods inherited from class org.apache.poi.hssf.record.Record
cloneViaReserialise, serialize, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren
-
Field Details
-
sid
public static final short sid- See Also:
-
SS_NONE
public static final short SS_NONE- See Also:
-
SS_SUPER
public static final short SS_SUPER- See Also:
-
SS_SUB
public static final short SS_SUB- See Also:
-
U_NONE
public static final byte U_NONE- See Also:
-
U_SINGLE
public static final byte U_SINGLE- See Also:
-
U_DOUBLE
public static final byte U_DOUBLE- See Also:
-
U_SINGLE_ACCOUNTING
public static final byte U_SINGLE_ACCOUNTING- See Also:
-
U_DOUBLE_ACCOUNTING
public static final byte U_DOUBLE_ACCOUNTING- See Also:
-
-
Constructor Details
-
FontRecord
public FontRecord() -
FontRecord
-
FontRecord
-
-
Method Details
-
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:
-
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:
-
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:
-
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:
-
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:
-
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- - character set
-
setFontName
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:
-
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:
-
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:
-
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:
-
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:
-
getFamily
public byte getFamily()get the font family (TODO)- Returns:
- family
-
getCharset
public byte getCharset()get the character set- Returns:
- charset - character set
-
getFontName
get the name of the font- Returns:
- fn - name of the font (i.e. "Arial")
-
serialize
Description copied from class:StandardRecordWrite the data content of this BIFF record. The 'ushort sid' and 'ushort size' header fields have already been written by the superclass.The number of bytes written must equal the record size reported by
RecordBase.getRecordSize()} minus four ( record header consisting of a 'ushort sid' and 'ushort reclength' has already been written by their superclass).- Specified by:
serializein classStandardRecord- Parameters:
out- the output object
-
getDataSize
protected int getDataSize()- Specified by:
getDataSizein classStandardRecord
-
getSid
public short getSid()Description copied from class:Recordreturn the non static version of the id for this record. -
cloneStyleFrom
Clones all the font style information from another FontRecord, onto this one. This will then hold all the same font style options.- Parameters:
source- the record to clone the properties from
-
hashCode
public int hashCode() -
sameProperties
Does this FontRecord have all the same font properties as the supplied FontRecord? Note thatequals(Object)will check for exact objects, while this will check for exact contents, because normally the font record's position makes a big difference too.- Parameters:
other- the record to compare with- Returns:
- true, if the properties match
-
equals
-
copy
- Specified by:
copyin interfaceDuplicatable- Specified by:
copyin classStandardRecord- Returns:
- a deep copy of the implementing class / instance
-
getGenericRecordType
- Specified by:
getGenericRecordTypein interfaceGenericRecord- Specified by:
getGenericRecordTypein classRecord
-
getGenericProperties
-