T
- the pixel typepublic class FontStyle<T> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FontStyle.FontStyleAttribute
Attributes for styling
AttributedString s. |
static class |
FontStyle.HorizontalAlignment
Horizontal alignment options
|
static class |
FontStyle.VerticalAlignment
Vertical alignment options
|
Modifier and Type | Field and Description |
---|---|
protected float |
angle
Angle in radians for drawing the associated text
|
static AttributedCharacterIterator.Attribute |
ANGLE
Attribute for rotating the text.
|
protected T |
colour
Stroke colour for drawing the associated text
|
static AttributedCharacterIterator.Attribute |
COLOUR
Attribute for stroke colour.
|
protected Font<?> |
font
The font
|
static AttributedCharacterIterator.Attribute |
FONT
Attribute for the font.
|
static AttributedCharacterIterator.Attribute |
FONT_SIZE
Attribute for font size.
|
protected int |
fontSize
Font size in pixels
|
static AttributedCharacterIterator.Attribute |
HORIZONTAL_ALIGNMENT
Attribute for horizontal alignment.
|
protected FontStyle.HorizontalAlignment |
horizontalAlignment
horizontal alignment of the text
|
protected boolean |
italic
should the associated text be rendered in italic?
|
static AttributedCharacterIterator.Attribute |
ITALIC
Attribute for italic text.
|
static AttributedCharacterIterator.Attribute |
VERTICAL_ALIGNMENT
Attribute for vertical alignment.
|
protected FontStyle.VerticalAlignment |
verticalAlignment
vertical alignment of the text
|
Modifier | Constructor and Description |
---|---|
protected |
FontStyle(Font<?> font,
ImageRenderer<T,?> renderer) |
|
FontStyle(Font<?> font,
T col) |
Modifier and Type | Method and Description |
---|---|
float |
getAngle() |
T |
getColour() |
Font<?> |
getFont() |
int |
getFontSize() |
FontStyle.HorizontalAlignment |
getHorizontalAlignment() |
FontRenderer<T,FontStyle<T>> |
getRenderer(ImageRenderer<T,?> renderer)
Get the renderer suitable for rendering text with this style into the
given image.
|
FontStyle.VerticalAlignment |
getVerticalAlignment() |
boolean |
isItalic() |
void |
parseAttributes(Map<? extends AttributedCharacterIterator.Attribute,Object> attrs)
Parse the attributes map and set this FontStyle accordingly.
|
static <T> FontStyle<T> |
parseAttributes(Map<? extends AttributedCharacterIterator.Attribute,Object> attrs,
ImageRenderer<T,?> renderer)
Construct a new FontStyle from the given attribute map, suitable for
rendering into the given image.
|
void |
setAngle(float angle) |
void |
setColour(T colour) |
void |
setFont(Font<?> font) |
void |
setFontSize(int fontSize) |
void |
setHorizontalAlignment(FontStyle.HorizontalAlignment horizontalAlignment) |
void |
setItalic(boolean italic) |
void |
setVerticalAlignment(FontStyle.VerticalAlignment verticalAlignment) |
public static final AttributedCharacterIterator.Attribute FONT
Font
.public static final AttributedCharacterIterator.Attribute ITALIC
public static final AttributedCharacterIterator.Attribute ANGLE
public static final AttributedCharacterIterator.Attribute COLOUR
public static final AttributedCharacterIterator.Attribute HORIZONTAL_ALIGNMENT
FontStyle.HorizontalAlignment
public static final AttributedCharacterIterator.Attribute VERTICAL_ALIGNMENT
FontStyle.VerticalAlignment
public static final AttributedCharacterIterator.Attribute FONT_SIZE
protected boolean italic
protected float angle
protected FontStyle.HorizontalAlignment horizontalAlignment
protected FontStyle.VerticalAlignment verticalAlignment
protected int fontSize
protected FontStyle(Font<?> font, ImageRenderer<T,?> renderer)
public void parseAttributes(Map<? extends AttributedCharacterIterator.Attribute,Object> attrs)
attrs
- the attribute mappublic FontRenderer<T,FontStyle<T>> getRenderer(ImageRenderer<T,?> renderer)
renderer
- the image rendererpublic static <T> FontStyle<T> parseAttributes(Map<? extends AttributedCharacterIterator.Attribute,Object> attrs, ImageRenderer<T,?> renderer)
T
- the pixel type.attrs
- the attribute maprenderer
- the image rendererpublic boolean isItalic()
public void setItalic(boolean italic)
italic
- the italic to setpublic float getAngle()
public void setAngle(float angle)
angle
- the angle to setpublic FontStyle.HorizontalAlignment getHorizontalAlignment()
public void setHorizontalAlignment(FontStyle.HorizontalAlignment horizontalAlignment)
horizontalAlignment
- the horizontalAlignment to setpublic FontStyle.VerticalAlignment getVerticalAlignment()
public void setVerticalAlignment(FontStyle.VerticalAlignment verticalAlignment)
verticalAlignment
- the verticalAlignment to setpublic int getFontSize()
public void setFontSize(int fontSize)
fontSize
- the fontSize to set