OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [java/] [awt/] [font/] [TextAttribute.java] - Blame information for rev 771

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 771 jeremybenn
/* TextAttribute.java --
2
   Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package java.awt.font;
40
 
41
import java.io.InvalidObjectException;
42
import java.text.AttributedCharacterIterator;
43
 
44
/**
45
 * Attributes (and associated values) that can be used to define an
46
 * {@link java.text.AttributedString}.
47
 */
48
public final class TextAttribute extends AttributedCharacterIterator.Attribute
49
{
50
  private static final long serialVersionUID = 7744112784117861702L;
51
 
52
  /** A key for the background paint attribute. */
53
  public static final TextAttribute BACKGROUND =
54
    new TextAttribute("background");
55
 
56
  /** A key for the BIDI_EMBEDDING attribute. */
57
  public static final TextAttribute BIDI_EMBEDDING =
58
    new TextAttribute("bidi_embedding");
59
 
60
  /** A key for the CHAR_REPLACEMENT attribute. */
61
  public static final TextAttribute CHAR_REPLACEMENT =
62
    new TextAttribute("char_replacement");
63
 
64
  /** A key for the FAMILY attribute. */
65
  public static final TextAttribute FAMILY = new TextAttribute("family");
66
 
67
  /** A key for the font attribute. */
68
  public static final TextAttribute FONT = new TextAttribute("font");
69
 
70
  /** A key for the foreground paint attribute. */
71
  public static final TextAttribute FOREGROUND =
72
    new TextAttribute("foreground");
73
 
74
  /** A key for the INPUT_METHOD_HIGHLIGHT attribute. */
75
  public static final TextAttribute INPUT_METHOD_HIGHLIGHT =
76
    new TextAttribute("input method highlight");
77
 
78
  /** A key for the INPUT_METHOD_UNDERLINE attribute. */
79
  public static final TextAttribute INPUT_METHOD_UNDERLINE =
80
    new TextAttribute("input method underline");
81
 
82
  /** A key for the text justification attribute. */
83
  public static final TextAttribute JUSTIFICATION =
84
    new TextAttribute("justification");
85
 
86
  /**
87
   * A value that can be used with the {@link #JUSTIFICATION} attribute to
88
   * indicate full justification of the text.
89
   */
90
  public static final Float JUSTIFICATION_FULL = new Float(1.0);
91
 
92
  /**
93
   * A value that can be used with the {@link #JUSTIFICATION} attribute to
94
   * indicate no justification of the text.
95
   */
96
  public static final Float JUSTIFICATION_NONE = new Float(0.0);
97
 
98
  /** A key for the NUMERIC_SHAPING attribute. */
99
  public static final TextAttribute NUMERIC_SHAPING =
100
    new TextAttribute("numeric_shaping");
101
 
102
  /** A key for the POSTURE attribute. */
103
  public static final TextAttribute POSTURE = new TextAttribute("posture");
104
 
105
  /** A value that can be used with the {@link #POSTURE} attribute. */
106
  public static final Float POSTURE_OBLIQUE = new Float(0.2);
107
 
108
  /** A value that can be used with the {@link #POSTURE} attribute. */
109
  public static final Float POSTURE_REGULAR = new Float(0.0);
110
 
111
  /** A key for the RUN_DIRECTION attribute. */
112
  public static final TextAttribute RUN_DIRECTION =
113
    new TextAttribute("run_direction");
114
 
115
  /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
116
  public static final Boolean RUN_DIRECTION_LTR = Boolean.FALSE;
117
 
118
  /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
119
  public static final Boolean RUN_DIRECTION_RTL = Boolean.TRUE;
120
 
121
  /** A key for the text size attribute. */
122
  public static final TextAttribute SIZE = new TextAttribute("size");
123
 
124
  /** A key for the STRIKETHROUGH attribute. */
125
  public static final TextAttribute STRIKETHROUGH =
126
    new TextAttribute("strikethrough");
127
 
128
  /** A value that can be used with the {@link #STRIKETHROUGH} attribute. */
129
  public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE;
130
 
131
  /** A key for the SUPERSCRIPT attribute. */
132
  public static final TextAttribute SUPERSCRIPT =
133
    new TextAttribute("superscript");
134
 
135
  /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
136
  public static final Integer SUPERSCRIPT_SUB = new Integer(-1);
137
 
138
  /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
139
  public static final Integer SUPERSCRIPT_SUPER = new Integer(1);
140
 
141
  /** A key for the SWAP_COLORS attribute. */
142
  public static final TextAttribute SWAP_COLORS =
143
    new TextAttribute("swap_colors");
144
 
145
  /** A value that can be used with the {@link #SWAP_COLORS} attribute. */
146
  public static final Boolean SWAP_COLORS_ON = Boolean.TRUE;
147
 
148
  /** A key for the TRANFORM attribute. */
149
  public static final TextAttribute TRANSFORM = new TextAttribute("transform");
150
 
151
  /** A key for the UNDERLINE attribute. */
152
  public static final TextAttribute UNDERLINE = new TextAttribute("underline");
153
 
154
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
155
  public static final Integer UNDERLINE_LOW_DASHED = new Integer(5);
156
 
157
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
158
  public static final Integer UNDERLINE_LOW_DOTTED = new Integer(3);
159
 
160
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
161
  public static final Integer UNDERLINE_LOW_GRAY = new Integer(4);
162
 
163
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
164
  public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer(1);
165
 
166
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
167
  public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer(2);
168
 
169
  /** A value that can be used with the {@link #UNDERLINE} attribute. */
170
  public static final Integer UNDERLINE_ON = new Integer(0);
171
 
172
  /** A key for the WEIGHT attribute. */
173
  public static final TextAttribute WEIGHT = new TextAttribute("weight");
174
 
175
  /** A value that can be used with the {@link #WEIGHT} attribute. */
176
  public static final Float WEIGHT_BOLD = new Float(2.0);
177
 
178
  /** A value that can be used with the {@link #WEIGHT} attribute. */
179
  public static final Float WEIGHT_DEMIBOLD = new Float(1.75);
180
 
181
  /** A value that can be used with the {@link #WEIGHT} attribute. */
182
  public static final Float WEIGHT_DEMILIGHT = new Float(0.875);
183
 
184
  /** A value that can be used with the {@link #WEIGHT} attribute. */
185
  public static final Float WEIGHT_EXTRA_LIGHT = new Float(0.5);
186
 
187
  /** A value that can be used with the {@link #WEIGHT} attribute. */
188
  public static final Float WEIGHT_EXTRABOLD = new Float(2.5);
189
 
190
  /** A value that can be used with the {@link #WEIGHT} attribute. */
191
  public static final Float WEIGHT_HEAVY = new Float(2.25);
192
 
193
  /** A value that can be used with the {@link #WEIGHT} attribute. */
194
  public static final Float WEIGHT_LIGHT = new Float(0.75);
195
 
196
  /** A value that can be used with the {@link #WEIGHT} attribute. */
197
  public static final Float WEIGHT_MEDIUM = new Float(1.5);
198
 
199
  /** A value that can be used with the {@link #WEIGHT} attribute. */
200
  public static final Float WEIGHT_REGULAR = new Float(1.0);
201
 
202
  /** A value that can be used with the {@link #WEIGHT} attribute. */
203
  public static final Float WEIGHT_SEMIBOLD = new Float(1.25);
204
 
205
  /** A value that can be used with the {@link #WEIGHT} attribute. */
206
  public static final Float WEIGHT_ULTRABOLD = new Float(2.75);
207
 
208
  /** A key for the WIDTH attribute. */
209
  public static final TextAttribute WIDTH = new TextAttribute("width");
210
 
211
  /** A value that can be used with the {@link #WIDTH} attribute. */
212
  public static final Float WIDTH_CONDENSED = new Float(0.75);
213
 
214
  /** A value that can be used with the {@link #WIDTH} attribute. */
215
  public static final Float WIDTH_EXTENDED = new Float(1.5);
216
 
217
  /** A value that can be used with the {@link #WIDTH} attribute. */
218
  public static final Float WIDTH_REGULAR = new Float(1.0);
219
 
220
  /** A value that can be used with the {@link #WIDTH} attribute. */
221
  public static final Float WIDTH_SEMI_CONDENSED = new Float(0.875);
222
 
223
  /** A value that can be used with the {@link #WIDTH} attribute. */
224
  public static final Float WIDTH_SEMI_EXTENDED = new Float(1.25);
225
 
226
  /**
227
   * Creates a new attribute.
228
   *
229
   * @param name  the name.
230
   */
231
  protected TextAttribute(String name)
232
  {
233
    super(name);
234
  }
235
 
236
  /**
237
   * After deserialization, this method ensures that only one instance of
238
   * each attribute is used.
239
   *
240
   * @return The (single) attribute instance.
241
   *
242
   * @throws InvalidObjectException if the attribute is not recognised.
243
   */
244
  protected Object readResolve()
245
    throws InvalidObjectException
246
  {
247
    if (this.getName().equals("background"))
248
      return BACKGROUND;
249
 
250
    if (this.getName().equals("bidi_embedding"))
251
      return BIDI_EMBEDDING;
252
 
253
    if (this.getName().equals("char_replacement"))
254
      return CHAR_REPLACEMENT;
255
 
256
    if (this.getName().equals("family"))
257
      return FAMILY;
258
 
259
    if (this.getName().equals("font"))
260
      return FONT;
261
 
262
    if (this.getName().equals("foreground"))
263
      return FOREGROUND;
264
 
265
    if (this.getName().equals("input method highlight"))
266
      return INPUT_METHOD_HIGHLIGHT;
267
 
268
    if (this.getName().equals("input method underline"))
269
      return INPUT_METHOD_UNDERLINE;
270
 
271
    if (this.getName().equals("justification"))
272
      return JUSTIFICATION;
273
 
274
    if (this.getName().equals("numeric_shaping"))
275
      return NUMERIC_SHAPING;
276
 
277
    if (this.getName().equals("posture"))
278
      return POSTURE;
279
 
280
    if (this.getName().equals("run_direction"))
281
      return RUN_DIRECTION;
282
 
283
    if (this.getName().equals("size"))
284
      return SIZE;
285
 
286
    if (this.getName().equals("strikethrough"))
287
      return STRIKETHROUGH;
288
 
289
    if (this.getName().equals("superscript"))
290
      return SUPERSCRIPT;
291
 
292
    if (this.getName().equals("swap_colors"))
293
      return SWAP_COLORS;
294
 
295
    if (this.getName().equals("transform"))
296
      return TRANSFORM;
297
 
298
    if (this.getName().equals("underline"))
299
      return UNDERLINE;
300
 
301
    if (this.getName().equals("weight"))
302
      return WEIGHT;
303
 
304
    if (this.getName().equals("width"))
305
      return WIDTH;
306
 
307
    throw new InvalidObjectException("Can't resolve Attribute: " + getName());
308
  }
309
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.