Add boolean getters/setters for bold to font, matching italic and underline, plus matching xssf

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1638954 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2014-11-12 19:11:20 +00:00
parent d43ba17fe9
commit 7b6f10e705
2 changed files with 21 additions and 4 deletions

View File

@ -206,24 +206,41 @@ public final class HSSFFont implements Font {
* @see #BOLDWEIGHT_NORMAL * @see #BOLDWEIGHT_NORMAL
* @see #BOLDWEIGHT_BOLD * @see #BOLDWEIGHT_BOLD
*/ */
public void setBoldweight(short boldweight) public void setBoldweight(short boldweight)
{ {
font.setBoldWeight(boldweight); font.setBoldWeight(boldweight);
} }
/**
* sets the font to be bold or not
*/
public void setBold(boolean bold)
{
if (bold)
font.setBoldWeight(BOLDWEIGHT_BOLD);
else
font.setBoldWeight(BOLDWEIGHT_NORMAL);
}
/** /**
* get the boldness to use * get the boldness to use
* @return boldweight * @return boldweight
* @see #BOLDWEIGHT_NORMAL * @see #BOLDWEIGHT_NORMAL
* @see #BOLDWEIGHT_BOLD * @see #BOLDWEIGHT_BOLD
*/ */
public short getBoldweight() public short getBoldweight()
{ {
return font.getBoldWeight(); return font.getBoldWeight();
} }
/**
* get if the font is bold or not
*/
public boolean getBold()
{
return getBoldweight() == BOLDWEIGHT_BOLD;
}
/** /**
* set normal,super or subscript. * set normal,super or subscript.
* @param offset type to use (none,super,sub) * @param offset type to use (none,super,sub)

View File

@ -277,8 +277,8 @@ public interface Font {
public short getIndex(); public short getIndex();
public void setBoldweight(short boldweight); public void setBoldweight(short boldweight);
public void setBold(boolean bold);
public short getBoldweight(); public short getBoldweight();
public boolean getBold();
} }