20541613da46d12ef46fbca54e3bf889e2c6635b
[jalviewjs.git] / site / swingjs / j2s / jssun / font / AttributeValues.js
1 Clazz.declarePackage ("jssun.font");
2 Clazz.load (["jssun.font.EAttribute"], "jssun.font.AttributeValues", ["java.lang.Boolean", "$.Float", "$.InternalError", "$.Number", "$.StringBuilder", "java.util.HashMap", "java.awt.font.TextAttribute", "java.awt.geom.AffineTransform", "$.Point2D", "jssun.font.AttributeMap"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.defined = 0;
5 this.nondefault = 0;
6 this.family = "Default";
7 this.weight = 1;
8 this.width = 1;
9 this.posture = 0;
10 this.size = 12;
11 this.tracking = 0;
12 this.transform = null;
13 this.foreground = null;
14 this.background = null;
15 this.justification = 1;
16 this.imHighlight = null;
17 this.font = null;
18 this.imUnderline = -1;
19 this.superscript = 0;
20 this.underline = -1;
21 this.runDirection = -2;
22 this.bidiEmbedding = 0;
23 this.kerning = 0;
24 this.ligatures = 0;
25 this.strikethrough = false;
26 this.swapColors = false;
27 this.baselineTransform = null;
28 this.charTransform = null;
29 Clazz.instantialize (this, arguments);
30 }, jssun.font, "AttributeValues", null, Cloneable);
31 Clazz.defineMethod (c$, "getFamily", 
32 function () {
33 return this.family;
34 });
35 Clazz.defineMethod (c$, "setFamily", 
36 function (f) {
37 this.family = f;
38 this.update (jssun.font.EAttribute.EFAMILY);
39 }, "~S");
40 Clazz.defineMethod (c$, "getWeight", 
41 function () {
42 return this.weight;
43 });
44 Clazz.defineMethod (c$, "setWeight", 
45 function (f) {
46 this.weight = f;
47 this.update (jssun.font.EAttribute.EWEIGHT);
48 }, "~N");
49 Clazz.defineMethod (c$, "getWidth", 
50 function () {
51 return this.width;
52 });
53 Clazz.defineMethod (c$, "setWidth", 
54 function (f) {
55 this.width = f;
56 this.update (jssun.font.EAttribute.EWIDTH);
57 }, "~N");
58 Clazz.defineMethod (c$, "getPosture", 
59 function () {
60 return this.posture;
61 });
62 Clazz.defineMethod (c$, "setPosture", 
63 function (f) {
64 this.posture = f;
65 this.update (jssun.font.EAttribute.EPOSTURE);
66 }, "~N");
67 Clazz.defineMethod (c$, "getSize", 
68 function () {
69 return this.size;
70 });
71 Clazz.defineMethod (c$, "setSize", 
72 function (f) {
73 this.size = f;
74 this.update (jssun.font.EAttribute.ESIZE);
75 }, "~N");
76 Clazz.defineMethod (c$, "getTransform", 
77 function () {
78 return this.transform;
79 });
80 Clazz.defineMethod (c$, "setTransform", 
81 function (f) {
82 this.transform = (f == null || f.isIdentity ()) ? jssun.font.AttributeValues.DEFAULT.transform :  new java.awt.geom.AffineTransform (f);
83 this.updateDerivedTransforms ();
84 this.update (jssun.font.EAttribute.ETRANSFORM);
85 }, "java.awt.geom.AffineTransform");
86 Clazz.defineMethod (c$, "getSuperscript", 
87 function () {
88 return this.superscript;
89 });
90 Clazz.defineMethod (c$, "setSuperscript", 
91 function (f) {
92 this.superscript = f;
93 this.update (jssun.font.EAttribute.ESUPERSCRIPT);
94 }, "~N");
95 Clazz.defineMethod (c$, "getFont", 
96 function () {
97 return this.font;
98 });
99 Clazz.defineMethod (c$, "setFont", 
100 function (f) {
101 this.font = f;
102 this.update (jssun.font.EAttribute.EFONT);
103 }, "java.awt.Font");
104 Clazz.defineMethod (c$, "getForeground", 
105 function () {
106 return this.foreground;
107 });
108 Clazz.defineMethod (c$, "setForeground", 
109 function (f) {
110 this.foreground = f;
111 this.update (jssun.font.EAttribute.EFOREGROUND);
112 }, "java.awt.Paint");
113 Clazz.defineMethod (c$, "getBackground", 
114 function () {
115 return this.background;
116 });
117 Clazz.defineMethod (c$, "setBackground", 
118 function (f) {
119 this.background = f;
120 this.update (jssun.font.EAttribute.EBACKGROUND);
121 }, "java.awt.Paint");
122 Clazz.defineMethod (c$, "getUnderline", 
123 function () {
124 return this.underline;
125 });
126 Clazz.defineMethod (c$, "setUnderline", 
127 function (f) {
128 this.underline = f;
129 this.update (jssun.font.EAttribute.EUNDERLINE);
130 }, "~N");
131 Clazz.defineMethod (c$, "getStrikethrough", 
132 function () {
133 return this.strikethrough;
134 });
135 Clazz.defineMethod (c$, "setStrikethrough", 
136 function (f) {
137 this.strikethrough = f;
138 this.update (jssun.font.EAttribute.ESTRIKETHROUGH);
139 }, "~B");
140 Clazz.defineMethod (c$, "getRunDirection", 
141 function () {
142 return this.runDirection;
143 });
144 Clazz.defineMethod (c$, "setRunDirection", 
145 function (f) {
146 this.runDirection = f;
147 this.update (jssun.font.EAttribute.ERUN_DIRECTION);
148 }, "~N");
149 Clazz.defineMethod (c$, "getBidiEmbedding", 
150 function () {
151 return this.bidiEmbedding;
152 });
153 Clazz.defineMethod (c$, "setBidiEmbedding", 
154 function (f) {
155 this.bidiEmbedding = f;
156 this.update (jssun.font.EAttribute.EBIDI_EMBEDDING);
157 }, "~N");
158 Clazz.defineMethod (c$, "getJustification", 
159 function () {
160 return this.justification;
161 });
162 Clazz.defineMethod (c$, "setJustification", 
163 function (f) {
164 this.justification = f;
165 this.update (jssun.font.EAttribute.EJUSTIFICATION);
166 }, "~N");
167 Clazz.defineMethod (c$, "getInputMethodHighlight", 
168 function () {
169 return this.imHighlight;
170 });
171 Clazz.defineMethod (c$, "setInputMethodHighlight", 
172 function (f) {
173 this.imHighlight = f;
174 this.update (jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT);
175 }, "java.text.Annotation");
176 Clazz.defineMethod (c$, "getInputMethodUnderline", 
177 function () {
178 return this.imUnderline;
179 });
180 Clazz.defineMethod (c$, "setInputMethodUnderline", 
181 function (f) {
182 this.imUnderline = f;
183 this.update (jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE);
184 }, "~N");
185 Clazz.defineMethod (c$, "getSwapColors", 
186 function () {
187 return this.swapColors;
188 });
189 Clazz.defineMethod (c$, "setSwapColors", 
190 function (f) {
191 this.swapColors = f;
192 this.update (jssun.font.EAttribute.ESWAP_COLORS);
193 }, "~B");
194 Clazz.defineMethod (c$, "getKerning", 
195 function () {
196 return this.kerning;
197 });
198 Clazz.defineMethod (c$, "setKerning", 
199 function (f) {
200 this.kerning = f;
201 this.update (jssun.font.EAttribute.EKERNING);
202 }, "~N");
203 Clazz.defineMethod (c$, "getTracking", 
204 function () {
205 return this.tracking;
206 });
207 Clazz.defineMethod (c$, "setTracking", 
208 function (f) {
209 this.tracking = Clazz.floatToByte (f);
210 this.update (jssun.font.EAttribute.ETRACKING);
211 }, "~N");
212 Clazz.defineMethod (c$, "getLigatures", 
213 function () {
214 return this.ligatures;
215 });
216 Clazz.defineMethod (c$, "setLigatures", 
217 function (f) {
218 this.ligatures = f;
219 this.update (jssun.font.EAttribute.ELIGATURES);
220 }, "~N");
221 Clazz.defineMethod (c$, "getBaselineTransform", 
222 function () {
223 return this.baselineTransform;
224 });
225 Clazz.defineMethod (c$, "getCharTransform", 
226 function () {
227 return this.charTransform;
228 });
229 c$.getMask = Clazz.defineMethod (c$, "getMask", 
230 function (att) {
231 return att.mask;
232 }, "jssun.font.EAttribute");
233 c$.getMask = Clazz.defineMethod (c$, "getMask", 
234 function (atts) {
235 var mask = 0;
236 for (var a, $a = 0, $$a = atts; $a < $$a.length && ((a = $$a[$a]) || true); $a++) {
237 mask |= a.mask;
238 }
239 return mask;
240 }, "~A");
241 Clazz.defineMethod (c$, "unsetDefault", 
242 function () {
243 this.defined &= this.nondefault;
244 });
245 Clazz.defineMethod (c$, "defineAll", 
246 function (mask) {
247 this.defined |= mask;
248 if ((this.defined & jssun.font.EAttribute.EBASELINE_TRANSFORM.mask) != 0) {
249 throw  new InternalError ("can't define derived attribute");
250 }}, "~N");
251 Clazz.defineMethod (c$, "allDefined", 
252 function (mask) {
253 return (this.defined & mask) == mask;
254 }, "~N");
255 Clazz.defineMethod (c$, "anyDefined", 
256 function (mask) {
257 return (this.defined & mask) != 0;
258 }, "~N");
259 Clazz.defineMethod (c$, "anyNonDefault", 
260 function (mask) {
261 return (this.nondefault & mask) != 0;
262 }, "~N");
263 Clazz.defineMethod (c$, "isDefined", 
264 function (a) {
265 return (this.defined & a.mask) != 0;
266 }, "jssun.font.EAttribute");
267 Clazz.defineMethod (c$, "isNonDefault", 
268 function (a) {
269 return (this.nondefault & a.mask) != 0;
270 }, "jssun.font.EAttribute");
271 Clazz.defineMethod (c$, "setDefault", 
272 function (a) {
273 if (a.att == null) {
274 throw  new InternalError ("can't set default derived attribute: " + a);
275 }this.i_set (a, jssun.font.AttributeValues.DEFAULT);
276 this.defined |= a.mask;
277 this.nondefault &= ~a.mask;
278 }, "jssun.font.EAttribute");
279 Clazz.defineMethod (c$, "unset", 
280 function (a) {
281 if (a.att == null) {
282 throw  new InternalError ("can't unset derived attribute: " + a);
283 }this.i_set (a, jssun.font.AttributeValues.DEFAULT);
284 this.defined &= ~a.mask;
285 this.nondefault &= ~a.mask;
286 }, "jssun.font.EAttribute");
287 Clazz.defineMethod (c$, "set", 
288 function (a, src) {
289 if (a.att == null) {
290 throw  new InternalError ("can't set derived attribute: " + a);
291 }if (src == null || src === jssun.font.AttributeValues.DEFAULT) {
292 this.setDefault (a);
293 } else {
294 if ((src.defined & a.mask) != 0) {
295 this.i_set (a, src);
296 this.update (a);
297 }}}, "jssun.font.EAttribute,jssun.font.AttributeValues");
298 Clazz.defineMethod (c$, "set", 
299 function (a, o) {
300 if (a.att == null) {
301 throw  new InternalError ("can't set derived attribute: " + a);
302 }if (o != null) {
303 try {
304 this.i_set (a, o);
305 this.update (a);
306 return;
307 } catch (e) {
308 if (Clazz.exceptionOf (e, Exception)) {
309 } else {
310 throw e;
311 }
312 }
313 }this.setDefault (a);
314 }, "jssun.font.EAttribute,~O");
315 Clazz.defineMethod (c$, "get", 
316 function (a) {
317 if (a.att == null) {
318 throw  new InternalError ("can't get derived attribute: " + a);
319 }if ((this.nondefault & a.mask) != 0) {
320 return this.i_get (a);
321 }return null;
322 }, "jssun.font.EAttribute");
323 Clazz.defineMethod (c$, "merge", 
324 function (map) {
325 return this.merge (map, jssun.font.AttributeValues.MASK_ALL);
326 }, "java.util.Map");
327 Clazz.defineMethod (c$, "merge", 
328 function (map, mask) {
329 if (Clazz.instanceOf (map, jssun.font.AttributeMap) && (map).getValues () != null) {
330 this.merge ((map).getValues (), mask);
331 } else if (map != null && !map.isEmpty ()) {
332 for (var e, $e = map.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
333 var ea = jssun.font.EAttribute.forAttribute (e.getKey ());
334 if (ea != null && (mask & ea.mask) != 0) {
335 this.set (ea, e.getValue ());
336 }}
337 }return this;
338 }, "java.util.Map,~N");
339 Clazz.defineMethod (c$, "merge", 
340 function (src) {
341 return this.merge (src, jssun.font.AttributeValues.MASK_ALL);
342 }, "jssun.font.AttributeValues");
343 Clazz.defineMethod (c$, "merge", 
344 function (src, mask) {
345 var m = mask & src.defined;
346 for (var ea, $ea = 0, $$ea = jssun.font.EAttribute.atts; $ea < $$ea.length && ((ea = $$ea[$ea]) || true); $ea++) {
347 if (m == 0) {
348 break;
349 }if ((m & ea.mask) != 0) {
350 m &= ~ea.mask;
351 this.i_set (ea, src);
352 this.update (ea);
353 }}
354 return this;
355 }, "jssun.font.AttributeValues,~N");
356 c$.fromMap = Clazz.defineMethod (c$, "fromMap", 
357 function (map) {
358 return jssun.font.AttributeValues.fromMap (map, jssun.font.AttributeValues.MASK_ALL);
359 }, "java.util.Map");
360 c$.fromMap = Clazz.defineMethod (c$, "fromMap", 
361 function (map, mask) {
362 return  new jssun.font.AttributeValues ().merge (map, mask);
363 }, "java.util.Map,~N");
364 Clazz.defineMethod (c$, "toMap", 
365 function (fill) {
366 if (fill == null) {
367 fill =  new java.util.HashMap ();
368 }for (var m = this.defined, i = 0; m != 0; ++i) {
369 var ea = jssun.font.EAttribute.atts[i];
370 if ((m & ea.mask) != 0) {
371 m &= ~ea.mask;
372 fill.put (ea.att, this.get (ea));
373 }}
374 return fill;
375 }, "java.util.Map");
376 c$.is16Hashtable = Clazz.defineMethod (c$, "is16Hashtable", 
377 function (ht) {
378 return ht.containsKey ("sun.font.attributevalues.defined_key");
379 }, "java.util.Hashtable");
380 c$.fromSerializableHashtable = Clazz.defineMethod (c$, "fromSerializableHashtable", 
381 function (ht) {
382 var result =  new jssun.font.AttributeValues ();
383 if (ht != null && !ht.isEmpty ()) {
384 for (var e, $e = ht.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
385 var key = e.getKey ();
386 var val = e.getValue ();
387 if (key.equals ("sun.font.attributevalues.defined_key")) {
388 result.defineAll ((val).intValue ());
389 } else {
390 try {
391 var ea = jssun.font.EAttribute.forAttribute (key);
392 if (ea != null) {
393 result.set (ea, val);
394 }} catch (ex) {
395 if (Clazz.exceptionOf (ex, ClassCastException)) {
396 } else {
397 throw ex;
398 }
399 }
400 }}
401 }return result;
402 }, "java.util.Hashtable");
403 Clazz.overrideMethod (c$, "hashCode", 
404 function () {
405 return this.defined << 8 ^ this.nondefault;
406 });
407 Clazz.defineMethod (c$, "equals", 
408 function (rhs) {
409 try {
410 return this.equals (rhs);
411 } catch (e) {
412 if (Clazz.exceptionOf (e, ClassCastException)) {
413 } else {
414 throw e;
415 }
416 }
417 return false;
418 }, "~O");
419 Clazz.defineMethod (c$, "equals", 
420 function (rhs) {
421 if (rhs == null) return false;
422 if (rhs === this) return true;
423 return this.defined == rhs.defined && this.nondefault == rhs.nondefault && this.underline == rhs.underline && this.strikethrough == rhs.strikethrough && this.superscript == rhs.superscript && this.width == rhs.width && this.kerning == rhs.kerning && this.tracking == rhs.tracking && this.ligatures == rhs.ligatures && this.runDirection == rhs.runDirection && this.bidiEmbedding == rhs.bidiEmbedding && this.swapColors == rhs.swapColors && jssun.font.AttributeValues.equals (this.transform, rhs.transform) && jssun.font.AttributeValues.equals (new Float (this.justification), new Float (rhs.justification)) && this.size == rhs.size && this.weight == rhs.weight && this.posture == rhs.posture && jssun.font.AttributeValues.equals (this.family, rhs.family) && jssun.font.AttributeValues.equals (this.font, rhs.font) && this.imUnderline == rhs.imUnderline && jssun.font.AttributeValues.equals (this.imHighlight, rhs.imHighlight);
424 }, "jssun.font.AttributeValues");
425 Clazz.defineMethod (c$, "clone", 
426 function () {
427 try {
428 var result = Clazz.superCall (this, jssun.font.AttributeValues, "clone", []);
429 if (this.transform != null) {
430 result.transform =  new java.awt.geom.AffineTransform (this.transform);
431 result.updateDerivedTransforms ();
432 }return result;
433 } catch (e) {
434 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
435 return null;
436 } else {
437 throw e;
438 }
439 }
440 });
441 Clazz.overrideMethod (c$, "toString", 
442 function () {
443 var b =  new StringBuilder ();
444 b.append ('{');
445 for (var m = this.defined, i = 0; m != 0; ++i) {
446 var ea = jssun.font.EAttribute.atts[i];
447 if ((m & ea.mask) != 0) {
448 m &= ~ea.mask;
449 if (b.length () > 1) {
450 b.append (", ");
451 }b.append (ea);
452 b.append ('=');
453 switch (ea) {
454 case jssun.font.EAttribute.EFAMILY:
455 b.append ('"');
456 b.append (this.family);
457 b.append ('"');
458 break;
459 case jssun.font.EAttribute.EWEIGHT:
460 b.append (this.weight);
461 break;
462 case jssun.font.EAttribute.EWIDTH:
463 b.append (this.width);
464 break;
465 case jssun.font.EAttribute.EPOSTURE:
466 b.append (this.posture);
467 break;
468 case jssun.font.EAttribute.ESIZE:
469 b.append (this.size);
470 break;
471 case jssun.font.EAttribute.ETRANSFORM:
472 b.append (this.transform);
473 break;
474 case jssun.font.EAttribute.ESUPERSCRIPT:
475 b.append ("" + this.superscript);
476 break;
477 case jssun.font.EAttribute.EFONT:
478 b.append (this.font);
479 break;
480 case jssun.font.EAttribute.EUNDERLINE:
481 b.append ("" + this.underline);
482 break;
483 case jssun.font.EAttribute.ESTRIKETHROUGH:
484 b.append (this.strikethrough);
485 break;
486 case jssun.font.EAttribute.ERUN_DIRECTION:
487 b.append ("" + this.runDirection);
488 break;
489 case jssun.font.EAttribute.EBIDI_EMBEDDING:
490 b.append ("" + this.bidiEmbedding);
491 break;
492 case jssun.font.EAttribute.EJUSTIFICATION:
493 b.append (this.justification);
494 break;
495 case jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT:
496 b.append (this.imHighlight);
497 break;
498 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
499 b.append ("" + this.imUnderline);
500 break;
501 case jssun.font.EAttribute.ESWAP_COLORS:
502 b.append (this.swapColors);
503 break;
504 case jssun.font.EAttribute.EKERNING:
505 b.append (this.kerning);
506 break;
507 case jssun.font.EAttribute.ELIGATURES:
508 b.append (this.ligatures);
509 break;
510 case jssun.font.EAttribute.ETRACKING:
511 b.append (this.tracking);
512 break;
513 default:
514 throw  new InternalError ();
515 }
516 if ((this.nondefault & ea.mask) == 0) {
517 b.append ('*');
518 }}}
519 b.append ("[btx=" + this.baselineTransform + ", ctx=" + this.charTransform + "]");
520 b.append ('}');
521 return b.toString ();
522 });
523 c$.equals = Clazz.defineMethod (c$, "equals", 
524  function (lhs, rhs) {
525 return lhs == null ? rhs == null : lhs.equals (rhs);
526 }, "~O,~O");
527 Clazz.defineMethod (c$, "update", 
528  function (a) {
529 this.defined |= a.mask;
530 if (this.i_validate (a)) {
531 if (this.i_equals (a, jssun.font.AttributeValues.DEFAULT)) {
532 this.nondefault &= ~a.mask;
533 } else {
534 this.nondefault |= a.mask;
535 }} else {
536 this.setDefault (a);
537 }}, "jssun.font.EAttribute");
538 Clazz.defineMethod (c$, "i_set", 
539  function (a, src) {
540 switch (a) {
541 case jssun.font.EAttribute.EFAMILY:
542 this.family = src.family;
543 break;
544 case jssun.font.EAttribute.EWEIGHT:
545 this.weight = src.weight;
546 break;
547 case jssun.font.EAttribute.EWIDTH:
548 this.width = src.width;
549 break;
550 case jssun.font.EAttribute.EPOSTURE:
551 this.posture = src.posture;
552 break;
553 case jssun.font.EAttribute.ESIZE:
554 this.size = src.size;
555 break;
556 case jssun.font.EAttribute.ETRANSFORM:
557 this.transform = src.transform;
558 this.updateDerivedTransforms ();
559 break;
560 case jssun.font.EAttribute.ESUPERSCRIPT:
561 this.superscript = src.superscript;
562 break;
563 case jssun.font.EAttribute.EFONT:
564 this.font = src.font;
565 break;
566 case jssun.font.EAttribute.EUNDERLINE:
567 this.underline = src.underline;
568 break;
569 case jssun.font.EAttribute.ESTRIKETHROUGH:
570 this.strikethrough = src.strikethrough;
571 break;
572 case jssun.font.EAttribute.ERUN_DIRECTION:
573 this.runDirection = src.runDirection;
574 break;
575 case jssun.font.EAttribute.EBIDI_EMBEDDING:
576 this.bidiEmbedding = src.bidiEmbedding;
577 break;
578 case jssun.font.EAttribute.EJUSTIFICATION:
579 this.justification = src.justification;
580 break;
581 case jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT:
582 this.imHighlight = src.imHighlight;
583 break;
584 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
585 this.imUnderline = src.imUnderline;
586 break;
587 case jssun.font.EAttribute.ESWAP_COLORS:
588 this.swapColors = src.swapColors;
589 break;
590 case jssun.font.EAttribute.EKERNING:
591 this.kerning = src.kerning;
592 break;
593 case jssun.font.EAttribute.ELIGATURES:
594 this.ligatures = src.ligatures;
595 break;
596 case jssun.font.EAttribute.ETRACKING:
597 this.tracking = src.tracking;
598 break;
599 default:
600 throw  new InternalError ();
601 }
602 }, "jssun.font.EAttribute,jssun.font.AttributeValues");
603 Clazz.defineMethod (c$, "i_equals", 
604  function (a, src) {
605 switch (a) {
606 case jssun.font.EAttribute.EFAMILY:
607 return jssun.font.AttributeValues.equals (this.family, src.family);
608 case jssun.font.EAttribute.EWEIGHT:
609 return this.weight == src.weight;
610 case jssun.font.EAttribute.EWIDTH:
611 return this.width == src.width;
612 case jssun.font.EAttribute.EPOSTURE:
613 return this.posture == src.posture;
614 case jssun.font.EAttribute.ESIZE:
615 return this.size == src.size;
616 case jssun.font.EAttribute.ETRANSFORM:
617 return jssun.font.AttributeValues.equals (this.transform, src.transform);
618 case jssun.font.EAttribute.ESUPERSCRIPT:
619 return this.superscript == src.superscript;
620 case jssun.font.EAttribute.EFONT:
621 return jssun.font.AttributeValues.equals (this.font, src.font);
622 case jssun.font.EAttribute.EUNDERLINE:
623 return this.underline == src.underline;
624 case jssun.font.EAttribute.ESTRIKETHROUGH:
625 return this.strikethrough == src.strikethrough;
626 case jssun.font.EAttribute.ERUN_DIRECTION:
627 return this.runDirection == src.runDirection;
628 case jssun.font.EAttribute.EBIDI_EMBEDDING:
629 return this.bidiEmbedding == src.bidiEmbedding;
630 case jssun.font.EAttribute.EJUSTIFICATION:
631 return this.justification == src.justification;
632 case jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT:
633 return jssun.font.AttributeValues.equals (this.imHighlight, src.imHighlight);
634 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
635 return this.imUnderline == src.imUnderline;
636 case jssun.font.EAttribute.ESWAP_COLORS:
637 return this.swapColors == src.swapColors;
638 case jssun.font.EAttribute.EKERNING:
639 return this.kerning == src.kerning;
640 case jssun.font.EAttribute.ELIGATURES:
641 return this.ligatures == src.ligatures;
642 case jssun.font.EAttribute.ETRACKING:
643 return this.tracking == src.tracking;
644 default:
645 throw  new InternalError ();
646 }
647 }, "jssun.font.EAttribute,jssun.font.AttributeValues");
648 Clazz.defineMethod (c$, "i_set", 
649  function (a, o) {
650 switch (a) {
651 case jssun.font.EAttribute.EFAMILY:
652 this.family = (o).trim ();
653 break;
654 case jssun.font.EAttribute.EWEIGHT:
655 this.weight = (o).floatValue ();
656 break;
657 case jssun.font.EAttribute.EWIDTH:
658 this.width = (o).floatValue ();
659 break;
660 case jssun.font.EAttribute.EPOSTURE:
661 this.posture = (o).floatValue ();
662 break;
663 case jssun.font.EAttribute.ESIZE:
664 this.size = (o).floatValue ();
665 break;
666 case jssun.font.EAttribute.ESUPERSCRIPT:
667 this.superscript = (o).intValue ();
668 break;
669 case jssun.font.EAttribute.EFONT:
670 this.font = o;
671 break;
672 case jssun.font.EAttribute.EUNDERLINE:
673 this.underline = (o).intValue ();
674 break;
675 case jssun.font.EAttribute.ESTRIKETHROUGH:
676 this.strikethrough = (o).booleanValue ();
677 break;
678 case jssun.font.EAttribute.ERUN_DIRECTION:
679 {
680 if (Clazz.instanceOf (o, Boolean)) {
681 this.runDirection = (java.awt.font.TextAttribute.RUN_DIRECTION_LTR.equals (o) ? 0 : 1);
682 } else {
683 this.runDirection = (o).intValue ();
684 }}break;
685 case jssun.font.EAttribute.EBIDI_EMBEDDING:
686 this.bidiEmbedding = (o).intValue ();
687 break;
688 case jssun.font.EAttribute.EJUSTIFICATION:
689 this.justification = (o).floatValue ();
690 break;
691 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
692 this.imUnderline = (o).intValue ();
693 break;
694 case jssun.font.EAttribute.ESWAP_COLORS:
695 this.swapColors = (o).booleanValue ();
696 break;
697 case jssun.font.EAttribute.EKERNING:
698 this.kerning = (o).intValue ();
699 break;
700 case jssun.font.EAttribute.ELIGATURES:
701 this.ligatures = (o).intValue ();
702 break;
703 case jssun.font.EAttribute.ETRACKING:
704 this.tracking = (o).floatValue ();
705 break;
706 default:
707 throw  new InternalError ();
708 }
709 }, "jssun.font.EAttribute,~O");
710 Clazz.defineMethod (c$, "i_get", 
711  function (a) {
712 switch (a) {
713 case jssun.font.EAttribute.EFAMILY:
714 return this.family;
715 case jssun.font.EAttribute.EWEIGHT:
716 return Float.$valueOf (this.weight);
717 case jssun.font.EAttribute.EWIDTH:
718 return Float.$valueOf (this.width);
719 case jssun.font.EAttribute.EPOSTURE:
720 return Float.$valueOf (this.posture);
721 case jssun.font.EAttribute.ESIZE:
722 return Float.$valueOf (this.size);
723 case jssun.font.EAttribute.ESUPERSCRIPT:
724 return Integer.$valueOf (this.superscript);
725 case jssun.font.EAttribute.EFONT:
726 return this.font;
727 case jssun.font.EAttribute.EUNDERLINE:
728 return Integer.$valueOf (this.underline);
729 case jssun.font.EAttribute.ESTRIKETHROUGH:
730 return Boolean.$valueOf (this.strikethrough);
731 case jssun.font.EAttribute.ERUN_DIRECTION:
732 {
733 switch (this.runDirection) {
734 case 0:
735 return java.awt.font.TextAttribute.RUN_DIRECTION_LTR;
736 case 1:
737 return java.awt.font.TextAttribute.RUN_DIRECTION_RTL;
738 default:
739 return null;
740 }
741 }case jssun.font.EAttribute.EBIDI_EMBEDDING:
742 return Integer.$valueOf (this.bidiEmbedding);
743 case jssun.font.EAttribute.EJUSTIFICATION:
744 return Float.$valueOf (this.justification);
745 case jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT:
746 return this.imHighlight;
747 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
748 return Integer.$valueOf (this.imUnderline);
749 case jssun.font.EAttribute.ESWAP_COLORS:
750 return Boolean.$valueOf (this.swapColors);
751 case jssun.font.EAttribute.EKERNING:
752 return Integer.$valueOf (this.kerning);
753 case jssun.font.EAttribute.ELIGATURES:
754 return Integer.$valueOf (this.ligatures);
755 case jssun.font.EAttribute.ETRACKING:
756 return Float.$valueOf (this.tracking);
757 default:
758 throw  new InternalError ();
759 }
760 }, "jssun.font.EAttribute");
761 Clazz.defineMethod (c$, "i_validate", 
762  function (a) {
763 switch (a) {
764 case jssun.font.EAttribute.EFAMILY:
765 if (this.family == null || this.family.length == 0) this.family = jssun.font.AttributeValues.DEFAULT.family;
766 return true;
767 case jssun.font.EAttribute.EWEIGHT:
768 return this.weight > 0 && this.weight < 10;
769 case jssun.font.EAttribute.EWIDTH:
770 return this.width >= .5 && this.width < 10;
771 case jssun.font.EAttribute.EPOSTURE:
772 return this.posture >= -1 && this.posture <= 1;
773 case jssun.font.EAttribute.ESIZE:
774 return this.size >= 0;
775 case jssun.font.EAttribute.ETRANSFORM:
776 if (this.transform != null && this.transform.isIdentity ()) this.transform = jssun.font.AttributeValues.DEFAULT.transform;
777 return true;
778 case jssun.font.EAttribute.ESUPERSCRIPT:
779 return this.superscript >= -7 && this.superscript <= 7;
780 case jssun.font.EAttribute.EFONT:
781 return true;
782 case jssun.font.EAttribute.ECHAR_REPLACEMENT:
783 return true;
784 case jssun.font.EAttribute.EFOREGROUND:
785 return true;
786 case jssun.font.EAttribute.EBACKGROUND:
787 return true;
788 case jssun.font.EAttribute.EUNDERLINE:
789 return this.underline >= -1 && this.underline < 6;
790 case jssun.font.EAttribute.ESTRIKETHROUGH:
791 return true;
792 case jssun.font.EAttribute.ERUN_DIRECTION:
793 return this.runDirection >= -2 && this.runDirection <= 1;
794 case jssun.font.EAttribute.EBIDI_EMBEDDING:
795 return this.bidiEmbedding >= -61 && this.bidiEmbedding < 62;
796 case jssun.font.EAttribute.EJUSTIFICATION:
797 this.justification = Math.max (0, Math.min (this.justification, 1));
798 return true;
799 case jssun.font.EAttribute.EINPUT_METHOD_HIGHLIGHT:
800 return true;
801 case jssun.font.EAttribute.EINPUT_METHOD_UNDERLINE:
802 return this.imUnderline >= -1 && this.imUnderline < 6;
803 case jssun.font.EAttribute.ESWAP_COLORS:
804 return true;
805 case jssun.font.EAttribute.ENUMERIC_SHAPING:
806 return true;
807 case jssun.font.EAttribute.EKERNING:
808 return this.kerning >= 0 && this.kerning <= 1;
809 case jssun.font.EAttribute.ELIGATURES:
810 return this.ligatures >= 0 && this.ligatures <= 1;
811 case jssun.font.EAttribute.ETRACKING:
812 return this.tracking >= -1 && this.tracking <= 10;
813 default:
814 throw  new InternalError ("unknown attribute: " + a);
815 }
816 }, "jssun.font.EAttribute");
817 c$.getJustification = Clazz.defineMethod (c$, "getJustification", 
818 function (map) {
819 if (map != null) {
820 if (Clazz.instanceOf (map, jssun.font.AttributeMap) && (map).getValues () != null) {
821 return (map).getValues ().justification;
822 }var obj = map.get (java.awt.font.TextAttribute.JUSTIFICATION);
823 if (obj != null && Clazz.instanceOf (obj, Number)) {
824 return Math.max (0, Math.min (1, (obj).floatValue ()));
825 }}return jssun.font.AttributeValues.DEFAULT.justification;
826 }, "java.util.Map");
827 Clazz.defineMethod (c$, "applyIMHighlight", 
828 function () {
829 return this;
830 });
831 c$.getBaselineTransform = Clazz.defineMethod (c$, "getBaselineTransform", 
832 function (map) {
833 if (map != null) {
834 var av = null;
835 if (Clazz.instanceOf (map, jssun.font.AttributeMap) && (map).getValues () != null) {
836 av = (map).getValues ();
837 } else if (map.get (java.awt.font.TextAttribute.TRANSFORM) != null) {
838 av = jssun.font.AttributeValues.fromMap (map);
839 }if (av != null) {
840 return av.baselineTransform;
841 }}return null;
842 }, "java.util.Map");
843 c$.getCharTransform = Clazz.defineMethod (c$, "getCharTransform", 
844 function (map) {
845 if (map != null) {
846 var av = null;
847 if (Clazz.instanceOf (map, jssun.font.AttributeMap) && (map).getValues () != null) {
848 av = (map).getValues ();
849 } else if (map.get (java.awt.font.TextAttribute.TRANSFORM) != null) {
850 av = jssun.font.AttributeValues.fromMap (map);
851 }if (av != null) {
852 return av.charTransform;
853 }}return null;
854 }, "java.util.Map");
855 Clazz.defineMethod (c$, "updateDerivedTransforms", 
856 function () {
857 if (this.transform == null) {
858 this.baselineTransform = null;
859 this.charTransform = null;
860 } else {
861 this.charTransform =  new java.awt.geom.AffineTransform (this.transform);
862 this.baselineTransform = jssun.font.AttributeValues.extractXRotation (this.charTransform, true);
863 if (this.charTransform.isIdentity ()) {
864 this.charTransform = null;
865 }if (this.baselineTransform.isIdentity ()) {
866 this.baselineTransform = null;
867 }}if (this.baselineTransform == null) {
868 this.nondefault &= ~jssun.font.EAttribute.EBASELINE_TRANSFORM.mask;
869 } else {
870 this.nondefault |= jssun.font.EAttribute.EBASELINE_TRANSFORM.mask;
871 }});
872 c$.extractXRotation = Clazz.defineMethod (c$, "extractXRotation", 
873 function (tx, andTranslation) {
874 return jssun.font.AttributeValues.extractRotation ( new java.awt.geom.Point2D.Double (1, 0), tx, andTranslation);
875 }, "java.awt.geom.AffineTransform,~B");
876 c$.extractYRotation = Clazz.defineMethod (c$, "extractYRotation", 
877 function (tx, andTranslation) {
878 return jssun.font.AttributeValues.extractRotation ( new java.awt.geom.Point2D.Double (0, 1), tx, andTranslation);
879 }, "java.awt.geom.AffineTransform,~B");
880 c$.extractRotation = Clazz.defineMethod (c$, "extractRotation", 
881  function (pt, tx, andTranslation) {
882 tx.deltaTransform (pt, pt);
883 var rtx = java.awt.geom.AffineTransform.getRotateInstance (pt.x, pt.y);
884 try {
885 var rtxi = rtx.createInverse ();
886 var dx = tx.getTranslateX ();
887 var dy = tx.getTranslateY ();
888 tx.preConcatenate (rtxi);
889 if (andTranslation) {
890 if (dx != 0 || dy != 0) {
891 tx.setTransform (tx.getScaleX (), tx.getShearY (), tx.getShearX (), tx.getScaleY (), 0, 0);
892 rtx.setTransform (rtx.getScaleX (), rtx.getShearY (), rtx.getShearX (), rtx.getScaleY (), dx, dy);
893 }}} catch (e) {
894 if (Clazz.exceptionOf (e, java.awt.geom.NoninvertibleTransformException)) {
895 return null;
896 } else {
897 throw e;
898 }
899 }
900 return rtx;
901 }, "java.awt.geom.Point2D.Double,java.awt.geom.AffineTransform,~B");
902 c$.DEFAULT = c$.prototype.DEFAULT =  new jssun.font.AttributeValues ();
903 c$.MASK_ALL = c$.prototype.MASK_ALL = jssun.font.AttributeValues.getMask (jssun.font.EAttribute.getEnumConstants ());
904 Clazz.defineStatics (c$,
905 "DEFINED_KEY", "sun.font.attributevalues.defined_key");
906 });