KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwt > awt > font > FontRenderContext


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: FontRenderContext.java,v $
11    Revision 1.2 2004/04/21 10:44:06 bobintetley
12    Code cleanup and native build script fix
13
14    Revision 1.1 2004/01/15 15:20:29 bobintetley
15    Java2D work
16
17
18 */

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