Top Description Fields Constructors Methods
org.apache.poi.hssf.record

public final Class FontRecord

extends StandardRecord
Class Inheritance
Imports
java.util.Map, .Objects, java.util.function.Supplier, org.apache.poi.util.BitField, .BitFieldFactory, .GenericRecordUtil, .LittleEndianOutput, .StringUtil

Describes a font in the workbook

Field Summary

Modifier and TypeField and Description
private String
field_11_font_name

possibly empty string never null

private short
private short
private short
private short
private short
private byte
private byte
private byte
private byte
private static final BitField
private static final BitField
private static final BitField
public static final short
public static final short
public static final short
public static final short
private static final BitField
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
public void
cloneStyleFrom(FontRecord
the record to clone the properties from
source
)

Clones all the font style information from another FontRecord, onto this one.

public FontRecord
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public short

Returns:

attribute - the bitmask
getAttributes
()

get the font attributes (see individual bit getters that reference this method)

public short

Returns:

bw - a number between 100-1000 for the fonts "boldness"
getBoldWeight
()

get the bold weight for this font (100-1000dec or 0x64-0x3e8).

public byte

Returns:

charset - character set
getCharset
()

get the character set

public short

Returns:

cpi - font color index
getColorPaletteIndex
()

get the font's color palette index

protected int
public byte

Returns:

family
getFamily
()

get the font family (TODO)

public short

Returns:

fontheight (in points/20)
getFontHeight
()

gets the height of the font in 1/20th point units

public String

Returns:

fn - name of the font (i.e. "Arial")
getFontName
()

get the name of the font

public Map<String, Supplier<?>>
public HSSFRecordTypes
public short
getSid()

Implements abstract org.apache.poi.hssf.record.Record.getSid.

return the non static version of the id for this record.

public short

Returns:

super or subscript option
getSuperSubScript
()

get the type of super or subscript for the font

public byte

Returns:

super or subscript option
getUnderline
()

get the type of underlining for the font

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

italics - whether the font is italics or not
isItalic
()

get whether the font is to be italics or not

public boolean

Returns:

mac - whether to do that mac font outline thing or not
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)

public boolean

Returns:

mac - whether to do that mac font shadow thing or not
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)

public boolean

Returns:

strike - whether the font is stricken out or not
isStruckout
()

get whether the font is to be stricken out or not

public boolean

Returns:

true, if the properties match
sameProperties
(FontRecord
the record to compare with
other
)

Does this FontRecord have all the same font properties as the supplied FontRecord?

public void
serialize(LittleEndianOutput
the output object
out
)

Implements abstract org.apache.poi.hssf.record.StandardRecord.serialize.

Write the data content of this BIFF record.

public void
setAttributes(short
the bitmask to set
attributes
)

set the font attributes (see individual bit setters that reference this method)

public void
setBoldWeight(short
- a number between 100-1000 for the fonts "boldness"
bw
)

set the bold weight for this font (100-1000dec or 0x64-0x3e8).

public void
setCharset(byte
- character set
charset
)

set the character set

public void
setColorPaletteIndex(short
- font color index
cpi
)

set the font's color palette index

public void
setFamily(byte
family
f
)

set the font family (TODO)

public void
setFontHeight(short
fontheight (in points/20)
height
)

sets the height of the font in 1/20th point units

public void
setFontName(String
- name of the font (i.e. "Arial")
fn
)

set the name of the font

public void
setItalic(boolean
- whether the font is italics or not
italics
)

set the font to be italics or not

public void
setMacoutline(boolean
- whether to do that mac font outline thing or not
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)

public void
setMacshadow(boolean
- whether to do that mac font shadow thing or not
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)

public void
setStrikeout(boolean
- whether the font is stricken out or not
strike
)

set the font to be stricken out or not

public void
setSuperSubScript(short
super or subscript option
sss
)

set the type of super or subscript for the font

public void
setUnderline(byte
super or subscript option
u
)

set the type of underlining for the font

Inherited from org.apache.poi.hssf.record.StandardRecord:
getRecordSizeserialize

Field Detail

field_11_font_nameback to summary
private String field_11_font_name

possibly empty string never null

field_1_font_heightback to summary
private short field_1_font_height
field_2_attributesback to summary
private short field_2_attributes
field_3_color_palette_indexback to summary
private short field_3_color_palette_index
field_4_bold_weightback to summary
private short field_4_bold_weight
field_5_super_sub_scriptback to summary
private short field_5_super_sub_script
field_6_underlineback to summary
private byte field_6_underline
field_7_familyback to summary
private byte field_7_family
field_8_charsetback to summary
private byte field_8_charset
field_9_zeroback to summary
private byte field_9_zero
italicback to summary
private static final BitField italic
macoutlineback to summary
private static final BitField macoutline
macshadowback to summary
private static final BitField macshadow
sidback to summary
public static final short sid
SS_NONEback to summary
public static final short SS_NONE
SS_SUBback to summary
public static final short SS_SUB
SS_SUPERback to summary
public static final short SS_SUPER
strikeoutback to summary
private static final BitField strikeout
U_DOUBLEback to summary
public static final byte U_DOUBLE
U_DOUBLE_ACCOUNTINGback to summary
public static final byte U_DOUBLE_ACCOUNTING
U_NONEback to summary
public static final byte U_NONE
U_SINGLEback to summary
public static final byte U_SINGLE
U_SINGLE_ACCOUNTINGback to summary
public static final byte U_SINGLE_ACCOUNTING

Constructor Detail

FontRecordback to summary
public FontRecord()
FontRecordback to summary
public FontRecord(FontRecord other)
FontRecordback to summary
public FontRecord(RecordInputStream in)

Method Detail

cloneStyleFromback to summary
public void cloneStyleFrom(FontRecord source)

