public class TextLayout extends Object
The rendering-based client loads text layout objects from its persistence format according to its own needs, or on demand as editing events cause AXTE to demand frame content. Editing itself occurs on a text stream object through the AXTE API. When the user directs AXTEs client to save data, the client would run through loaded frames and generate new persistence data for them.
| Constructor and Description |
|---|
TextLayout()
Default constructor.
|
TextLayout(TextLayout oSource)
Copy Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TextLayoutLine |
addLine(TextLayoutLine poLine)
Add a line to the layout object.
|
void |
addLineRef(TextLayoutLine poLine)
Add a line to the layout object, by reference.
|
TextLayout |
cloneLayout()
Create a correctly-typed copy of this layout object.
|
void |
copyFrom(TextLayout oSource)
Assignment operator.
|
void |
format(TextDispStr oSource,
boolean bAllowCharGlyphs,
GFXEnv poGfxEnv)
Populate this layout object with the text rendering from the given
displayable stream.
|
TextDisplay |
generateStream(TextDispStr oTarget,
GFXEnv poGfxEnv)
Populate the given displayable stream and its display with
information from this layout object.
|
TextLayoutLine |
getLine(int nIndex)
Get one line from the layout object.
|
int |
getLineCount()
Return the number of lines in the layout.
|
boolean |
isSuspect() |
void |
reset()
Reset the layout object to its initial state.
|
void |
setIsSuspect(boolean bIsSuspect) |
public TextLayout()
The layout is initially empty of lines.
public TextLayout(TextLayout oSource)
Initializes this layout to be a copy of the given source layout. Note that lines are copied by reference only.
oSource - - Source layout to copy.public void reset()
The client typically calls this method after one stream generation operation, in order to perform a second one. There is no harm in calling Reset() repeatedly or calling it on a just-created layout object.
public TextLayoutLine addLine(TextLayoutLine poLine)
poLine - - Pointer to line object to add to the layout object.
Note that AXTE always caches its own copies of objects. In other
words, a clone of the given line will be added to the layout object.
The client is free to delete the line identified by this parameter as
soon as the call returns.public void addLineRef(TextLayoutLine poLine)
poLine - - Pointer to line object to add to the layout object.
This is assumed to be a reference counted object. The layout object
will add its own reference to the given line.public int getLineCount()
public TextLayoutLine getLine(int nIndex)
nIndex - - Index of line to retrieve.public TextDisplay generateStream(TextDispStr oTarget, GFXEnv poGfxEnv)
This call is rather destructive for the target stream, which loses all its content and display. In addition, any position and range objects associated with the stream become detached from it.
This method first removes the old Unicode content and the stream's display if there was one. Upon return, the stream will contain both Unicode content and a new display that effectively contains the run content as added. Once the operation is complete, the client then uses the resulting stream for all interaction. At the end of editing the client extracts the modified rendering from the stream.
A successful operation implicitly ends with a call to the Reset() method.
Note that this method generates a single-frame displayable stream. For a multi-frame sparse stream, the client doesn't use this method. Instead, it creates multiple layout instances, one for each frame that needs to be loaded, typically under sparse stream call-back control.
oTarget - - Target stream to receive this layout objects
content. This is an instance of the abstract TextDispStr class,
allowing the client to use an instance of any of the displayable
stream types. Note that the XTG Font Service instance associated
with this stream must be the same as that associated with the fonts
in all the runs added to the rendering.poGfxEnv - - Abstract graphic environment for the stream/display
to use.public void format(TextDispStr oSource, boolean bAllowCharGlyphs, GFXEnv poGfxEnv)
Any previously existing content in this layout object is first removed. The resulting layout will contain original runs wherever possible. Where edits have occurred, new runs may be created.
oSource - - Input displayable stream to extract the layout from.
If the stream doesnt have a display, one is created.bAllowCharGlyphs - - If false, all glyphs in the output runs are
specified by glyph IDs. If true, AXTE will attempt to convert from
glyph IDs back to original characters where reasonable.poGfxEnv - - Optional abstract graphic environment. The client
need not provide either scroller or environment if the stream already
has a display. If the stream does not have a display, one will be
created with the scroller and/or environment provided.public boolean isSuspect()
public void setIsSuspect(boolean bIsSuspect)
public void copyFrom(TextLayout oSource)
Copies the content of the given source layout to this layout, replacing all of its data members. Note that lines are copied by reference only.
oSource - - Source layout to copy.public TextLayout cloneLayout()
Clients don't generally extend this class, but if they do, they can implement this method to ensure that a correctly-typed copy gets created if a copy of the layout is made. AXTE currently doesn't create copies of layout objects, but may in the future.
Copyright © 2010 - 2020 Adobe. All Rights Reserved