1 11 package org.eclipse.swt.graphics; 12 13 14 23 public final class FontMetrics { 24 int ascent, descent, averageCharWidth, leading, height; 25 26 FontMetrics() { 27 } 28 29 public static FontMetrics carbon_new(int ascent, int descent, int averageCharWidth, int leading, int height) { 30 FontMetrics fontMetrics = new FontMetrics(); 31 fontMetrics.ascent = ascent; 32 fontMetrics.descent = descent; 33 fontMetrics.averageCharWidth = averageCharWidth; 34 fontMetrics.leading = leading; 35 fontMetrics.height = height; 36 return fontMetrics; 37 } 38 39 49 public boolean equals (Object object) { 50 if (object == this) return true; 51 if (!(object instanceof FontMetrics)) return false; 52 FontMetrics metrics = (FontMetrics)object; 53 return ascent == metrics.ascent && descent == metrics.descent && 54 averageCharWidth == metrics.averageCharWidth && leading == metrics.leading && 55 height == metrics.height; 56 } 57 58 66 public int getAscent() { 67 return ascent; 68 } 69 70 76 public int getAverageCharWidth() { 77 return averageCharWidth; 78 } 79 80 88 public int getDescent() { 89 return descent; 90 } 91 92 103 public int getHeight() { 104 return height; 105 } 106 107 114 public int getLeading() { 115 return leading; 116 } 117 118 128 public int hashCode() { 129 return ascent ^ descent ^ averageCharWidth ^ leading ^ height; 130 } 131 132 } 133 | Popular Tags |