Clones all the font style information from another FontRecord, onto this one. This will then hold all the same font style options.

Parameters
source:FontRecord

the record to clone the properties from

copyback to summary
public FontRecord copy()

Implements abstract org.apache.poi.hssf.record.StandardRecord.copy.

Implements org.apache.poi.common.Duplicatable.copy.

Returns:FontRecord

Doc from org.apache.poi.common.Duplicatable.copy.

a deep copy of the implementing class / instance

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getAttributesback to summary
public short getAttributes()

get the font attributes (see individual bit getters that reference this method)

Returns:short

attribute - the bitmask

getBoldWeightback to summary
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:short

bw - a number between 100-1000 for the fonts "boldness"

getCharsetback to summary
public byte getCharset()

get the character set

Returns:byte

charset - character set

getColorPaletteIndexback to summary
public short getColorPaletteIndex()

get the font's color palette index

Returns:short

cpi - font color index

getDataSizeback to summary
protected int getDataSize()

Implements abstract org.apache.poi.hssf.record.StandardRecord.getDataSize.

getFamilyback to summary
public byte getFamily()

get the font family (TODO)

Returns:byte

family

getFontHeightback to summary
public short getFontHeight()

gets the height of the font in 1/20th point units

Returns:short

fontheight (in points/20)

getFontNameback to summary
public String getFontName()

get the name of the font

Returns:String

fn - name of the font (i.e. "Arial")

getGenericPropertiesback to summary
public Map<String, Supplier<?>> getGenericProperties()

Implements org.apache.poi.common.usermodel.GenericRecord.getGenericProperties.

Annotations
@Override
getGenericRecordTypeback to summary
public HSSFRecordTypes getGenericRecordType()

Overrides default org.apache.poi.common.usermodel.GenericRecord.getGenericRecordType.

Implements abstract org.apache.poi.hssf.record.Record.getGenericRecordType.

Annotations
@Override
getSidback to summary
public short getSid()

Implements abstract org.apache.poi.hssf.record.Record.getSid.

Doc from org.apache.poi.hssf.record.Record.getSid.

return the non static version of the id for this record.

Returns:short

he id for this record

getSuperSubScriptback to summary
public short getSuperSubScript()

get the type of super or subscript for the font

Returns:short

super or subscript option

See Also
SS_NONE, SS_SUPER, SS_SUB
getUnderlineback to summary
public byte getUnderline()

get the type of underlining for the font

Returns:byte

super or subscript option

See Also
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

isItalicback to summary
public boolean isItalic()

get whether the font is to be italics or not

Returns:boolean

italics - whether the font is italics or not

See Also
getAttributes()
isMacoutlinedback to summary
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:boolean

mac - whether to do that mac font outline thing or not

See Also
getAttributes()
isMacshadowedback to summary
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:boolean

mac - whether to do that mac font shadow thing or not

See Also
getAttributes()
isStruckoutback to summary
public boolean isStruckout()

get whether the font is to be stricken out or not

Returns:boolean

strike - whether the font is stricken out or not

See Also
getAttributes()
samePropertiesback to summary
public boolean sameProperties(FontRecord other)

Does this FontRecord have all the same font properties as the supplied FontRecord? Note that equals(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:FontRecord

the record to compare with

Returns:boolean

true, if the properties match

serializeback to summary
public void serialize(LittleEndianOutput out)

Implements abstract org.apache.poi.hssf.record.StandardRecord.serialize.

Doc from org.apache.poi.hssf.record.StandardRecord.serialize.

Write 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 org.apache.poi.hssf.record.Record#getRecordSize()} minus four ( record header consisting of a 'ushort sid' and 'ushort reclength' has already been written by their superclass).

Parameters
out:LittleEndianOutput

the output object

setAttributesback to summary
public void setAttributes(short attributes)

set the font attributes (see individual bit setters that reference this method)

Parameters
attributes:short

the bitmask to set

setBoldWeightback to summary
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:short

- a number between 100-1000 for the fonts "boldness"

setCharsetback to summary
public void setCharset(byte charset)

set the character set

Parameters
charset:byte

- character set

setColorPaletteIndexback to summary
public void setColorPaletteIndex(short cpi)

set the font's color palette index

Parameters
cpi:short

- font color index

setFamilyback to summary
public void setFamily(byte f)

set the font family (TODO)

Parameters
f:byte

family

setFontHeightback to summary
public void setFontHeight(short height)

sets the height of the font in 1/20th point units

Parameters
height:short

fontheight (in points/20)

setFontNameback to summary
public void setFontName(String fn)

set the name of the font

Parameters
fn:String

- name of the font (i.e. "Arial")

setItalicback to summary
public void setItalic(boolean italics)

set the font to be italics or not

Parameters
italics:boolean

- whether the font is italics or not

See Also
setAttributes(short)
setMacoutlineback to summary
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:boolean

- whether to do that mac font outline thing or not

See Also
setAttributes(short)
setMacshadowback to summary
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:boolean

- whether to do that mac font shadow thing or not

See Also
setAttributes(short)
setStrikeoutback to summary
public void setStrikeout(boolean strike)

set the font to be stricken out or not

Parameters
strike:boolean

- whether the font is stricken out or not

See Also
setAttributes(short)
setSuperSubScriptback to summary
public void setSuperSubScript(short sss)

set the type of super or subscript for the font

Parameters
sss:short

super or subscript option

See Also
SS_NONE, SS_SUPER, SS_SUB
setUnderlineback to summary
public void setUnderline(byte u)

set the type of underlining for the font

Parameters
u:byte

super or subscript option

See Also
U_NONE, U_SINGLE, U_DOUBLE, U_SINGLE_ACCOUNTING, U_DOUBLE_ACCOUNTING