public Font difference(Font font) {
String dFamilyname = font.getFamilyname();
if(dFamilyname == null || dFamilyname.trim().equals("")) {
dFamilyname = this.familyName;
}
float dSize = font.size();
if(dSize == Font.UNDEFINED) {
dSize = this.size();
}
int dStyle = Font.UNDEFINED;
if(this.style() != Font.UNDEFINED && font.style() != Font.UNDEFINED) {
dStyle = this.style() | font.style();
} else if(this.style() != Font.UNDEFINED) {
dStyle = this.style();
} else if(font.style() != Font.UNDEFINED) {
dStyle = font.style();
}
Color dColor = font.color();
if(dColor == null) {
dColor = this.color();
}
return new RtfFont(dFamilyname, dSize, dStyle, dColor);
}
Replaces the attributes that are equal to null with
the attributes of a given font. |