1 11 package org.eclipse.swt.graphics; 12 13 import org.eclipse.swt.*; 14 15 34 public final class GlyphMetrics { 35 36 39 public int ascent; 40 41 44 public int descent; 45 46 49 public int width; 50 51 59 public GlyphMetrics(int ascent, int descent, int width) { 60 if (ascent < 0 || descent < 0 || width < 0) { 61 SWT.error(SWT.ERROR_INVALID_ARGUMENT); 62 } 63 this.ascent = ascent; 64 this.descent = descent; 65 this.width = width; 66 } 67 68 78 public boolean equals (Object object) { 79 if (object == this) return true; 80 if (!(object instanceof GlyphMetrics)) return false; 81 GlyphMetrics metrics = (GlyphMetrics)object; 82 return metrics.ascent == ascent && metrics.descent == descent && metrics.width == width; 83 } 84 85 95 public int hashCode () { 96 return ascent ^ descent ^ width; 97 } 98 99 105 public String toString () { 106 return "GlyphMetrics {" + ascent + ", " + descent + ", " + width + "}"; } 108 109 } 110 | Popular Tags |