1 50 51 package com.lowagie.text.rtf; 52 53 import java.awt.Color ; 54 55 import com.lowagie.text.Font; 56 57 67 public class RtfFont extends Font { 68 71 private String familyName = ""; 72 73 78 public RtfFont(String familyName) { 79 super(Font.UNDEFINED); 80 this.familyName = familyName; 81 } 82 83 89 public RtfFont(String familyName, float size) { 90 super(Font.UNDEFINED, size); 91 this.familyName = familyName; 92 } 93 94 101 public RtfFont(String familyName, float size, int style) { 102 super(Font.UNDEFINED, size, style); 103 this.familyName = familyName; 104 } 105 106 114 public RtfFont(String familyName, float size, int style, Color color) { 115 super(Font.UNDEFINED, size, style, color); 116 this.familyName = familyName; 117 } 118 119 124 public String getFamilyname() { 125 return this.familyName; 126 } 127 128 135 public Font difference(Font font) { 136 String dFamilyname = font.getFamilyname(); 137 if(dFamilyname == null || dFamilyname.trim().equals("")) { 138 dFamilyname = this.familyName; 139 } 140 141 float dSize = font.getSize(); 142 if(dSize == Font.UNDEFINED) { 143 dSize = this.getSize(); 144 } 145 146 int dStyle = Font.UNDEFINED; 147 if(this.getStyle() != Font.UNDEFINED && font.getStyle() != Font.UNDEFINED) { 148 dStyle = this.getStyle() | font.getStyle(); 149 } else if(this.getStyle() != Font.UNDEFINED) { 150 dStyle = this.getStyle(); 151 } else if(font.getStyle() != Font.UNDEFINED) { 152 dStyle = font.getStyle(); 153 } 154 155 Color dColor = font.getColor(); 156 if(dColor == null) { 157 dColor = this.getColor(); 158 } 159 160 return new RtfFont(dFamilyname, dSize, dStyle, dColor); 161 } 162 } 163 | Popular Tags |