wiki:TEXT_JUSTIFY_R0

Version 4 (modified by boyan, 15 years ago) (diff)

--

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_JUSTIFY_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|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

Sophie needs support for justified text. This task has to provide both the UI and the needed algorithms for test justification.

Task requirements

  • TextParagraphHud should provide a button for justified alignment. After pressing it, the text should be aligned justified, meaning:
    • Text is aligned along both the left and right frame border;
    • Spacing between words is equally distributed;
    • TODO How do we handle spacing between letters? What about single words on a line (if they are long, adding spaces seems sensible, if they are short, it will look ugly)?
  • The algorithm for justification should be easily changeable with an alternative implementation.
  • If the suggested algorithm requirements tend to produce bad layout (whitespace rivers, loose lines, etc.) or downgrade the performance by more than 20% (measured by the text performance tests run on left-aligned and justified text), they might be changed.
  • The algorithm should not significantly slow down text performance.

Task result

Source code

Implementation idea

At this revision we want something simple - we take the width of the segment/line, take out the width of the text, and distribute the space equally between words. Another approach is to distribute 80% of the space between words and the rest between letters (theoretically this should tend to produce better results).

None

How to demo

Insert a text frame in Sophie, type some text and align it justified.

Design

Describe your design here.

Implementation

Describe and link the implementation results here (from the wiki or the repository).

Testing

Place the testing results here.

Comments

Write comments for this or later revisions here.