Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / font / FontRenderContext.js
1 Clazz.declarePackage ("java.awt.font");
2 Clazz.load (null, "java.awt.font.FontRenderContext", ["java.awt.RenderingHints", "java.awt.geom.AffineTransform"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.tx = null;
5 this.aaHintValue = null;
6 this.fmHintValue = null;
7 this.defaulting = false;
8 Clazz.instantialize (this, arguments);
9 }, java.awt.font, "FontRenderContext");
10 Clazz.makeConstructor (c$, 
11 function () {
12 this.defaulting = true;
13 });
14 Clazz.makeConstructor (c$, 
15 function (tx, isAntiAliased, usesFractionalMetrics) {
16 if (tx != null && !tx.isIdentity ()) {
17 this.tx =  new java.awt.geom.AffineTransform (tx);
18 }}, "java.awt.geom.AffineTransform,~B,~B");
19 Clazz.makeConstructor (c$, 
20 function (tx, aaHint, fmHint) {
21 if (tx != null && !tx.isIdentity ()) {
22 this.tx =  new java.awt.geom.AffineTransform (tx);
23 }this.aaHintValue = aaHint;
24 this.fmHintValue = fmHint;
25 }, "java.awt.geom.AffineTransform,~O,~O");
26 Clazz.defineMethod (c$, "isTransformed", 
27 function () {
28 if (!this.defaulting) {
29 return this.tx != null;
30 } else {
31 return !this.getTransform ().isIdentity ();
32 }});
33 Clazz.defineMethod (c$, "getTransformType", 
34 function () {
35 if (!this.defaulting) {
36 if (this.tx == null) {
37 return 0;
38 } else {
39 return this.tx.getType ();
40 }} else {
41 return this.getTransform ().getType ();
42 }});
43 Clazz.defineMethod (c$, "getTransform", 
44 function () {
45 return (this.tx == null) ?  new java.awt.geom.AffineTransform () :  new java.awt.geom.AffineTransform (this.tx);
46 });
47 Clazz.defineMethod (c$, "isAntiAliased", 
48 function () {
49 return !(this.aaHintValue === java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_OFF || this.aaHintValue === java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
50 });
51 Clazz.defineMethod (c$, "usesFractionalMetrics", 
52 function () {
53 return !(this.fmHintValue === java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_OFF || this.fmHintValue === java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT);
54 });
55 Clazz.defineMethod (c$, "getAntiAliasingHint", 
56 function () {
57 if (this.defaulting) {
58 if (this.isAntiAliased ()) {
59 return java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
60 } else {
61 return java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
62 }}return this.aaHintValue;
63 });
64 Clazz.defineMethod (c$, "getFractionalMetricsHint", 
65 function () {
66 if (this.defaulting) {
67 if (this.usesFractionalMetrics ()) {
68 return java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON;
69 } else {
70 return java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_OFF;
71 }}return this.fmHintValue;
72 });
73 Clazz.defineMethod (c$, "equals", 
74 function (obj) {
75 try {
76 return this.equals (obj);
77 } catch (e) {
78 if (Clazz.exceptionOf (e, ClassCastException)) {
79 return false;
80 } else {
81 throw e;
82 }
83 }
84 }, "~O");
85 Clazz.defineMethod (c$, "equals", 
86 function (rhs) {
87 if (this === rhs) {
88 return true;
89 }if (rhs == null) {
90 return false;
91 }if (!rhs.defaulting && !this.defaulting) {
92 if (rhs.aaHintValue === this.aaHintValue && rhs.fmHintValue === this.fmHintValue) {
93 return this.tx == null ? rhs.tx == null : this.tx.equals (rhs.tx);
94 }return false;
95 } else {
96 return rhs.getAntiAliasingHint () === this.getAntiAliasingHint () && rhs.getFractionalMetricsHint () === this.getFractionalMetricsHint () && rhs.getTransform ().equals (this.getTransform ());
97 }}, "java.awt.font.FontRenderContext");
98 Clazz.defineMethod (c$, "hashCode", 
99 function () {
100 var hash = this.tx == null ? 0 : this.tx.hashCode ();
101 if (this.defaulting) {
102 hash += this.getAntiAliasingHint ().hashCode ();
103 hash += this.getFractionalMetricsHint ().hashCode ();
104 } else {
105 hash += this.aaHintValue.hashCode ();
106 hash += this.fmHintValue.hashCode ();
107 }return hash;
108 });
109 });