| Method from org.apache.cocoon.poi.hssf.record.FontRecord Detail: |
protected void fillFields(byte[] data,
short size,
int offset) {
field_1_font_height = LittleEndian.getShort(data, 0 + offset);
field_2_attributes = LittleEndian.getShort(data, 2 + offset);
field_3_color_palette_index = LittleEndian.getShort(data, 4 + offset);
field_4_bold_weight = LittleEndian.getShort(data, 6 + offset);
field_5_super_sub_script = LittleEndian.getShort(data, 8 + offset);
field_6_underline = data[ 10 + offset ];
field_7_family = data[ 11 + offset ];
field_8_charset = data[ 12 + offset ];
field_9_zero = data[ 13 + offset ];
field_10_font_name_len = data[ 14 + offset ];
if (field_10_font_name_len > 0)
{
if (data[ 15 ] == 0)
{ // is compressed unicode
field_11_font_name = new String(data, 16,
field_10_font_name_len);
}
else
{ // is not compressed unicode
field_11_font_name = StringUtil.getFromUnicode(data, 15,
field_10_font_name_len);
}
}
}
|
public short getAttributes() {
return field_2_attributes;
}
get the font attributes (see individual bit getters that reference this method) |
public short getBoldWeight() {
return field_4_bold_weight;
}
get the bold weight for this font (100-1000dec or 0x64-0x3e8). Default is
0x190 for normal and 0x2bc for bold |
public byte getCharset() {
return field_8_charset;
}
|
public short getColorPaletteIndex() {
return field_3_color_palette_index;
}
get the font's color palette index |
public byte getFamily() {
return field_7_family;
}
get the font family (TODO) |
public short getFontHeight() {
return field_1_font_height;
}
gets the height of the font in 1/20th point units |
public String getFontName() {
return field_11_font_name;
}
|
public byte getFontNameLength() {
return field_10_font_name_len;
}
get the length of the fontname string |
public short getSid() {
return this.sid;
}
|
public short getSuperSubScript() {
return field_5_super_sub_script;
}
get the type of super or subscript for the font |
public byte getUnderline() {
return field_6_underline;
}
get the type of underlining for the font |
public boolean isItalic() {
return italic.isSet(field_2_attributes);
}
get whether the font is to be italics or not |
public boolean isMacoutlined() {
return macoutline.isSet(field_2_attributes);
}
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 isMacshadowed() {
return macshadow.isSet(field_2_attributes);
}
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 isStruckout() {
return strikeout.isSet(field_2_attributes);
}
get whether the font is to be stricken out or not |
public byte[] serialize() {
int realflen = getFontNameLength() * 2;
byte[] retval = new byte[ 19 + realflen + 1 ];
LittleEndian.putShort(retval, 0, sid);
LittleEndian.putShort(
retval, 2,
( short ) (15 + realflen
+ 1)); // 19 - 4 (sid/len) + font name length = datasize
// undocumented single byte (1)
LittleEndian.putShort(retval, 4, getFontHeight());
LittleEndian.putShort(retval, 6, getAttributes());
LittleEndian.putShort(retval, 8, getColorPaletteIndex());
LittleEndian.putShort(retval, 10, getBoldWeight());
LittleEndian.putShort(retval, 12, getSuperSubScript());
retval[ 14 ] = getUnderline();
retval[ 15 ] = getFamily();
retval[ 16 ] = getCharset();
retval[ 17 ] = (( byte ) 0);
retval[ 18 ] = getFontNameLength();
retval[ 19 ] = ( byte ) 1;
StringUtil.putUncompressedUnicode(getFontName(), retval, 20);
return retval;
}
|
public void setAttributes(short attributes) {
field_2_attributes = attributes;
}
set the font attributes (see individual bit setters that reference this method) |
public void setBoldWeight(short bw) {
field_4_bold_weight = bw;
}
set the bold weight for this font (100-1000dec or 0x64-0x3e8). Default is
0x190 for normal and 0x2bc for bold |
public void setCharset(byte charset) {
field_8_charset = charset;
}
|
public void setColorPaletteIndex(short cpi) {
field_3_color_palette_index = cpi;
}
set the font's color palette index |
public void setFamily(byte f) {
field_7_family = f;
}
set the font family (TODO) |
public void setFontHeight(short height) {
field_1_font_height = height;
}
sets the height of the font in 1/20th point units |
public void setFontName(String fn) {
field_11_font_name = fn;
}
|
public void setFontNameLength(byte len) {
field_10_font_name_len = len;
}
set the length of the fontname string |
public void setItalic(boolean italics) {
italic.setShortBoolean(field_2_attributes, italics);
}
set the font to be italics or not |
public void setMacoutline(boolean mac) {
macoutline.setShortBoolean(field_2_attributes, 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 mac) {
macshadow.setShortBoolean(field_2_attributes, 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 strike) {
strikeout.setShortBoolean(field_2_attributes, strike);
}
set the font to be stricken out or not |
public void setSuperSubScript(short sss) {
field_5_super_sub_script = sss;
}
set the type of super or subscript for the font |
public void setUnderline(byte u) {
field_6_underline = u;
}
set the type of underlining for the font |
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[FONT]\n");
buffer.append(" .fontheight = ")
.append(Integer.toHexString(getFontHeight())).append("\n");
buffer.append(" .attributes = ")
.append(Integer.toHexString(getAttributes())).append("\n");
buffer.append(" .italic = ").append(isItalic())
.append("\n");
buffer.append(" .strikout = ").append(isStruckout())
.append("\n");
buffer.append(" .macoutlined= ").append(isMacoutlined())
.append("\n");
buffer.append(" .macshadowed= ").append(isMacshadowed())
.append("\n");
buffer.append(" .colorpalette = ")
.append(Integer.toHexString(getColorPaletteIndex())).append("\n");
buffer.append(" .boldweight = ")
.append(Integer.toHexString(getBoldWeight())).append("\n");
buffer.append(" .supersubscript = ")
.append(Integer.toHexString(getSuperSubScript())).append("\n");
buffer.append(" .underline = ")
.append(Integer.toHexString(getUnderline())).append("\n");
buffer.append(" .family = ")
.append(Integer.toHexString(getFamily())).append("\n");
buffer.append(" .charset = ")
.append(Integer.toHexString(getCharset())).append("\n");
buffer.append(" .namelength = ")
.append(Integer.toHexString(getFontNameLength())).append("\n");
buffer.append(" .fontname = ").append(getFontName())
.append("\n");
buffer.append("[/FONT]\n");
return buffer.toString();
}
|
protected void validateSid(short id) {
if (id != sid)
{
throw new RecordFormatException("NOT A FONT RECORD");
}
}
|