Package org.jzy3d.plot3d.text.renderers
Class TextRenderer
java.lang.Object
org.jzy3d.plot3d.text.AbstractTextRenderer
org.jzy3d.plot3d.text.renderers.TextRenderer
- All Implemented Interfaces:
ITextRenderer
- Direct Known Subclasses:
AxisBox2d.RotatedTextBitmapRenderer
The
ITextRenderer
computes text layout according to Horizontal
, Vertical
settings, text length, font size and text position. This is achieved with the help of
TextLayout
processor.
It can be given a 2D offset in screen coordinates and a 3D offset in world coordinates that are
applied after the initial layout is processed according to the settings, the text length, the
font size and the text position.
It supports Unicode characters and all fonts made available by Font
.
Rendering text relies on IPainter.drawText(Font, String, Coord3d, Color, float)
which was
introduced as of Jzy3D 2.0 and offers much more flexibility than the initial simple
IPainter.glutBitmapString(int, String)
which only support two fonts.
Rotation of a text is always made from the center of the text, whatever the LEFT/CENTER/RIGHT
layout of the text, which lead to all these possible layouts.
invalid @link
ITTest_Text#main()
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TextLayout
protected static org.apache.logging.log4j.Logger
protected Color
protected float
protected boolean
protected boolean
Fields inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
NO_ROTATION, NO_SCENE_OFFSET, NO_SCREEN_OFFSET, spaceTransformer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BoundingBox3d
computeTextBounds
(IPainter painter, Font font, Coord3d posScreenShifted, float strlen) drawText
(IPainter painter, Font font, String text, Coord3d position, float rotation, Horizontal halign, Vertical valign, Color color, Coord2d screenOffset, Coord3d sceneOffset) Draw a string at the specified position and return the 3d volume occupied by the string according to the current Camera configuration.float
boolean
boolean
void
setPositionColor
(Color positionColor) void
setPositionWidth
(float positionWidth) void
setShowPosition
(boolean showPosition) void
setUseGlutBitmap
(boolean useGlutBitmap) protected Coord3d
Convert a 2D screen position to 3D world coordinateMethods inherited from class org.jzy3d.plot3d.text.AbstractTextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jzy3d.plot3d.text.ITextRenderer
drawText, drawText, drawText, drawText, drawText, drawText, getSpaceTransformer, setSpaceTransformer
-
Field Details
-
LOGGER
protected static org.apache.logging.log4j.Logger LOGGER -
layout
-
showPosition
protected boolean showPosition -
positionColor
-
positionWidth
protected float positionWidth -
useGlutBitmap
protected boolean useGlutBitmap
-
-
Constructor Details
-
TextRenderer
public TextRenderer()
-
-
Method Details
-
drawText
public BoundingBox3d drawText(IPainter painter, Font font, String text, Coord3d position, float rotation, Horizontal halign, Vertical valign, Color color, Coord2d screenOffset, Coord3d sceneOffset) Draw a string at the specified position and return the 3d volume occupied by the string according to the current Camera configuration.- Specified by:
drawText
in interfaceITextRenderer
-
to3D
Convert a 2D screen position to 3D world coordinate -
computeTextBounds
protected BoundingBox3d computeTextBounds(IPainter painter, Font font, Coord3d posScreenShifted, float strlen) -
isShowPosition
public boolean isShowPosition() -
setShowPosition
public void setShowPosition(boolean showPosition) -
getPositionColor
-
setPositionColor
-
getPositionWidth
public float getPositionWidth() -
setPositionWidth
public void setPositionWidth(float positionWidth) -
isUseGlutBitmap
public boolean isUseGlutBitmap() -
setUseGlutBitmap
public void setUseGlutBitmap(boolean useGlutBitmap)
-