Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / jssun / font / FontDesignMetrics.js
index 6bf2670..735c47a 100644 (file)
-Clazz.declarePackage ("jssun.font");\r
-Clazz.load (["java.awt.FontMetrics", "java.util.Hashtable"], "jssun.font.FontDesignMetrics", ["java.lang.IndexOutOfBoundsException", "java.awt.Toolkit", "swingjs.JSToolkit"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.ascent = 0;\r
-this.descent = 0;\r
-this.leading = 0;\r
-this.height = -1;\r
-Clazz.instantialize (this, arguments);\r
-}, jssun.font, "FontDesignMetrics", java.awt.FontMetrics);\r
-c$.getMetrics = Clazz.defineMethod (c$, "getMetrics", \r
-function (font) {\r
-var m = null;\r
-var r;\r
-r = jssun.font.FontDesignMetrics.metricsCache.get (font);\r
-if (r != null) {\r
-m = r.get ();\r
-}if (m == null) {\r
-m =  new jssun.font.FontDesignMetrics (font);\r
-jssun.font.FontDesignMetrics.metricsCache.put (font,  new jssun.font.FontDesignMetrics.KeyReference (font, m));\r
-}for (var i = 0; i < jssun.font.FontDesignMetrics.recentMetrics.length; i++) {\r
-if (jssun.font.FontDesignMetrics.recentMetrics[i] === m) {\r
-return m;\r
-}}\r
-{\r
-jssun.font.FontDesignMetrics.recentMetrics[jssun.font.FontDesignMetrics.recentIndex++] = m;\r
-if (jssun.font.FontDesignMetrics.recentIndex == 5) {\r
-jssun.font.FontDesignMetrics.recentIndex = 0;\r
-}}return m;\r
-}, "java.awt.Font");\r
-Clazz.makeConstructor (c$, \r
- function (font) {\r
-Clazz.superConstructor (this, jssun.font.FontDesignMetrics, [font]);\r
-this.font = font;\r
-this.initMatrixAndMetrics ();\r
-}, "java.awt.Font");\r
-Clazz.defineMethod (c$, "initMatrixAndMetrics", \r
- function () {\r
-{\r
-//need to calculate ascent, descent, leading, and maxAdvance\r
-}});\r
-Clazz.defineMethod (c$, "charWidth", \r
-function (ch) {\r
-var s = "";\r
-{\r
-s = "" + ch;\r
-}return this.stringWidth (s);\r
-}, "~S");\r
-Clazz.overrideMethod (c$, "stringWidth", \r
-function (str) {\r
-return Clazz.doubleToInt (0.5 + this.getWidth (str));\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getWidth", \r
- function (str) {\r
-return swingjs.JSToolkit.getStringWidth (null, this.font, str);\r
-}, "~S");\r
-Clazz.overrideMethod (c$, "charsWidth", \r
-function (data, off, len) {\r
-var width = 0;\r
-if (len < 0) {\r
-throw  new IndexOutOfBoundsException ("len=" + len);\r
-}var limit = off + len;\r
-for (var i = off; i < limit; i++) {\r
-var ch = data[i];\r
-width += this.stringWidth ("" + ch);\r
-}\r
-return Clazz.doubleToInt (0.5 + width);\r
-}, "~A,~N,~N");\r
-Clazz.overrideMethod (c$, "getWidths", \r
-function () {\r
-var widths =  Clazz.newIntArray (256, 0);\r
-return widths;\r
-});\r
-Clazz.defineMethod (c$, "getAscent", \r
-function () {\r
-if (this.ascent == 0) this.ascent = java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (this.font).getAscent ();\r
-return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.ascent);\r
-});\r
-Clazz.defineMethod (c$, "getDescent", \r
-function () {\r
-if (this.descent == 0) this.descent = java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (this.font).getDescent ();\r
-return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent);\r
-});\r
-Clazz.overrideMethod (c$, "getLeading", \r
-function () {\r
-return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent + this.leading) - Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent);\r
-});\r
-Clazz.overrideMethod (c$, "getHeight", \r
-function () {\r
-if (this.height < 0) {\r
-this.height = this.getAscent () + Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent + this.leading);\r
-}return this.height;\r
-});\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.key = null;\r
-this.val = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jssun.font.FontDesignMetrics, "KeyReference");\r
-Clazz.makeConstructor (c$, \r
-function (a, b) {\r
-this.key = a;\r
-this.val = b;\r
-}, "~O,~O");\r
-Clazz.defineMethod (c$, "get", \r
-function () {\r
-return this.val;\r
-});\r
-Clazz.defineMethod (c$, "dispose", \r
-function () {\r
-if (jssun.font.FontDesignMetrics.metricsCache.get (this.key) === this) {\r
-jssun.font.FontDesignMetrics.metricsCache.remove (this.key);\r
-}});\r
-c$ = Clazz.p0p ();\r
-Clazz.defineStatics (c$,\r
-"roundingUpValue", 0.95);\r
-c$.metricsCache = c$.prototype.metricsCache =  new java.util.Hashtable ();\r
-Clazz.defineStatics (c$,\r
-"MAXRECENT", 5);\r
-c$.recentMetrics = c$.prototype.recentMetrics =  new Array (5);\r
-Clazz.defineStatics (c$,\r
-"recentIndex", 0);\r
-});\r
+Clazz.declarePackage ("jssun.font");
+Clazz.load (["java.awt.FontMetrics", "java.util.Hashtable"], "jssun.font.FontDesignMetrics", ["java.lang.IndexOutOfBoundsException", "java.awt.Toolkit", "swingjs.JSToolkit"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.ascent = 0;
+this.descent = 0;
+this.leading = 0;
+this.height = -1;
+Clazz.instantialize (this, arguments);
+}, jssun.font, "FontDesignMetrics", java.awt.FontMetrics);
+c$.getMetrics = Clazz.defineMethod (c$, "getMetrics", 
+function (font) {
+var m = null;
+var r;
+r = jssun.font.FontDesignMetrics.metricsCache.get (font);
+if (r != null) {
+m = r.get ();
+}if (m == null) {
+m =  new jssun.font.FontDesignMetrics (font);
+jssun.font.FontDesignMetrics.metricsCache.put (font,  new jssun.font.FontDesignMetrics.KeyReference (font, m));
+}for (var i = 0; i < jssun.font.FontDesignMetrics.recentMetrics.length; i++) {
+if (jssun.font.FontDesignMetrics.recentMetrics[i] === m) {
+return m;
+}}
+{
+jssun.font.FontDesignMetrics.recentMetrics[jssun.font.FontDesignMetrics.recentIndex++] = m;
+if (jssun.font.FontDesignMetrics.recentIndex == 5) {
+jssun.font.FontDesignMetrics.recentIndex = 0;
+}}return m;
+}, "java.awt.Font");
+Clazz.makeConstructor (c$, 
+ function (font) {
+Clazz.superConstructor (this, jssun.font.FontDesignMetrics, [font]);
+this.font = font;
+this.initMatrixAndMetrics ();
+}, "java.awt.Font");
+Clazz.defineMethod (c$, "initMatrixAndMetrics", 
+ function () {
+{
+//need to calculate ascent, descent, leading, and maxAdvance
+}});
+Clazz.defineMethod (c$, "charWidth", 
+function (ch) {
+var s = "";
+{
+s = "" + ch;
+}return this.stringWidth (s);
+}, "~S");
+Clazz.overrideMethod (c$, "stringWidth", 
+function (str) {
+return Clazz.doubleToInt (0.5 + this.getWidth (str));
+}, "~S");
+Clazz.defineMethod (c$, "getWidth", 
+ function (str) {
+return swingjs.JSToolkit.getStringWidth (null, this.font, str);
+}, "~S");
+Clazz.overrideMethod (c$, "charsWidth", 
+function (data, off, len) {
+var width = 0;
+if (len < 0) {
+throw  new IndexOutOfBoundsException ("len=" + len);
+}var limit = off + len;
+for (var i = off; i < limit; i++) {
+var ch = data[i];
+width += this.stringWidth ("" + ch);
+}
+return Clazz.doubleToInt (0.5 + width);
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "getWidths", 
+function () {
+var widths =  Clazz.newIntArray (256, 0);
+return widths;
+});
+Clazz.defineMethod (c$, "getAscent", 
+function () {
+if (this.ascent == 0) this.ascent = java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (this.font).getAscent ();
+return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.ascent);
+});
+Clazz.defineMethod (c$, "getDescent", 
+function () {
+if (this.descent == 0) this.descent = java.awt.Toolkit.getDefaultToolkit ().getFontMetrics (this.font).getDescent ();
+return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent);
+});
+Clazz.overrideMethod (c$, "getLeading", 
+function () {
+return Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent + this.leading) - Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent);
+});
+Clazz.overrideMethod (c$, "getHeight", 
+function () {
+if (this.height < 0) {
+this.height = this.getAscent () + Clazz.floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent + this.leading);
+}return this.height;
+});
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+this.key = null;
+this.val = null;
+Clazz.instantialize (this, arguments);
+}, jssun.font.FontDesignMetrics, "KeyReference");
+Clazz.makeConstructor (c$, 
+function (a, b) {
+this.key = a;
+this.val = b;
+}, "~O,~O");
+Clazz.defineMethod (c$, "get", 
+function () {
+return this.val;
+});
+Clazz.defineMethod (c$, "dispose", 
+function () {
+if (jssun.font.FontDesignMetrics.metricsCache.get (this.key) === this) {
+jssun.font.FontDesignMetrics.metricsCache.remove (this.key);
+}});
+c$ = Clazz.p0p ();
+Clazz.defineStatics (c$,
+"roundingUpValue", 0.95);
+c$.metricsCache = c$.prototype.metricsCache =  new java.util.Hashtable ();
+Clazz.defineStatics (c$,
+"MAXRECENT", 5);
+c$.recentMetrics = c$.prototype.recentMetrics =  new Array (5);
+Clazz.defineStatics (c$,
+"recentIndex", 0);
+});