|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.nexttext.TextObject net.nexttext.TextObjectGlyph
public class TextObjectGlyph
TextObjectGlyph represents an individual glyph and its vectorial outline in a data structure that is understood by the Renderer.
A Glyph's outline is represented by a list of control points forming a hull (vertices) around the glyph. The outline can be drawn using successive quads where anchors are being interpolated from each set of 3 adjacent control points. This allows for continuous curves even when the control points are being displaced.
Glyphs are built out of one or more contours. Contours are represented by a list of hull points forming continuous quadratic curves. The coordinates for each of these hull points are stored in the Control Points list. Because some glyphs are represented by more than one shape (holes, dot on the i, etc.), each shape is defined as an array of indices into the Control Points list. These shape arrays are stored in a list called Contours. This list should not be modified to distort the glyph. Instead, the behaviours will alter the Control Points directly without affecting the order in which they are drawn.
TextObjectGlyph objects also have two "special" properties, glyph and font, which are not accessed using the standard getProperty mechanism. The reason for this is that the list of vertices and contours forming a glyph is dependent on them, and must be rebuilt if these properties are changed. Therefore, we provided specific get/set methods to access and modify them.
The glyph's ColorProperty is inherited by default.
TextObject
Field Summary | |
---|---|
java.util.Vector |
contours
A vector containing int[] arrays with indices to the Control Points property list. |
java.lang.Object |
rendererCache
This object can be used by Renderers to cache information about TextObjectGlyphs. |
Constructor Summary | |
---|---|
TextObjectGlyph(java.lang.String glyph,
processing.core.PFont pfont,
float size)
Default constructor. |
|
TextObjectGlyph(java.lang.String glyph,
processing.core.PFont pfont,
float size,
java.util.Map<java.lang.String,Property> props,
processing.core.PVector pos)
Constructor with extra properties and a specific position. |
|
TextObjectGlyph(java.lang.String glyph,
processing.core.PFont pfont,
float size,
processing.core.PVector position)
Constructor with a specific position. |
|
TextObjectGlyph(TextObjectGlyph glyph)
Copy Constructor. |
Method Summary | |
---|---|
PVectorListProperty |
getControlPoints()
Convenience accessor for the control points. |
processing.core.PFont |
getFont()
Returns this TextObjectGlyph's font attribute. |
java.lang.String |
getGlyph()
Get the glyph of this object as a string of length 1. |
int |
getHeight()
Get the greatest number of layers between this TextObject and the leaves of the tree. |
java.awt.Polygon |
getLocalBoundingPolygon()
See TextObject's getLocalBoundingPolygon() description for details. |
java.awt.geom.Rectangle2D |
getLogicalBounds()
Returns this glyph's logical bounds information used for spacing. |
java.awt.geom.GeneralPath |
getOutline()
Get the outline of the glyph. |
java.awt.geom.GeneralPath |
getOutlineAbsolute()
Get the absolute outline of the glyph. |
float |
getSize()
Get the font size of this object |
boolean |
isDeformed()
A flag to indicate if this glyph has been deformed. |
void |
setDeformed(boolean df)
|
void |
setFont(processing.core.PFont pfont)
Rebuild the internal representation of the glyph according to the properties of the newly specified Font object. |
void |
setGlyph(java.lang.String glyph)
Rebuild the internal representation of the glyph based on the specified character. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.util.Vector contours
public java.lang.Object rendererCache
Constructor Detail |
---|
public TextObjectGlyph(java.lang.String glyph, processing.core.PFont pfont, float size)
glyph
- A one character-long stringpfont
- A processing.core.PFont objectpublic TextObjectGlyph(java.lang.String glyph, processing.core.PFont pfont, float size, processing.core.PVector position)
glyph
- A one character-long stringpfont
- A processing.core.PFont objectposition
- A PVector representing the glyph's relative positionpublic TextObjectGlyph(java.lang.String glyph, processing.core.PFont pfont, float size, java.util.Map<java.lang.String,Property> props, processing.core.PVector pos)
glyph
- A one character-long stringpfont
- A processing.core.PFont objectpos
- A PVector representing the glyph's relative positionprops
- Initial properties for the glyph.public TextObjectGlyph(TextObjectGlyph glyph)
glyph
- A glyph to copyMethod Detail |
---|
public boolean isDeformed()
False means that the glyph and font information is sufficient to draw the glyph. True means that the "Control Points" property is needed to define the shape of the glyph.
public void setDeformed(boolean df)
public int getHeight()
getHeight
in class TextObject
public java.lang.String getGlyph()
public float getSize()
public void setGlyph(java.lang.String glyph)
public void setFont(processing.core.PFont pfont)
public processing.core.PFont getFont()
public java.awt.geom.Rectangle2D getLogicalBounds()
public PVectorListProperty getControlPoints()
public java.awt.geom.GeneralPath getOutline()
public java.awt.geom.GeneralPath getOutlineAbsolute()
public java.awt.Polygon getLocalBoundingPolygon()
Do not modify the returned Polygon, because it may be cached.
XXXBUG this method always returns a rectangle until we write an algorithm to calculate the convex hull of the set of control points.
getLocalBoundingPolygon
in class TextObject
TextObject.getLocalBoundingPolygon()
public java.lang.String toString()
toString
in class TextObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |