[[BackLinksMenu]] [[TicketQuery(summary=WRAPPING_TEXT_RENDERING_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] = Analysis = == Overview == * The ability of text to wrap around objects. * The objects could wrap the text as follows: * none - text is not wrapped * before - text wraps only from the left side * after - text wraps only from the left side * parallel - text wraps from both sides * Default value should be parallel. * Text will be flowed around intersecting (overlapping) objects (frames, etc.) * The way of wrapping will depend on the available space for flowing of the text around the intersecting (overlapping) objects. * The following strategy will be considered * Flowing text line by line. * Text alignment should not be taken into account on the text sides displayed around the overlapping object. [[Image(source:branches/private/vlado/sophie2-platform/doc/spec-diagrams/LineByLineTextFlowing.png)]] * Flowing text on intersection blocks will not be used in Sophie 2.0. If such functionality is desired it can be mimicked by creation of separate Frames. [[Image(source:branches/private/vlado/sophie2-platform/doc/spec-diagrams/IntersectionBlockTextFlowing.png)]] * A kind of priority (weight) will be present to estimate the different options for text layout in various cases of intersection (overlapping). * Text layout inside a Frame. * Text is divided into the following parts which define scopes for the text elements: * Text - the whole flowing text. * Text Part - part of the whole text, that is displayed as content of a Frame. * Line - one line of visible text inside a Frame. It is composed of one or more line segments, depending on intersection with other objects (frames, etc.) * Segment (Line Part) - part of a line wrapped around two objects, object and border or two borders of the container Frame. == Task requirements == * Refine the existing text layout algorithm. * Provide layout functionality for accurate calculation of Text Parts depending on the present Frames (needed for [wiki:TEXT_CHAINING_BEHAVIOUR_R0] and [wiki:TEXT_AUTO_CHAIN_BEHAVIOUR_R0]). * Fixing a known bug with layout algorithm specified at [http://www.sophie2.org/trac/wiki/TEXT_INPLACE_EDITOR_R0#Implementation]. * If there is time a simple line by line text flowing will be added. == Task result == The result should be source code. == Implementation idea == * Hill climbing algorithm is used for laying out text (a general implementation is already present). * Check [http://en.wikipedia.org/wiki/Hill_climbing Hill Climbing Algorithm at Wikipedia] for more information. * The roles in the algorithm for the purpose of HotTextLayout: * Vertex - a collection of vertex fields, such as text range (a specific Segment) and its supported properties (scope, area, position properties, etc.) * Edge - represents a placement (positioning) operation for the next Segment depending on the previous Segment (it is the concrete kind of transition from a Vertex to one of its neighboring Vertex-s) * Path - represents a layout of some text (group of Segments, Line or Text Part) with a calculated weight, or "badness" (it is a collection of edges defining the path from one Vertex to another). * The goal is to layout the text according to the Path with lowest weight ("badness"). * The algorithm can be extended with: * a better separation of Segments in relation to the needs of wrapping functionality. * a better Segment handling and calculations == Related == [wiki:TEXT_CHAINING_BEHAVIOUR_R0] [wiki:TEXT_AUTO_CHAIN_BEHAVIOUR_R0] [wiki:SCENE_COMMONS] [wiki:SCENE_COMMONS_R0] [wiki:SMOOTH_TEXT_RENDERING_R0] == How to demo == * A simple line by line text flowing demo (if implemented) * Start the application * Create new book * Inside the book create new text frame and type some text (you could use lorem ipsum generator for better result - http://www.lipsum.com/) * Place another frame on top of the text frame. The text should be flowed around the second frame. = Design = = Implementation = ^(Describe and link the implementation results here (from the wiki or the repository).)^ = Testing = = Comments = ^(Write comments for this or later revisions here.)