|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.wordhoard.model.text.Text edu.northwestern.at.wordhoard.model.text.WrappedText
public class WrappedText
Wrapped text.
In the persistent object model, lines are not word-wrapped to the right margin. While most lines are short and fit within the margin without wrapping, this is not always the case. Examples of long lines include title page publication statements, many of the stage directions in Shakespeare, and lines in Chaucer's "Melibee" Canterbury Tale.
This class performs word wrapping to break long lines into separate lines for presentation. It also provides methods for converting text locations and ranges between wrapped coordinates (view coordinates) and unwrapped coordinates (model coordinates).
Marginalia, if any, are also word wrapped.
Word wrapping is done in the client, not in the build programs. On different operating systems using different fonts, line breaks may occur at different locations in wrapped lines.
Field Summary |
---|
Fields inherited from class edu.northwestern.at.wordhoard.model.text.Text |
---|
serialVersionUID |
Constructor Summary | |
---|---|
WrappedText(Text unwrappedText,
int rightMargin)
Creates new wrapped text without marginalia. |
|
WrappedText(Text unwrappedText,
int rightMargin,
int marginaliaWidth)
Creates new wrapped text. |
Method Summary | |
---|---|
TextLocation |
baseToDerived(TextLocation loc)
Converts a location from base to derived coordinates. |
TextLocation |
derivedToBase(TextLocation loc)
Converts a location from derived to base coordinates. |
Methods inherited from class edu.northwestern.at.wordhoard.model.text.Text |
---|
appendBlankLine, appendLine, appendLine, baseToDerived, clone, computeLineWidths, computeVerticalPositioningInformation, copyLine, copyLine, derivedToBase, draw, finalize, getLine, getLineLocation, getLineLocation, getLines, getNumLines, getText, getWordLocation, hasLineNumbers, hasMarginalia, initializeForDrawing, isMarked, readExternal, roundLocation, setCollapseBlankLines, setExtraIndentation, setLineNumberInterval, setMarkers, setSelection, viewToModel, writeExternal |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WrappedText(Text unwrappedText, int rightMargin, int marginaliaWidth) throws java.lang.Exception
On entry, the font information must be set for all the runs
in the unwrapped text, and the widths must be set for all the
runs and lines in the unwrapped text. See
FontManager.initText
.
On exit, the font information, width information, and vertical positioning information are set for all the runs and lines in the wrapped text.
unwrappedText
- Unwrapped text.rightMargin
- Right margin in pixels.marginaliaWidth
- Width in pixels of marginalia, or 0
if text does not have marginalia.
java.lang.Exception
- Word longer than right margin. public WrappedText(Text unwrappedText, int rightMargin) throws java.lang.Exception
On entry, the font information must be set for all the runs
in the unwrapped text, and the widths must be set for all the
runs and lines in the unwrapped text. See
FontManager.initText
.
On exit, the font information, width information, and vertical positioning information are set for all the runs and lines in the wrapped text.
unwrappedText
- Unwrapped text.rightMargin
- Right margin in pixels.
java.lang.Exception
- Word longer than right margin. Method Detail |
---|
public TextLocation derivedToBase(TextLocation loc)
See the package documentation for more details on derived and base coordinate systems.
derivedToBase
in class Text
loc
- Text location in derived coordinates.
public TextLocation baseToDerived(TextLocation loc)
See the package documentation for more details on derived and base coordinate systems.
baseToDerived
in class Text
loc
- Text location in base cooordinates.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |