- Timestamp:
- 09/13/18 12:26:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/core/Font.java
r1097 r1124 38 38 39 39 /** Standard constructor. */ 40 public Font(String familyName, Style style, int size, float spacing) 41 { 40 public Font(String familyName, Style style, int size, float spacing) { 42 41 if (familyName == null) familyName = DEFAULT_FAMILY_NAME; 43 42 if (style == null) style = DEFAULT_STYLE; … … 50 49 51 50 /** Convenience constructor. */ 52 public Font(String familyName, Style style, int size) 53 { 51 public Font(String familyName, Style style, int size) { 54 52 this(familyName, style, size, DEFAULT_SPACING); 55 53 } 56 54 57 55 /** Convenience constructor. */ 58 public Font(String familyName, Style style) 59 { 56 public Font(String familyName, Style style) { 60 57 this(familyName, style, DEFAULT_SIZE); 61 58 } 62 59 63 60 /** Convenience constructor. */ 64 public Font(String familyName) 65 { 61 public Font(String familyName) { 66 62 this(familyName, DEFAULT_STYLE); 67 63 } 68 64 69 65 /** Convenience constructor. */ 70 public Font() 71 { 66 public Font() { 72 67 this(DEFAULT_FAMILY_NAME); 73 68 } 74 69 75 70 /** Copy constructor. */ 76 public Font(Font other) 77 { 71 public Font(Font other) { 78 72 _familyName = other._familyName; 79 73 _style = other._style; … … 83 77 84 78 /** Gets the family name of this font. */ 85 public String getFamilyName() 86 { 79 public String getFamilyName() { 87 80 return _familyName; 88 81 } 89 82 90 83 /** Sets the style of this font. */ 91 public Font setStyle(Style style) 92 { 84 public Font setStyle(Style style) { 93 85 _style = style; 94 95 86 return this; 96 87 } 97 88 98 89 /** Gets the style of this font. */ 99 public Style getStyle() 100 { 90 public Style getStyle() { 101 91 return _style; 102 92 } 103 93 104 94 /** Returns true if this font has bold styling. */ 105 public boolean isBold() 106 { 95 public boolean isBold() { 107 96 return _style == Style.BOLD || _style == Style.BOLD_ITALIC; 108 97 } 109 98 110 99 /** Returns true if this font has italic styling. */ 111 public boolean isItalic() 112 { 100 public boolean isItalic() { 113 101 return _style == Style.ITALIC || _style == Style.BOLD_ITALIC; 114 102 } 115 103 116 104 /** Returns true if this font has no bold/italic styling. */ 117 public boolean isPlain() 118 { 105 public boolean isPlain() { 119 106 return _style == Style.PLAIN; 120 107 } 121 108 122 109 /** Removes bold styling if this font has it, or adds if if not. */ 123 public void toggleBold() 124 { 110 public void toggleBold() { 125 111 switch (_style) { 126 112 case PLAIN: … … 140 126 141 127 /** Removes italic styling if this font has it, or adds if if not. */ 142 public void toggleItalic() 143 { 128 public void toggleItalic() { 144 129 switch (_style) { 145 130 case PLAIN: … … 159 144 160 145 /** Sets the size of this font. */ 161 public void setSize(int size) 162 { 146 public void setSize(int size) { 163 147 _size = size; 164 148 } 165 149 166 150 /** Gets the size of this font. */ 167 public int getSize() 168 { 151 public int getSize() { 169 152 return _size; 170 153 } 171 154 172 155 /** Sets the spacing of this font. */ 173 public void setSpacing(float spacing) 174 { 156 public void setSpacing(float spacing) { 175 157 _spacing = spacing; 176 158 } 177 159 178 160 /** Gets the spacing of this font. */ 179 public float getSpacing() 180 { 161 public float getSpacing() { 181 162 return _spacing; 182 163 } 183 164 184 165 @Override 185 public Font clone() 186 { 166 public Font clone() { 187 167 return new Font(this); 188 168 }
Note:
See TracChangeset
for help on using the changeset viewer.