Package com.jogamp.graph.ui.shapes
Class GlyphShape
- java.lang.Object
-
- com.jogamp.graph.ui.Shape
-
- com.jogamp.graph.ui.GraphShape
-
- com.jogamp.graph.ui.shapes.GlyphShape
-
public class GlyphShape extends GraphShape
Representing a singleFont.Glyph
as aGraphShape
A GlyphShape is represented in font em-size [0..1] unscaled w/ bottom-left origin at 0/0 while preserving an intended position, seegetOrigPos()
andgetOrigPos(float)
. Scaling, if any, should be applied viaShape.setScale(float, float, float)
etc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jogamp.graph.ui.Shape
Shape.EventInfo, Shape.Listener, Shape.ListenerBool, Shape.MouseGestureAdapter, Shape.MouseGestureListener, Shape.Visitor1, Shape.Visitor2
-
-
Field Summary
-
Fields inherited from class com.jogamp.graph.ui.Shape
ZAscendingComparator
-
-
Constructor Summary
Constructors Constructor Description GlyphShape(int renderModes, char symbol, Font.Glyph glyph, float x, float y)
Creates a new GlyphShapeGlyphShape(int renderModes, Font font, char symbol, float x, float y)
Creates a new GlyphShape
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
getFont()
Returns theFont
used to render the textFont.Glyph
getGlyph()
Returns theFont.Glyph
to be rendered.float
getLineHeight()
ReturnsFont.getLineHeight()
.Vec3f
getOrigPos()
Returns the unscaled original position of this glyph, e.g.Vec3f
getOrigPos(float scale)
Returns a copy of the scaled original position of this glyph, seegetOrigPos(Vec3f)
Vec3f
getOrigPos(Vec3f s)
Returns the unscaled original position of this glyph, e.g.Vec3f
getOrigPos(Vec3f s, float scale)
Returns the scaled original position of this glyph, seegetOrigPos(float)
String
getSubString()
char
getSymbol()
Returns the char symbol to be rendered.static AABBox
processString(List<GlyphShape> res, int renderModes, Font font, String text)
Process the given text resulting in a list ofGlyphShape
s with stored original position#getOrigX()
and#getOrigY()
each at font em-size [0..1].void
resetPos(float scale)
Resets this Shape's position to the scaled original position, seegetOrigPos(float)
.void
resetPosAndScale(float scale)
Resets this Shape's position to the scaled original position andset scale
, seeresetPos(float)
.-
Methods inherited from class com.jogamp.graph.ui.GraphShape
getQuality, getRenderModes, getSharpness, hasColorChannel, setQuality, setSharpness, setTextureUnit
-
Methods inherited from class com.jogamp.graph.ui.Shape
addMouseListener, clear, destroy, draw, drawToSelect, getBorderColor, getBorderThickness, getBounds, getBounds, getColor, getName, getPadding, getPixelPerShapeUnit, getPixelPerShapeUnit, getPosition, getRotation, getRotationPivot, getScale, getScaledHeight, getScaledWidth, getSurfacePort, getSurfaceSize, getSurfaceSize, getSurfaceSize, hasBorder, hasPadding, isDraggable, isEnabled, isInteractive, isPressed, isResizable, isToggleable, isToggleOn, markShapeDirty, markStateDirty, move, move, moveTo, moveTo, onClicked, onInit, onMove, onToggle, removeMouseListener, scale, setBorder, setBorderColor, setBorderColor, setColor, setColor, setDragAndResizeable, setDraggable, setEnabled, setInteractive, setName, setPaddding, setPressed, setPressedColorMod, setResizable, setRotationPivot, setRotationPivot, setScale, setToggle, setToggleable, setToggleOffColorMod, setToggleOnColorMod, setTransform, shapeToWinCoord, shapeToWinCoord, shapeToWinCoord, toggle, toString, validate, validate, winToShapeCoord, winToShapeCoord, winToShapeCoord
-
-
-
-
Constructor Detail
-
GlyphShape
public GlyphShape(int renderModes, char symbol, Font.Glyph glyph, float x, float y)
Creates a new GlyphShape- Parameters:
renderModes
- Graph'sRegion
render modes, seecreate(..)
.symbol
- the represented characterglyph
- theFont.Glyph
x
- the intended unscaled X position of this Glyph, e.g. if part of a string - otherwise use zero.y
- the intended unscaled Y position of this Glyph, e.g. if part of a string - otherwise use zero.- See Also:
processString(List, int, Font, String)
-
GlyphShape
public GlyphShape(int renderModes, Font font, char symbol, float x, float y)
Creates a new GlyphShape- Parameters:
renderModes
- Graph'sRegion
render modes, seecreate(..)
.font
- theFont
to lookup the symbol'sFont.Glyph
symbol
- the represented characterx
- the intended unscaled X position of this Glyph, e.g. if part of a string - otherwise use zero.y
- the intended unscaled Y position of this Glyph, e.g. if part of a string - otherwise use zero.
-
-
Method Detail
-
getSymbol
public char getSymbol()
Returns the char symbol to be rendered.
-
getGlyph
public Font.Glyph getGlyph()
Returns theFont.Glyph
to be rendered.
-
getOrigPos
public Vec3f getOrigPos()
Returns the unscaled original position of this glyph, e.g. if part of a string, otherwise zero. Method borrows and returns the internal instance.- See Also:
processString(List, int, Font, String)
-
getOrigPos
public Vec3f getOrigPos(Vec3f s)
Returns the unscaled original position of this glyph, e.g. if part of a string, otherwise zero.- Parameters:
s
-Vec3f
storage to be returned- Returns:
- storage containing the unscaled original position
- See Also:
processString(List, int, Font, String)
-
getOrigPos
public Vec3f getOrigPos(float scale)
Returns a copy of the scaled original position of this glyph, seegetOrigPos(Vec3f)
- See Also:
processString(List, int, Font, String)
-
getOrigPos
public Vec3f getOrigPos(Vec3f s, float scale)
Returns the scaled original position of this glyph, seegetOrigPos(float)
- Parameters:
s
-Vec3f
storage to be returned- Returns:
- storage containing the scaled original position
- See Also:
processString(List, int, Font, String)
-
resetPos
public void resetPos(float scale)
Resets this Shape's position to the scaled original position, seegetOrigPos(float)
.
-
resetPosAndScale
public void resetPosAndScale(float scale)
Resets this Shape's position to the scaled original position andset scale
, seeresetPos(float)
.
-
getLineHeight
public float getLineHeight()
ReturnsFont.getLineHeight()
.
-
processString
public static final AABBox processString(List<GlyphShape> res, int renderModes, Font font, String text)
Process the given text resulting in a list ofGlyphShape
s with stored original position#getOrigX()
and#getOrigY()
each at font em-size [0..1].- Parameters:
res
- storage for resultingGlyphShape
s.renderModes
- Graph'sRegion
render modes, seecreate(..)
.font
-Font
usedtext
- text to be represented- Returns:
- the bounding box of the given string by taking each glyph's font em-sized [0..1] OutlineShape into account.
- See Also:
#getOrigX()
,#getOrigY()
-
getSubString
public String getSubString()
- Overrides:
getSubString
in classShape
-
-