Ticket #2422 (closed planned_task: obsolete)

Opened 10 years ago

Last modified 8 years ago

TEXT_JUSTIFY_R0

Reported by: boyan Owned by: boyanl
Priority: major Milestone: X3
Component: TEXT_FORMATTING Version: 2.0
Keywords: text, justify Cc: boyanl
Category: MAIN Effort:
Importance: 70 Ticket_group: text
Estimated Number of Hours: 0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0
Analysis_owners: boyan Design_owners: boyanl
Imp._owners: boyanl Test_owners:
Analysis_reviewers: boyanl Changelog: Changelog
Design_reviewers: pap, kyli Imp._reviewers: deyan, pap
Test_reviewers: Analysis_score: 4
Design_score: 3.5 Imp._score: 3.5
Test_score: 0

Description

Attachments

text_justification.patch (16.0 KB) - added by boyanl 10 years ago.
text_justification.2.patch (12.4 KB) - added by boyanl 10 years ago.

Change History

comment:1 Changed 10 years ago by boyan

  • Owner changed from boyanl to boyan
  • Status changed from new to s1a_analysis_started

starting analysis

comment:2 Changed 10 years ago by boyan

  • Status changed from s1a_analysis_started to s1b_analysis_finished

finished analysis (0.25d)

comment:3 Changed 10 years ago by boyan

  • Status changed from s1b_analysis_finished to new

restarted analysis

comment:4 Changed 10 years ago by boyan

  • Status changed from new to s1a_analysis_started

restarting analysis

comment:5 Changed 10 years ago by boyan

  • Status changed from s1a_analysis_started to s1b_analysis_finished

analysis finished (0.5d total)

comment:6 Changed 10 years ago by boyanl

  • Design_owners set to boyanl
  • Status changed from s1b_analysis_finished to s1c_analysis_ok
  • Imp._owners set to boyanl
  • Analysis_reviewers set to boyanl
  • Analysis_score changed from 0 to 4

The analysis is clear and sufficient for the task.

comment:7 Changed 10 years ago by boyanl

  • Owner changed from boyan to boyanl
  • Status changed from s1c_analysis_ok to s2a_design_started

comment:8 Changed 10 years ago by boyanl

  • Changes to the HotSegmentLayout class:
    • Add an Integer[] wordPos field to represent the start positions of what we consider "words" (for justification, we want only whitespace-separated words)
    • Add a double textWidth to show the width of the text in the segment
    • In HotSegmentLayout.create add logic that passes the correct wordPos and textWidth to the constructor. We fill the positions array when we're parsing the words in the text
    • Add a boolean lastInParagraph argument to HotSegmentLayout.create to show whether the text we're constructing the layout from is a last line in its paragraph (if so, we don't need to get the justified layout)
    • In HotSegmentLayout.getJustifiedLayout return a properly-spaced layout. The algorithm is as follows - for each TextRun starting at a position present in the wordPos field, we translate its X-coordinate in the locations array by the average amount needed per word (we get the average amount by calculating the remaining width and dividing it by the number of words).
  • Changes to the HotLineLayout class:
    • In HotLineLayout.create add a parameter lastLineInPara to indicate whether the text we're creating the layout from is a last line in its paragraph.
  • Changes to HotAreaLayout class:
    • In HotAreaLayout.create pass the correct value of lastLineInPara to the HotLineLayouts
  • Changes to the LayoutUtils class:
    • In the LineIterator.nextLine method append the following para-break to the returned line (if there is any)
  • Changes to the LineBreakUtil class:
    • In Word.get add a parameter List<Integer> whitespaceBreaks, which is filled with the positions of characters after consecutive whitespaces. (used in HotSegmentLayout ). It also can be null.
  • Changes to the TextUtils class:
    • Small fixes to findNextChar and findPrevChar that cause problems when you change style at the end of the text.
  • Changes to the TextModelLogic class
    • Add additional logic when handling LINE_END event - should skip trailing paragraph breaks (for proper positioning when you want to go at the end of line, since we want para breaks to be at the end of lines now)
  • Also in TextModelLogic.handleMouseEvent and in Breaks.getNextCharacterPos fix a small bug with word spacing when you have trailing separators till the end of the text

Changed 10 years ago by boyanl

comment:9 Changed 10 years ago by boyanl

  • Status changed from s2a_design_started to s2b_design_finished

comment:10 Changed 10 years ago by kyli

  • Status changed from s2b_design_finished to s2c_design_ok
  • Design_score changed from 0 to 3.5
  • Design_reviewers set to pap, kyli
  • Generally seems ok but
  • First it is better to use int instead of Integer
  • It would be nice if line and respectively segment layouts weren't recreated so much because of PARA_BREAK ending lines.
  • Actually the justification is done per segment and not per line as is the requirement of the task. But this seems acceptable...
  • "fix a small bug" doesn't look like a design.
  • And looking at your code it could be written more readable.
    • No "boolean a = val1, b = val2".
    • Variable assignment inside loop and if statement's condition.

3.5p.

comment:11 Changed 10 years ago by boyanl

  • Status changed from s2c_design_ok to s3a_implementation_started

Changed 10 years ago by boyanl

comment:12 Changed 10 years ago by boyanl

  • Status changed from s3a_implementation_started to s3b_implementation_finished
  • Fixed the recreation of layouts but changed the behavior a bit (only the last segment is left-aligned as opposed to the whole line, but this doesn't contradict the analysis)

comment:13 Changed 10 years ago by pap

  • Status changed from s3b_implementation_finished to s3c_implementation_ok
  • Imp._score changed from 0 to 3.5
  • Imp._reviewers set to deyan, pap
  • Commited in [9155].
  • If you declare and initialize variables do this on separate lines.
  • Always write braces for the bodies of conditional and loop statements. This is a serious rule. Otherwise it is too easy to produce errors.

comment:14 Changed 8 years ago by meddle

  • Status changed from s3c_implementation_ok to closed
  • Resolution set to obsolete

Closing all the tickets before M Y1

Note: See TracTickets for help on using tickets.