|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.nexttext.TextObjectBuilder
public class TextObjectBuilder
Factory class used for creating TextObjects and adding them to NextText.
A TextObjectBuilder provides methods which take Strings and build hierarchies of TextObjects from them. It can be configured in the following ways:
Future facilities which would be useful if included:
Field Summary | |
---|---|
static int |
INDENT_HANGING
|
static int |
INDENT_NORMAL
|
Constructor Summary | |
---|---|
TextObjectBuilder(Book book)
Instantiates the TextObjectBuilder. |
|
TextObjectBuilder(Book book,
TextPage page)
Instantiates the TextObjectBuilder. |
Method Summary | |
---|---|
void |
addGlyphBehaviour(AbstractBehaviour b)
Created glyphs will get this behaviour. |
void |
addGlyphProperty(java.lang.String name,
Property p)
Created glyphs will get this property. |
void |
addGroupBehaviour(AbstractBehaviour b)
Created groups will get this behaviour. |
void |
addGroupProperty(java.lang.String name,
Property p)
Created groups will get this property. |
void |
addWordBehaviour(AbstractBehaviour b)
Created words will get this behaviour. |
TextObjectGroup |
build(java.lang.String text)
Deprecated. |
TextObjectGroup |
build(java.lang.String text,
int x,
int y)
Deprecated. |
TextObjectGroup |
build(java.lang.String text,
processing.core.PVector pos)
Deprecated. |
TextObjectGroup |
buildSentence(java.lang.String text)
Build a tree of TextObjects from the given string. |
TextObjectGroup |
buildSentence(java.lang.String text,
int x,
int y)
Build a tree of TextObjects from the given sentence, at the specified location. |
TextObjectGroup |
buildSentence(java.lang.String text,
int x,
int y,
int lineLength)
Builds a tree of TextObjects from the given sentence, at the specified location. |
TextObjectGroup |
buildSentence(java.lang.String text,
processing.core.PVector pos,
int lineLength)
Build a tree of TextObjects from the given string. |
processing.core.PFont |
getFont()
|
java.util.Set<AbstractBehaviour> |
getGlyphBehaviours()
Behaviours to be added to each glyph. |
java.util.Set<AbstractBehaviour> |
getGroupBehaviours()
Behaviours to be added to each group. |
int |
getIndent()
Get paragraph indentation. |
int |
getIndentStyle()
Get the paragraph indentation style. |
float |
getLineHeight()
Deprecated. |
int |
getLineSpacing()
Get the line spacing of the text. |
TextObjectGroup |
getParent()
null if there's none. |
processing.core.PVector |
getPosition()
|
int |
getSpaceOffset()
Get the space offset. |
int |
getTracking()
Get the tracking of the text. |
float |
getTrackingOffset()
Deprecated. |
java.util.Set<AbstractBehaviour> |
getWordBehaviours()
Behaviours to be added to each glyph. |
void |
removeAllGlyphBehaviours()
Created glyphs will no longer get any behaviours. |
void |
removeAllGlyphProperties()
Created glyphs will no longer get any properties. |
void |
removeAllGroupBehaviours()
Created groups will no longer get any behaviours. |
void |
removeAllGroupProperties()
Created groups will no longer get any properties. |
void |
removeAllWordBehaviours()
Created glyphs will no longer get any behaviours. |
void |
removeGlyphBehaviour(AbstractBehaviour b)
Created glyphs will no longer get this behaviour. |
void |
removeGlyphProperty(java.lang.String name)
Created glyphs will no longer get this property. |
void |
removeGroupBehaviour(AbstractBehaviour b)
Created groups will no longer get this behaviour. |
void |
removeGroupProperty(java.lang.String name)
Created groups will no longer get this property. |
void |
removeWordBehaviour(AbstractBehaviour b)
Created words will no longer get this behaviour. |
void |
setAddToSpatialList(boolean addToSpatialList)
If created objects should be added to the spatial list. |
void |
setFont(processing.core.PFont pf,
float size)
|
void |
setFont(processing.core.PFont pf,
java.awt.Font f,
float size)
|
void |
setIndent(int indent)
Set the paragraph indentation using normal style. |
void |
setIndent(int indent,
int style)
Set the paragraph indentation. |
void |
setLineHeight(float d)
Deprecated. |
void |
setLineSpacing(int spacing)
Set the line spacing of the text. |
void |
setParent(TextObjectGroup parent)
May be null to unset. |
void |
setPosition(processing.core.PVector pos)
|
void |
setSpaceOffset(int space)
Set the space offset. |
void |
setTextAlign(int align)
Set the horizontal alignment type of the group around the position. |
void |
setTextAlignY(int alignY)
Set the vertical alignment type of the group around the position. |
void |
setTracking(int d)
Set the tracking of the text. |
void |
setTrackingOffset(float d)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INDENT_NORMAL
public static final int INDENT_HANGING
Constructor Detail |
---|
public TextObjectBuilder(Book book)
book
- the Book to build TextObjects intopublic TextObjectBuilder(Book book, TextPage page)
book
- the Bookpage
- the Page to build TextObjects intoMethod Detail |
---|
public void setFont(processing.core.PFont pf, float size)
public void setFont(processing.core.PFont pf, java.awt.Font f, float size)
public processing.core.PFont getFont()
public void setPosition(processing.core.PVector pos)
public processing.core.PVector getPosition()
public void setAddToSpatialList(boolean addToSpatialList)
public void setTextAlign(int align)
public void setTextAlignY(int alignY)
public void setParent(TextObjectGroup parent)
public TextObjectGroup getParent()
public void addGlyphBehaviour(AbstractBehaviour b)
public void removeGlyphBehaviour(AbstractBehaviour b)
public void removeAllGlyphBehaviours()
public java.util.Set<AbstractBehaviour> getGlyphBehaviours()
public void addWordBehaviour(AbstractBehaviour b)
public void removeWordBehaviour(AbstractBehaviour b)
public void removeAllWordBehaviours()
public java.util.Set<AbstractBehaviour> getWordBehaviours()
public void addGroupBehaviour(AbstractBehaviour b)
public void removeGroupBehaviour(AbstractBehaviour b)
public void removeAllGroupBehaviours()
public java.util.Set<AbstractBehaviour> getGroupBehaviours()
public void addGlyphProperty(java.lang.String name, Property p)
public void removeGlyphProperty(java.lang.String name)
public void removeAllGlyphProperties()
public void addGroupProperty(java.lang.String name, Property p)
public void removeGroupProperty(java.lang.String name)
public void removeAllGroupProperties()
public TextObjectGroup build(java.lang.String text, int x, int y)
By default, this creates and returns a new TextObjectGroup, with a child TextObjectGlyph for each character in the string.
text
- the String to create the TextObjectGroup fromx
- the x-coordinate of the created TextObjectGroupy
- the y-coordinate of the created TextObjectGroup
public TextObjectGroup build(java.lang.String text)
This is the core method of this class. Its behaviour is modified by all of the available TextObjectBuilder configuration. By default, it creates and returns a new TextObjectGroup, with a child TextObjectGlyph for each character in the string.
public TextObjectGroup build(java.lang.String text, processing.core.PVector pos)
public TextObjectGroup buildSentence(java.lang.String text)
The string is parsed as a sentence, where whitespace characters are treated as word delimiters. The returned TextObjectGroup has a child TextObjectGroup for each word in the string, and TextObjectGlyph grandchildren. Spaces between words are included as TextObjectGroups containing a single TextObjectGlyph child.
text
- the String to create the TextObjectGroup from
public TextObjectGroup buildSentence(java.lang.String text, int x, int y)
The string is parsed as a sentence, where whitespace characters are treated as word delimiters. The returned TextObjectGroup has a child TextObjectGroup for each word in the string, and TextObjectGlyph grandchildren. Spaces between words are included as TextObjectGroups containing a single TextObjectGlyph child.
text
- the String to create the TextObjectGroup fromx
- the x-coordinate of the created TextObjectGroupy
- the y-coordinate of the created TextObjectGroup
public TextObjectGroup buildSentence(java.lang.String text, int x, int y, int lineLength)
The returned TextObject tree will be laid out so that no more than lineLength characters appear on a single line.
text
- the String to create the TextObjectGroup fromx
- the x-coordinate of the created TextObjectGroupy
- the y-coordinate of the created TextObjectGrouplineLength
- the max number of characters per line
public TextObjectGroup buildSentence(java.lang.String text, processing.core.PVector pos, int lineLength)
The returned TextObject tree will be laid out so that no more than lineLength characters appear on a single line.
public void setLineHeight(float d)
d
- height of a line in pixel using the current fontpublic float getLineHeight()
public void setTrackingOffset(float d)
d
- tracking in pixelpublic float getTrackingOffset()
public void setTracking(int d)
d
- tracking in pixelpublic int getTracking()
public void setSpaceOffset(int space)
space
- space offset in pixelpublic int getSpaceOffset()
public void setLineSpacing(int spacing)
spacing
- line spacing in pixelpublic int getLineSpacing()
public void setIndent(int indent)
indent
- indent in pixelpublic void setIndent(int indent, int style)
indent
- indent in pixelstyle
- indent style (INDENT_NORMAL or INDENT_HANGING)public int getIndent()
public int getIndentStyle()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |