1 7 8 22 23 package java.awt.font; 24 25 import java.io.InvalidObjectException ; 26 import java.text.AttributedCharacterIterator.Attribute; 27 import java.util.Map ; 28 import java.util.HashMap ; 29 30 87 public final class TextAttribute extends Attribute { 88 89 private static final Map instanceMap = new HashMap (29); 91 92 97 protected TextAttribute(String name) { 98 super(name); 99 if (this.getClass() == TextAttribute .class) { 100 instanceMap.put(name, this); 101 } 102 } 103 104 107 protected Object readResolve() throws InvalidObjectException { 108 if (this.getClass() != TextAttribute .class) { 109 throw new InvalidObjectException ("subclass didn't correctly implement readResolve"); 110 } 111 112 TextAttribute instance = (TextAttribute ) instanceMap.get(getName()); 113 if (instance != null) { 114 return instance; 115 } else { 116 throw new InvalidObjectException ("unknown attribute name"); 117 } 118 } 119 120 static final long serialVersionUID = 7744112784117861702L; 124 125 129 157 public static final TextAttribute FAMILY = new TextAttribute ("family"); 158 159 202 public static final TextAttribute WEIGHT = new TextAttribute ("weight"); 203 204 208 public static final Float WEIGHT_EXTRA_LIGHT = new Float (0.5f); 209 210 214 public static final Float WEIGHT_LIGHT = new Float (0.75f); 215 216 220 public static final Float WEIGHT_DEMILIGHT = new Float (0.875f); 221 222 226 public static final Float WEIGHT_REGULAR = new Float (1.0f); 227 228 232 public static final Float WEIGHT_SEMIBOLD = new Float (1.25f); 233 234 238 public static final Float WEIGHT_MEDIUM = new Float (1.5f); 239 240 244 public static final Float WEIGHT_DEMIBOLD = new Float (1.75f); 245 246 250 public static final Float WEIGHT_BOLD = new Float (2.0f); 251 252 256 public static final Float WEIGHT_HEAVY = new Float (2.25f); 257 258 262 public static final Float WEIGHT_EXTRABOLD = new Float (2.5f); 263 264 268 public static final Float WEIGHT_ULTRABOLD = new Float (2.75f); 269 270 304 public static final TextAttribute WIDTH = new TextAttribute ("width"); 305 306 310 public static final Float WIDTH_CONDENSED = new Float (0.75f); 311 312 316 public static final Float WIDTH_SEMI_CONDENSED = new Float (0.875f); 317 318 322 public static final Float WIDTH_REGULAR = new Float (1.0f); 323 324 328 public static final Float WIDTH_SEMI_EXTENDED = new Float (1.25f); 329 330 334 public static final Float WIDTH_EXTENDED = new Float (1.5f); 335 336 377 public static final TextAttribute POSTURE = new TextAttribute ("posture"); 378 379 383 public static final Float POSTURE_REGULAR = new Float (0.0f); 384 385 389 public static final Float POSTURE_OBLIQUE = new Float (0.20f); 390 391 416 public static final TextAttribute SIZE = new TextAttribute ("size"); 417 418 461 public static final TextAttribute TRANSFORM = new TextAttribute ("transform"); 462 463 500 public static final TextAttribute SUPERSCRIPT = new TextAttribute ("superscript"); 501 502 506 public static final Integer SUPERSCRIPT_SUPER = new Integer (1); 507 508 512 public static final Integer SUPERSCRIPT_SUB = new Integer (-1); 513 514 536 public static final TextAttribute FONT = new TextAttribute ("font"); 537 538 560 public static final TextAttribute CHAR_REPLACEMENT = new TextAttribute ("char_replacement"); 561 562 566 586 public static final TextAttribute FOREGROUND = new TextAttribute ("foreground"); 587 588 607 public static final TextAttribute BACKGROUND = new TextAttribute ("background"); 608 609 636 public static final TextAttribute UNDERLINE = new TextAttribute ("underline"); 637 638 644 public static final Integer UNDERLINE_ON = new Integer ((byte)0); 645 646 670 public static final TextAttribute STRIKETHROUGH = new TextAttribute ("strikethrough"); 671 672 677 public static final Boolean STRIKETHROUGH_ON = new Boolean (true); 678 679 683 713 public static final TextAttribute RUN_DIRECTION = new TextAttribute ("run_direction"); 714 715 719 public static final Boolean RUN_DIRECTION_LTR = new Boolean (false); 720 721 725 public static final Boolean RUN_DIRECTION_RTL = new Boolean (true); 726 727 758 public static final TextAttribute BIDI_EMBEDDING = new TextAttribute ("bidi_embedding"); 759 760 788 public static final TextAttribute JUSTIFICATION = new TextAttribute ("justification"); 789 790 794 public static final Float JUSTIFICATION_FULL = new Float (1.0f); 795 796 800 public static final Float JUSTIFICATION_NONE = new Float (0.0f); 801 802 806 820 public static final TextAttribute INPUT_METHOD_HIGHLIGHT = new TextAttribute ("input method highlight"); 821 822 844 public static final TextAttribute INPUT_METHOD_UNDERLINE 845 = new TextAttribute ("input method underline"); 846 847 852 public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer (1); 853 854 859 public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer (2); 860 861 866 public static final Integer UNDERLINE_LOW_DOTTED = new Integer (3); 867 868 873 public static final Integer UNDERLINE_LOW_GRAY = new Integer (4); 874 875 880 public static final Integer UNDERLINE_LOW_DASHED = new Integer (5); 881 882 892 public static final TextAttribute SWAP_COLORS = new TextAttribute ("swap_colors"); 893 894 895 public static final Boolean SWAP_COLORS_ON = new Boolean (true); 896 897 903 public static final TextAttribute NUMERIC_SHAPING = new TextAttribute ("numeric_shaping"); 904 } 905 | Popular Tags |