All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.font.TextAttributeSet
java.lang.Object
|
+----java.awt.font.TextAttributeSet
- public final class TextAttributeSet
- extends Object
- implements MutableAttributeSet, Serializable
TextAttributeSet defines attributes and values used by the text
layout classes.
It also provides a simple implementation of MutableAttributeSet.
BACKGROUND- The background color.
BASELINE- Baseline to which to align lines.
BASELINE_DEFAULT- The default baseline if BASELINE is unspecified.
BASELINE_HANGING- Use a hanging baseline for the line.
BASELINE_IDEOGRAPHIC- Use a center baseline for the line.
BASELINE_OFFSETS- Baseline offsets used by a line.
BASELINE_ROMAN- Use a roman baseline for the line.
BIDI_EMBEDDING- The embedding level for nested bidirectional runs.
BIDI_EMBEDDING_DEFAULT- The default embedding if BIDI_EMBEDDING is unspecified.
BIDI_NUMERIC- The bidirectional layout control for roman numeral text.
BIDI_NUMERIC_DEFAULT-
BIDI_NUMERIC_STRONG_ARABIC- Interpret roman numerals as arabic numerals always.
BIDI_NUMERIC_STRONG_ROMAN- Interpret roman numerals as roman numerals always.
BIDI_NUMERIC_WEAK_ARABIC- Interpret roman numerals as having arabic line order.
EMPTY- An empty attribute set, for convenience.
FAMILY- The unlocalized font family name.
FAMILY_ALL-
FONT- The font to use to render this text.
FOREGROUND- The foreground color.
INPUT_METHOD_SEGMENT- Constant for the attribute "input method segment".
JUSTIFICATION- Justification for the paragraph.
JUSTIFICATION_DEFAULT- The default justification if JUSTIFICATION is unspecified.
JUSTIFICATION_FULL- Justify the line to the full requested width.
JUSTIFICATION_NONE- Do not allow the line to be justified.
LANGUAGE- Constant for the attribute "language".
POSTURE- The posture of the font.
POSTURE_DEFAULT- The default posture if POSTURE is unspecified.
POSTURE_ITALIC- The standard italic posture for the font.
READING- Constant for the attribute "reading".
RUN_DIRECTION- The run direction of the line, either left-to-right or right-to-left.
RUN_DIRECTION_DEFAULT- The default direction if RUN_DIRECTION is unspecified.
RUN_DIRECTION_LTR- Left-to-right (top-to-bottom) run direction.
RUN_DIRECTION_RTL- Right-to-left (bottom-to-top) run direction.
SIZE- The font size in points.
STRIKETHROUGH- Adorn the text with strikethrough.
STRIKETHROUGH_DEFAULT- The default strikethrough if STRIKETHROUGH is unspecified, the value is
false.
STRIKETHROUGH_ON- A single strikethrough.
SUPERSUBSCRIPT- Super and subscripting.
SUPERSUBSCRIPT_DEFAULT- The default supersubscript if SUPERSUBSCRIPT is unspecified.
SUPERSUBSCRIPT_DOWN1- Standard subscript.
SUPERSUBSCRIPT_UP1- Standard superscript.
SWAP_COLORS- Swap foreground and background colors (for input method use).
SWAP_COLORS_DEFAULT- Default to not swap foreground and background colors.
SWAP_COLORS_OFF- Do not swap foreground and background colors.
SWAP_COLORS_ON- Swap foreground and background colors.
TRANSFORM- The transform of the font.
UNDERLINE- Adorn the text with underlining.
UNDERLINE_LOW_DASHED- Single pixel dashed low underline.
UNDERLINE_LOW_DOTTED- Single pixel dotted low underline.
UNDERLINE_LOW_GRAY- Double pixel gray low underline.
UNDERLINE_LOW_ONE_PIXEL- Single pixel solid low underline.
UNDERLINE_LOW_TWO_PIXEL- Double pixel solid low underline.
UNDERLINE_OFF- No underline.
UNDERLINE_ON- Standard underline at the roman baseline for roman text, and below
the decenders for other text.
WEIGHT- The weight of the font.
WEIGHT_BOLD- The bold weight for the font.
WEIGHT_DEFAULT- The default weight if WEIGHT is unspecified.
WEIGHT_LIGHT- The light weight for the font.
TextAttributeSet()
- Construct a new mutable attribute set.
TextAttributeSet(AttributeSet)
- Construct a new mutable attribute set containing the provided attributes.
TextAttributeSet(String, Object)
- Construct a new mutable attribute set containing the provided attribute.
add(AttributeSet)
- Remove any existing attributes with the same names, and add the
new attributes.
add(String, Object)
- Remove any existing attribute with the same name, and add a new
attribute with the given name and value.
clone()
- Return a copy of this attribute set.
contains(AttributeSet)
- Returns true if this set contains all the attributes with equal values.
contains(String, Object)
- Returns true if this set contains this attribute with an equal value,
or if the value is null and the attribute is not defined.
equals(AttributeSet)
- Return true if the argument contains the same attributes as this.
equals(Object)
- Return true if the argument is an attribute set containing the same
attributes as this.
get(String)
- Returns the value of the attribute with this name, or null if the
attribute is not defined.
getSize()
- Returns the number of attributes.
hashCode()
- Return a hash code.
isEmpty()
- Returns true if the set is empty.
names()
- Returns an enumeration over the names of the attributes in the set.
remove(Enumeration)
- Remove any existing attributes with the given names.
remove(String)
- Remove any existing attribute with the given name.
set(AttributeSet)
- Removes all attributes, then adds the new attributes.
LANGUAGE
public static final String LANGUAGE
- Constant for the attribute "language". The value of this attribute should
be an instance of Locale.
- See Also:
- Locale
READING
public static final String READING
- Constant for the attribute "reading". In languages where the written form
and the pronunciation of a word are only loosely related (such as
Japanese), it is often necessary to store the reading (pronunciation)
along with the written form. This is an annotation attribute. The value
should be an instance of Annotation holding an instance of String.
- See Also:
- Annotation, String
INPUT_METHOD_SEGMENT
public static final String INPUT_METHOD_SEGMENT
- Constant for the attribute "input method segment". Input methods often
break up text into segments, which usually correspond to words. This
is an annotation attribute. The value should be an instance of
Annotation holding a value of null.
- See Also:
- String
SWAP_COLORS
public static final String SWAP_COLORS
- Swap foreground and background colors (for input method use).
Values are instances of Boolean.
The default is not to swap the colors.
If the foreground and backround color attributes are both defined,
this causes them to be swapped when rendering text. If either is
defaulted the exact effect is undefined-- generally it will produce
an 'inverted' appearance.
SWAP_COLORS_ON
public static final Boolean SWAP_COLORS_ON
- Swap foreground and background colors.
SWAP_COLORS_OFF
public static final Boolean SWAP_COLORS_OFF
- Do not swap foreground and background colors.
SWAP_COLORS_DEFAULT
public static final Boolean SWAP_COLORS_DEFAULT
- Default to not swap foreground and background colors.
FAMILY
public static final String FAMILY
- The unlocalized font family name.
Values are instances of String, e.g. "Serif", "Palatino".
The default value is unspecified.
FAMILY_ALL
public static final String FAMILY_ALL
WEIGHT
public static final String WEIGHT
- The weight of the font.
Values are instances of Float. The value is between 0.0 and 2.0.
This roughly corresponds to the ratio of the stem width to the width of
regular characters
for this typeface. Lower values are lighter.
WEIGHT_DEFAULT
public static final Float WEIGHT_DEFAULT
- The default weight if WEIGHT is unspecified. This value is 1.0.
- See Also:
- WEIGHT
WEIGHT_BOLD
public static final Float WEIGHT_BOLD
- The bold weight for the font. This value is 1.5.
- See Also:
- WEIGHT
WEIGHT_LIGHT
public static final Float WEIGHT_LIGHT
- The light weight for the font. This value is 0.7.
- See Also:
- WEIGHT
POSTURE
public static final String POSTURE
- The posture of the font.
Values are instances of Float. The value is the run/rise, generally
between -1.0 and 1.0, where negative values indicate a leftwards slant,
positive a rightwards slant, and zero no slant. There is no guarantee,
however, that the slope of the text as returned by font will be the
same as the posture value.
- See Also:
- getItalicAngle
POSTURE_DEFAULT
public static final Float POSTURE_DEFAULT
- The default posture if POSTURE is unspecified. This value is 0.0.
- See Also:
- POSTURE
POSTURE_ITALIC
public static final Float POSTURE_ITALIC
- The standard italic posture for the font. This value is 0.333.
- See Also:
- POSTURE
SIZE
public static final String SIZE
- The font size in points.
Values are instances of Float. The value can be any positive
value, although most fonts will pin to a reasonable range.
The default value is unspecified.
TRANSFORM
public static final String TRANSFORM
- The transform of the font.
Values are instances of Transform.
The default value is 'null', i.e. when not specified the font uses its default transform.
FONT
public static final String FONT
- The font to use to render this text.
Values are instances of Font.
The default value is 'null', i.e. text layout
will try to resolve the font as best it can for the given text.
BIDI_EMBEDDING
public static final String BIDI_EMBEDDING
- The embedding level for nested bidirectional runs.
TextLayout assumes this feature has the same value for all text in a
paragraph.
Values are instances of Integer, between 0 and 31 inclusive. Values
from 0 to 15 represent embeddings. If bit 4 is set (values from 16 to
31) they represent directional overrides. Even values indicate
left-to-right, odd indicate right-to-left.
Within an embedding, text assumes a base line direction corresponding
to the embedding, and the standard bidirectional properties of the text
applies. Within an override, all text flows in the given direction,
and the standard bidirectional properties of the text are overridden.
See the Unicode Standard v. 2.0, section 3-11.
BIDI_EMBEDDING_DEFAULT
public static final Integer BIDI_EMBEDDING_DEFAULT
- The default embedding if BIDI_EMBEDDING is unspecified. This value is 0.
- See Also:
- BIDI_EMBEDDING
BACKGROUND
public static final String BACKGROUND
- The background color.
Values are instances of Color.
The default value is 'null', meaning a transparent background.
FOREGROUND
public static final String FOREGROUND
- The foreground color.
Values are instances of Color.
The default value is 'null', meaning use the current color in the Graphics.
UNDERLINE
public static final String UNDERLINE
- Adorn the text with underlining.
Values are instances of Byte. The standard underline is UNDERLINE_ON,
the low underlines are for input method highlighting.
UNDERLINE_OFF
public static final Byte UNDERLINE_OFF
- No underline.
UNDERLINE_ON
public static final Byte UNDERLINE_ON
- Standard underline at the roman baseline for roman text, and below
the decenders for other text.
UNDERLINE_LOW_ONE_PIXEL
public static final Byte UNDERLINE_LOW_ONE_PIXEL
- Single pixel solid low underline.
UNDERLINE_LOW_TWO_PIXEL
public static final Byte UNDERLINE_LOW_TWO_PIXEL
- Double pixel solid low underline.
UNDERLINE_LOW_DOTTED
public static final Byte UNDERLINE_LOW_DOTTED
- Single pixel dotted low underline.
UNDERLINE_LOW_GRAY
public static final Byte UNDERLINE_LOW_GRAY
- Double pixel gray low underline.
UNDERLINE_LOW_DASHED
public static final Byte UNDERLINE_LOW_DASHED
- Single pixel dashed low underline.
STRIKETHROUGH
public static final String STRIKETHROUGH
- Adorn the text with strikethrough.
Values are instances of Boolean.
STRIKETHROUGH_DEFAULT
public static final Boolean STRIKETHROUGH_DEFAULT
- The default strikethrough if STRIKETHROUGH is unspecified, the value is
false.
- See Also:
- STRIKETHROUGH
STRIKETHROUGH_ON
public static final Boolean STRIKETHROUGH_ON
- A single strikethrough. This value is true.
- See Also:
- STRIKETHROUGH
SUPERSUBSCRIPT
public static final String SUPERSUBSCRIPT
- Super and subscripting.
Values are arrays of two floats. The first value is is used to scale
the point size, the second computes the offset as a ratio of the point
size. For example, when applied to a 12 point font, a value of
[.75, -.5] requests a point size of 9, positioned 6 points above
the baseline.
SUPERSUBSCRIPT_DEFAULT
public static final float[] SUPERSUBSCRIPT_DEFAULT
- The default supersubscript if SUPERSUBSCRIPT is unspecified. This
value is [1, 0].
- See Also:
- SUPERSUBSCRIPT
SUPERSUBSCRIPT_UP1
public static final float[] SUPERSUBSCRIPT_UP1
- Standard superscript. This value is [0.75, -0.5].
- See Also:
- SUPERSUBSCRIPT
SUPERSUBSCRIPT_DOWN1
public static final float[] SUPERSUBSCRIPT_DOWN1
- Standard subscript. This value is [0.75, 0.5].
- See Also:
- SUPERSUBSCRIPT
JUSTIFICATION
public static final String JUSTIFICATION
- Justification for the paragraph.
TextLayout assumes this feature has the same value for all text in a
paragraph. Value is a float, extracted as a Double. This is a ratio
controlling the space adjustment. For example, if a line's natural
advance is 50 pixels, and it is asked to justify to a width of 100
pixels, a ratio of 1.0 results in a justified line with an advance of
100 pixels, and a ratio of 0.5 results in a justified
line with an advance of 75 pixels.
JUSTIFICATION_DEFAULT
public static final Float JUSTIFICATION_DEFAULT
- The default justification if JUSTIFICATION is unspecified. This value
is 1.0.
- See Also:
- JUSTIFICATION
JUSTIFICATION_FULL
public static final Float JUSTIFICATION_FULL
- Justify the line to the full requested width. This value is 1.0.
- See Also:
- JUSTIFICATION
JUSTIFICATION_NONE
public static final Float JUSTIFICATION_NONE
- Do not allow the line to be justified. This value is 0.0.
- See Also:
- JUSTIFICATION
RUN_DIRECTION
public static final String RUN_DIRECTION
- The run direction of the line, either left-to-right or right-to-left.
On vertical lines, left-to-right means top-to-bottom.
TextLayout assumes this feature has the same value for all text in
a paragraph.
Values are instances of boolean.
RUN_DIRECTION_DEFAULT
public static final Boolean RUN_DIRECTION_DEFAULT
- The default direction if RUN_DIRECTION is unspecified. This value is
false, indicating left-to-right.
- See Also:
- RUN_DIRECTION
RUN_DIRECTION_LTR
public static final Boolean RUN_DIRECTION_LTR
- Left-to-right (top-to-bottom) run direction. This value is false.
- See Also:
- RUN_DIRECTION
RUN_DIRECTION_RTL
public static final Boolean RUN_DIRECTION_RTL
- Right-to-left (bottom-to-top) run direction. This value is true.
- See Also:
- RUN_DIRECTION
BIDI_NUMERIC
public static final String BIDI_NUMERIC
- The bidirectional layout control for roman numeral text.
Values are instances of Integer.
BIDI_NUMERIC_STRONG_ROMAN
public static final Integer BIDI_NUMERIC_STRONG_ROMAN
- Interpret roman numerals as roman numerals always.
BIDI_NUMERIC_STRONG_ARABIC
public static final Integer BIDI_NUMERIC_STRONG_ARABIC
- Interpret roman numerals as arabic numerals always.
BIDI_NUMERIC_WEAK_ARABIC
public static final Integer BIDI_NUMERIC_WEAK_ARABIC
- Interpret roman numerals as having arabic line order.
BIDI_NUMERIC_DEFAULT
public static final Integer BIDI_NUMERIC_DEFAULT
BASELINE
public static final String BASELINE
- Baseline to which to align lines.
TextLayout assumes this feature has the same value for all text
in a paragraph. Regardless of the baselines to which characters align,
the layout as a whole will align to this line.
Values are instances of Integer.
- See Also:
- ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE, getBaselineOffsetsFor, getBaselineFor
BASELINE_DEFAULT
public static final Integer BASELINE_DEFAULT
- The default baseline if BASELINE is unspecified. This value is
Font.ROMAN_BASELINE.
- See Also:
- BASELINE
BASELINE_ROMAN
public static final Integer BASELINE_ROMAN
- Use a roman baseline for the line. This value is Font.ROMAN_BASELINE.
- See Also:
- BASELINE
BASELINE_IDEOGRAPHIC
public static final Integer BASELINE_IDEOGRAPHIC
- Use a center baseline for the line. This value is Font.CENTER_BASELINE.
- See Also:
- BASELINE
BASELINE_HANGING
public static final Integer BASELINE_HANGING
- Use a hanging baseline for the line. This value is
Font.HANGING_BASELINE.
- See Also:
- BASELINE
BASELINE_OFFSETS
public static final String BASELINE_OFFSETS
- Baseline offsets used by a line.
TextLayout assumes this feature has the same value for all text
in a paragraph.
Values are arrays of three floats. The distance from one baseline
to another is offsets[b] - offsets[a]
, where a is the
starting baseline. For example, the distance from the hanging
baseline to the ideographic baseline is:
offsets[BASELINE_IDEOGRAPHIC.byteValue()]-
offsets[BASELINE_HANGING.byteValue()]
If defaulted, TextLayout attempts to find a
reasonable value for all text in the paragraph.
EMPTY
public static final AttributeSet EMPTY
- An empty attribute set, for convenience.
TextAttributeSet
public TextAttributeSet()
- Construct a new mutable attribute set.
TextAttributeSet
public TextAttributeSet(AttributeSet source)
- Construct a new mutable attribute set containing the provided attributes.
- Parameters:
- source - the attributes to copy into this set.
TextAttributeSet
public TextAttributeSet(String name,
Object value)
- Construct a new mutable attribute set containing the provided attribute.
- Parameters:
- name - the name of the attribute.
- value - the value of the attribute.
isEmpty
public boolean isEmpty()
- Returns true if the set is empty.
getSize
public int getSize()
- Returns the number of attributes.
names
public Enumeration names()
- Returns an enumeration over the names of the attributes in the set.
The elements of the enumeration are all Strings.
get
public Object get(String name)
- Returns the value of the attribute with this name, or null if the
attribute is not defined.
contains
public boolean contains(String name,
Object value)
- Returns true if this set contains this attribute with an equal value,
or if the value is null and the attribute is not defined.
contains
public boolean contains(AttributeSet rhs)
- Returns true if this set contains all the attributes with equal values.
equals
public boolean equals(Object rhs)
- Return true if the argument is an attribute set containing the same
attributes as this.
- Parameters:
- rhs - the object which may be an attribute set.
- Overrides:
- equals in class Object
equals
public boolean equals(AttributeSet rhs)
- Return true if the argument contains the same attributes as this.
- Parameters:
- rhs - the attribute set to test against.
hashCode
public int hashCode()
- Return a hash code.
- Overrides:
- hashCode in class Object
add
public void add(String name,
Object value)
- Remove any existing attribute with the same name, and add a new
attribute with the given name and value. The value must be
immutable, or not mutated by any client.
- Parameters:
- name - the name of the attribute to add
- value - the value of the attribute to add
add
public void add(AttributeSet attributes)
- Remove any existing attributes with the same names, and add the
new attributes.
- Parameters:
- attributes - the set of attributes to add
remove
public void remove(String name)
- Remove any existing attribute with the given name.
- Parameters:
- name - the name of the attribute to remove
remove
public void remove(Enumeration names)
- Remove any existing attributes with the given names.
- Parameters:
- names - an enumeration over the names of attributes to remove. The
elements of the enumeration are Strings.
set
public void set(AttributeSet attributes)
- Removes all attributes, then adds the new attributes.
clone
public Object clone()
- Return a copy of this attribute set. Attributes are shared with the
copy.
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature