Last modified 16 years ago
Last modified on 06/11/09 16:52:47
Analysis
Overview
Task requirements
- Add basic text wrapping around a Frame with a higher z-order than the current Frame.
- Text will be flowed line by line following the example:
- Wrapping options
- none - text is not wrapped
- before - text wraps only on the left side
- after - text wraps only on the right side
- parallel (default) - text wraps from both sides
- Default option (parallel).
- In this revision only the parallel will be implemented. However the others remains optional.
Task result
The result of this task is source code.
Implementation idea
- The text layout is based on HillClimbing algorithm.
- Flowing text not only to a single area, but also to a list of areas (having different shapes) is available.
- From the area of the current Frame subtract all intersecting Frames' areas and produce a list of areas.
- Pass the list to the algorithm.
Related
How to demo
See WRAPPING_TEXT_RENDERING_R0
Design
- Add method PageWorkArea.getOverlappingArea(FrameView) to calculate the union of overlapping frames' areas:
- Get the areas of all FrameViews with z-order higher than the current Frame
- Make union of these areas.
- Note: For correct calculations the space of each FrameView should be converted to the space of the current Frame.
- Modify HotTextSceneElementImpl.textLayout() method to:
- Consider if the current Frame has single selection, so that wrapping is disabled (the user should be able to edit the selected frame without wrapping).
- Calculate the layout area:
- Find overlapping area using PageWorkArea.getOverlappingArea
- Subtract overlapping area from the current Frame's area.
- Use the calculated ImmArea (possibly containing a complex shape) as a parameter to HotTextLayout.layout
- Correct EdgeKind.OPEN_LINE and EdgeKind.SEGMENT to consider the case of more than one segment on a line.
- BasePoint calculation should be corrected
- Testing:
- Use the TextDemo and try:
- Type some text into the first frame.
- Select the second frame -> the text in the first wraps around.
- Move and/or rotate the second frame -> the text in the first wraps around.
- Unit test:
- LayoutBuilderTest.testLayout added [3291]
- All tests in LayoutBuilderTest can be used to check this task.
- Use the TextDemo and try:
Implementation
Code added to the clean private branch nenko/nenko2
[3373] - Fix of the known bug with two consecutive new lines entered and real fix of the bug with ascent when changing the font size (1701).
- Commited into the trunk at [3389]
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)