1. 16 3月, 2017 1 次提交
    • R
      In greedy line breaking, repeat breaks until the line fits · 67d1601c
      Roozbeh Pournader 提交于
      Previously, in greedy line breaking, when a line overflowed, we found
      the best line breaking candidate before it and broke the line there.
      But we didn't check to see if the remaining part now fits in a line.
      
      With this change, we now repeat checking for overflows, and break
      again until we have no breaking opportunity or the remaining text now
      fits in a line.
      
      Also found an issue with greedy line breaking and keeping the
      hyphenation edit for the next line which is now fixed.
      
      Test: Manual. The issue reported in the bug is now fixed.
      Bug: 34185255
      Bug: https://code.google.com/p/android/issues/detail?id=231437
      Bug: 33560754
      Change-Id: I93bdd341e4f8e1257710e453e4938f224cb2a1ff
      67d1601c
  2. 03 3月, 2017 1 次提交
    • R
      Correct hyphenation for various complex cases · c7ef4000
      Roozbeh Pournader 提交于
      This adds better support for Arabic script languages, Armenian,
      Catalan, Hebrew, Kannada, Malayalam, Polish, Tamil, and Telugu by
      adding various hyphenation types and edits appropriate for the
      locales.
      
      For Arabic script languages, soft hyphens act transparently with
      regard to joining: If a line is broken at a soft hyphen where the two
      characters around the soft hyphen were joining each other before,
      they will continue to appear joining if the line is broken at the
      soft hyphen and a hyphen glyph is inserted.  This is needed for
      Central Asian languages such as Uighur.
      
      For Armenian, U+058A ARMENIAN HYPHEN is used for line breaks caused
      by either automatic hyphenation or soft hyphens.
      
      For Catalan, nonstandard line breaks are implemented for "l·l", which
      hyphenates as "l-/l".
      
      For Polish, when there is a line break at a hyphen, the hyphen is
      repeated at the next line.
      
      For the South Indic languages, when breaks happen due to soft breaks
      or automatic hyphenation, no visible hyphen is inserted, although a
      penalty is added.
      
      For Hebrew, support for using U+05BE HEBREW PUNCTUATION MAQAF has
      been implemented, but it's turned off pending confirmation of
      desirability.
      
      Also, hard hyphens, which previously had no penalty added for
      breaking the line after them, now have the same penalty as an
      automatic or soft break, with the difference that no hyphen is
      inserted when they break.
      
      Finally, some bugs have been fixed with hyphenating multiscript and
      multi-font words.
      
      Bug: 19950445
      Bug: 19955011
      Bug: 25623243
      Bug: 26154469
      Bug: 26154471
      Bug: 33387871
      Bug: 33560754
      Bug: 33752592
      Bug: 33754204
      Test: Unit tests added, plus thorough manual testing
      Change-Id: Iaccf776ce8d1d434ee8b1c534ff3659d80fdc338
      c7ef4000
  3. 24 2月, 2017 1 次提交
    • S
      Remove MinikinRefCounted and use shared_ptr instead · dfbc6e37
      Seigo Nonaka 提交于
      Let's use shared_ptr since manual ref counting can be a bug-prone and
      using the global mutex inside destructor is not useful for some time.
      
      To remove raw pointer manipulation, needed to change Layout
      constructors. Layout is no longer copyable and need to pass
      FontCollection to constructor.
      
      Bug: 28119474
      Test: minikin_tests passed
      Test: hwui_unit_tests passed
      Test: No performance regression in minikin_perftest.
      Change-Id: I8824593206ecba74cbc9731e298f045e1ae442a3
      dfbc6e37
  4. 02 1月, 2017 1 次提交
    • S
      Tune line breaking for justification · 3a74bcd0
      Seigo Nonaka 提交于
      Add an "mJustified" for justification, and tune the line breaking to
      produce good results. Major differences for fully justified text include:
      - Space can be shrunk in justified text.
      - Hyphenation should be more aggressive in justified text.
      
      Also adds a penalty for the last line being very short. This is tuned
      to be more aggressive for ragged right than for justified text.
      
      This is based on a patch by Raph Levien (raph@google.com).
      
      Bug: 31707212
      Test: Manually tested with Icbfab2faa11a6a0b52e6f0a77a9c9b5ef6e191da
      Change-Id: If366f82800831ccc247ec07b7bc28ca4c6ae0ed6
      3a74bcd0
  5. 10 6月, 2016 1 次提交
    • S
      Always use minikin namespace. · 14e2d136
      Seigo Nonaka 提交于
      Here is a new policy of the namespace of minikin.
      - All components should be in minikin namespace.
      - All tests are also in minikin namespace and no anonymous namespace.
      
      Bug: 29233740
      Change-Id: I71a8a35049bb8d624f7a78797231e90fed1e2b8c
      14e2d136
  6. 13 4月, 2016 1 次提交
    • R
      Clear mLineWidths in LineBreaker::finish() · 879e8a3a
      Raph Levien 提交于
      There was the possibility of stale indents from previous invocations
      persisting in the mLineWidths across multiple invocations. This patch
      clears them.
      
      Bug: 28090810
      Change-Id: I3621dfbe983512046289373711709aeade52eab4
      879e8a3a
  7. 17 2月, 2016 1 次提交
    • R
      Refine hyphenation around punctuation · 57b6dae9
      Raph Levien 提交于
      Implement a WordBreaker that defines our concept of valid word
      boundaries, customizing the ICU behavior. Currently, we suppress line
      breaks at soft hyphens (these are handled specially). Also, the
      new WordBreaker class has methods that determine the start and end
      of the word (punctuation stripped) for the purpose of hyphenation.
      
      This patch, in its current form, doesn't handle email addresses and
      URLs specially, but the WordBreaker class is the correct place to do
      so. Also, special case handling of hyphens and dashes is still done
      in LineBreaker, but all of that should be moved to WordBreaker.
      
      Bug: 20126487
      Bug: 20566159
      Change-Id: I492cbad963f9b74a2915f010dad46bb91f97b2fe
      57b6dae9
  8. 09 6月, 2015 1 次提交
    • R
      Increase hyphenation penalty for short last line · abae97a3
      Raph Levien 提交于
      Tuning for hyphenation parameters. We discourage hyphenation on the
      last line, but offset this penalty by also applying a penalty for
      each line, which optimizes for minimizing the number of lines. Thus,
      when hyphenation can reduce the number of lines, it increases the
      chance they're used.
      
      There's probably more tuning and refinement that can be done, but
      testing suggests that the tunable parameters are appropriate.
      
      Bug: 20883322
      
      Change-Id: Ida7eaf8aced109e426694f5a386924a842d29c4b
      abae97a3
  9. 13 5月, 2015 1 次提交
    • R
      Support hyphenation frequency in Minikin. · 0dc07c0b
      Roozbeh Pournader 提交于
      Three hyphenation frequencies are now supported:
      
      kHyphenationFrequency_None, which turns off both automatic
      hyphenation and soft hyphens.
      
      kHyphenationFrequency_Normal, which has aconservative amount of
      hyphenation useful as a conservative default.
      
      kHyphenationFrequency_Full, which has a typographic-quality amount of
      hyphenation useful for running text and tight screens.
      
      Bug: 21038249
      Change-Id: I2800f718c887c9389a1a059d7ec07d7fa2ca1dee
      0dc07c0b
  10. 16 4月, 2015 2 次提交
    • R
      Rename "margins" to "indents" · bb86b433
      Raph Levien 提交于
      The name "margin" conflicts with another meaning, so we're making the
      name in the public api "idents" and the code consistent in naming.
      
      Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
      bb86b433
    • R
      Add margins array to line widths object · dc7bc6e3
      Raph Levien 提交于
      In order to support layout in non-rectangular regions, the LineWidths
      object needs to accept an arbitrary array of margins. This is
      implemented in addition to the existing firstWidthLineCount/restWidth
      mechanism for convenience, though using only arrays would have the
      same expressive power.
      
      Bug: 20182243
      Change-Id: Iea96bca1a92012314ac27e617c67f306c1f1b2f2
      dc7bc6e3
  11. 31 3月, 2015 3 次提交
  12. 27 3月, 2015 1 次提交
    • R
      Add LineBreaker to Minikin · 01f52661
      Raph Levien 提交于
      This patch adds a LineBreaker class to Minikin, which will be used for
      computing line breaks in StaticLayout. The version in this patch
      contains basically the same functionality that existed before, but
      hopefully better performance and an interface that's suitable for more
      sophisticated paragraph layout.
      
      Note that this version contains a high quality strategy, which mostly
      works but doesn't respect varying line width.
      
      Change-Id: I02485d58b1e52856296a72cdd4efd963bc572933
      01f52661