|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
FontInfo | Font information. |
Class Summary | |
---|---|
CharsetUtils | Character set utilities. |
DrawingContext | A text drawing context. |
LocationAndCharset | A text location and character set. |
Text | Text. |
TextLine | A line of text. |
TextLocation | A text location. |
TextParams | Text parameters. |
TextRange | A text range. |
TextRun | A styled run of text. |
TranslatedText | Text with translations. |
WrappedText | Wrapped text. |
Multilingual styled text model.
This package implements a model for multilingual styled text with support for word wrapping, translations, and text location tracking.
Notes on locations and coordinate systems
In the persistent object model, the text for work parts and their translations are stored in separate Text
objects and are not word wrapped. Locations
of words
are stored using the "base" coordinate system of this model. For example, if a word has location line index 53 and character offsets 18-24, this refers to characters 18 to 24 in unwrapped line index 53 in the primary text for the work part which contains the word.
Translated
and wrapped
text objects are used in the client to merge together primary text lines with translated text lines and then word wrap the result to the right margin. Locations in such a "derived" text object are different from the corresponding locations in the "base" primary text object.
For example, consider a wrapped text object constructed from a translated text object which in turn is constructed from a primary text object and its translation text objects. Line 128 offset 12 in the wrapped text may correspond to line 103 offset 72 in the unwrapped text, which may in turn correspond to line 51 offset 72 in the primary text.
All text objects must know how to convert back and forth between their "derived" text coordinate system and the underlying "base" coordinate system of the primary text object from which they were (ultimately) constructed.
These coordinate system conversions are performed by the pair of methods derivedToBase
and baseToDerived
. The base class Text
defines these methods and implements them as do-nothing methods - the input locations are returned unchanged. The derived classes TranslatedText
and WrappedText
override these methods to perform the appropriate conversions.
To continue the example above:
TextLocation derivedLoc = new TextLocation(128,12);
System.out.println(derivedLoc);
TextLocation baseLoc = wrappedText.derivedToBase(derivedLoc);
System.out.println(baseLoc);
prints:
(128,12)
(51,72)
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |