1 19 20 package swingwt.awt.font; 21 22 import swingwt.awt.geom.AffineTransform; 23 24 public class FontRenderContext { 25 private AffineTransform tx; 26 private boolean bIsAntiAliased; 27 private boolean bUsesFractionalMetrics; 28 29 protected FontRenderContext() { 30 } 31 32 public FontRenderContext(AffineTransform tx, 33 boolean isAntiAliased, 34 boolean usesFractionalMetrics) { 35 if (tx != null && !tx.isIdentity()) { 36 this.tx = new AffineTransform(tx); 37 } 38 this.bIsAntiAliased = isAntiAliased; 39 this.bUsesFractionalMetrics = usesFractionalMetrics; 40 } 41 42 public AffineTransform getTransform() { 43 return (tx == null) ? new AffineTransform() : new AffineTransform(tx); 44 } 45 46 public boolean isAntiAliased() { 47 return this.bIsAntiAliased; 48 } 49 50 public boolean usesFractionalMetrics() { 51 return this.bUsesFractionalMetrics; 52 } 53 54 public boolean equals(FontRenderContext rhs) { 55 if (this == rhs) { 56 return true; 57 } 58 if (rhs != null && 59 rhs.bIsAntiAliased == bIsAntiAliased && 60 rhs.bUsesFractionalMetrics == bUsesFractionalMetrics) { 61 return tx == null ? rhs.tx == null : tx.equals(rhs.tx); 62 } 63 return false; 64 } 65 } 66 | Popular Tags |