public virtual Font Difference(Font font) {
if (font == null) return this;
// size
float dSize = font.size;
if (dSize == UNDEFINED) {
dSize = this.size;
}
// style
int dStyle = UNDEFINED;
int style1 = this.Style;
int style2 = font.Style;
if (style1 != UNDEFINED || style2 != UNDEFINED) {
if (style1 == UNDEFINED) style1 = 0;
if (style2 == UNDEFINED) style2 = 0;
dStyle = style1 | style2;
}
// color
object dColor = (Color)font.Color;
if (dColor == null) {
dColor = this.Color;
}
// family
if (font.baseFont != null) {
return new Font(font.BaseFont, dSize, dStyle, (Color)dColor);
}
if (font.Family != UNDEFINED) {
return new Font(font.Family, dSize, dStyle, (Color)dColor);
}
if (this.baseFont != null) {
if (dStyle == style1) {
return new Font(this.BaseFont, dSize, dStyle, (Color)dColor);
}
else {
return FontFactory.GetFont(this.Familyname, dSize, dStyle, (Color)dColor);
}
}
return new Font(this.Family, dSize, dStyle, (Color)dColor);
}
}