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.Glyphas aGraphShapeA 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 FontgetFont()Returns theFontused to render the textFont.GlyphgetGlyph()Returns theFont.Glyphto be rendered.floatgetLineHeight()ReturnsFont.getLineHeight().Vec3fgetOrigPos()Returns the unscaled original position of this glyph, e.g.Vec3fgetOrigPos(float scale)Returns a copy of the scaled original position of this glyph, seegetOrigPos(Vec3f)Vec3fgetOrigPos(Vec3f s)Returns the unscaled original position of this glyph, e.g.Vec3fgetOrigPos(Vec3f s, float scale)Returns the scaled original position of this glyph, seegetOrigPos(float)StringgetSubString()chargetSymbol()Returns the char symbol to be rendered.static AABBoxprocessString(List<GlyphShape> res, int renderModes, Font font, String text)Process the given text resulting in a list ofGlyphShapes with stored original position#getOrigX()and#getOrigY()each at font em-size [0..1].voidresetPos(float scale)Resets this Shape's position to the scaled original position, seegetOrigPos(float).voidresetPosAndScale(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'sRegionrender modes, seecreate(..).symbol- the represented characterglyph- theFont.Glyphx- 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'sRegionrender modes, seecreate(..).font- theFontto lookup the symbol'sFont.Glyphsymbol- 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.Glyphto 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-Vec3fstorage 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-Vec3fstorage 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 ofGlyphShapes with stored original position#getOrigX()and#getOrigY()each at font em-size [0..1].- Parameters:
res- storage for resultingGlyphShapes.renderModes- Graph'sRegionrender modes, seecreate(..).font-Fontusedtext- 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:
getSubStringin classShape
-
-