Commit Graph

371 Commits

Author SHA1 Message Date
Colin Cross
fa994b25d1 Convert frameworks/minikin/tests to Android.bp
See build/soong/README.md for more information.

Test: m -j checkbuild
Change-Id: I930debdd129da7f61ac4b764980f73dfd487785d
2017-04-25 10:53:34 -07:00
Colin Cross
716f07be94 Convert frameworks/minikin to Android.bp
See build/soong/README.md for more information.

Test: m -j checkbuild
Change-Id: I71d3406054b35dd4e8ae30f46eec6cef77eef160
2017-04-20 12:44:52 -07:00
Seigo Nonaka
d554978b08 Reduce heap memory in minikin. am: 97ee89d605
am: e1ae48dec9

Change-Id: I0d3c390915f9eef90afd2c655295929e5de0534c
2017-04-15 01:36:15 +00:00
Seigo Nonaka
97ee89d605 Reduce heap memory in minikin.
This patch reduces about 73 kB memory.
The original SparseBitSet could contain full 32bit integers, but all of
that is not necessary for Unicode code points. By reducing the supported
range to up to Unicode maximum, U+10FFFF, we can save extra memory.

SparseBitSet holds 256-bit sliced pages and indices of them.
Previously, we needed to hold up to 2^24-1 pages for keeping 32-bit
integers.

This CL limits the number of pages to 2^16-1 (65535), so that
SparseBitSet only supports 24-bit integers now, but this is sufficient
for keeping all Unicode code points. With this change, we can change the
index integer type from uint32_t to uint16_t.

Bug: 37357593
Test: minikin_tests passes
Change-Id: I462cc27927752c942ac5da0bf303a5afb81b87a3
2017-04-14 22:54:27 +00:00
Seigo Nonaka
e952c1cc40 Support cmap tables with platform ID == 0 am: cc8f7117d3
am: 60d6553199

Change-Id: Ib1e6808f542d75e06044908dc88b6e2ba3abfed7
2017-04-04 17:02:31 +00:00
Seigo Nonaka
cc8f7117d3 Support cmap tables with platform ID == 0
Some fonts don't have cmap subtables of Microsoft Platform ID (3) and
only have cmap subtables of Unicode Platform ID (0).

Bug: 32505843
Test: minikin_unittest passed
Test: android.graphics.cts.TypefaceTest passed
Change-Id: I24aa49860790c0ae8d8e578efd728b95ec0f93ae
2017-04-03 14:57:19 -07:00
Roozbeh Pournader
9d107a9c64 Override the bidi properties of new emojis am: d01462f7a1
am: a6cf123565

Change-Id: Ic55ed4b18cb9c41a4c0c96d8f8dee431dffe905a
2017-04-03 00:33:43 +00:00
Roozbeh Pournader
d01462f7a1 Override the bidi properties of new emojis
Test: new Minikin tests are added, and pass
Bug: 32952475
Change-Id: Ibcae60d18d0cd5efd7556aaf58a716b6b59c8ee0
2017-04-02 15:30:21 -07:00
TreeHugger Robot
a29637e1d4 Merge "Add test config to minikin_tests" 2017-03-31 17:04:15 +00:00
Roozbeh Pournader
a994c50513 Remove unused classes and methods am: 7708c89648
am: dba486668d

Change-Id: Idffb6ba27d09a9ab9e0c7e737e00a1dbb7f1e09c
2017-03-31 03:14:23 +00:00
Roozbeh Pournader
7708c89648 Remove unused classes and methods
Removed Bitmap and MinikinFontFreeType classes, as well
as the Layout::draw() method.

The code was there for debugging purposes and for potential
third-party users. We no longer support third-party uses of
Minikin, since we don't know of any.

Test: mmma -j frameworks/minikin builds with no errors
Change-Id: Iddc9e8d35334053bd5255bccf3dbe5ba1eecf814
2017-03-30 17:52:56 -07:00
TreeHugger Robot
9595fe65b8 Merge "Add test config to minikin_perftests" 2017-03-29 21:10:34 +00:00
Dan Shi
f0d9c2f52d Add test config to minikin_perftests
Design doc:
Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap
https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
Change-Id: I23366d56aaa7fbd22ed8233df0969a17e371c5a5
2017-03-29 12:11:51 -07:00
Dan Shi
bbffea58c5 Add test config to minikin_tests
Design doc:
Generalized Suites & the Unification of APCT & CTS Workflows Design/Roadmap
https://docs.google.com/document/d/1eabK3srlBLouMiBMrNP3xJPiRRdcoCquNxC8gBWPvx8/edit#heading=h.78vup5eivwzo

Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

Bug: 35882476
Test: local test
Change-Id: I0b1e0dc39975bc373685eb8adf1e297dc8f4c07a
2017-03-28 16:10:05 -07:00
Seigo Nonaka
6a5534a437 Remove unused functions.
This CL is essentially reverting following changes:
- "Serialize and deserialize supported axes."
  I4086fb887e13f872390b533584bce6f1d5598ea0
- "Make SparseBitSet serializable."
  I0463138adcf234739bb3ce1cdadf382021921f3e

Bug: 36232655
Test: N/A
Change-Id: I25c701e1805e92b01034142147a9925f86533819
2017-03-22 16:00:35 -07:00
TreeHugger Robot
ad55a59727 Merge "Expose supportedAxes to frameworks/base" 2017-03-20 17:37:07 +00:00
Roozbeh Pournader
aa928e61b7 Relax requirement for text variation sequences
Previously, we insisted that in order for us to claim that a text variation
sequence is supported or to display it, it needs to be standardized already.
Now we accept any character as the base of a text variation sequence and
support it as far the font used to display it is not an emoji font.

Also fix a typo in a font name.

Test: Unit tests are updated and pass.

Bug: 30874706
Change-Id: I9660ec43aeee84303cfb825352a7f5029d036dd6
2017-03-17 17:25:37 -07:00
Roozbeh Pournader
8eb2df1a8e Remove workaround for line breaks around currency symbols
This is now done properly in ICU so we no longer need to do it ourselves.

Also updated some comments about emoji line-breaking.

Test: Existings tests for this in Minikin continue to pass.
Bug: 24959657
Bug: 27365282
Change-Id: I865ea9ba1e79a64409d84d2d30c121f740e35ad6
2017-03-17 15:42:49 -07:00
Roozbeh Pournader
215f7ff8d0 Update Minikin to use ICU's emoji data
Certain differences are still needed, since ICU appears to support
Emoji 4.0 only, while we need Emoji 5.0. But the bulk of the data is
now carried by ICU.

We no longer need the script that generates the tables, so that's
also removed.

Test: Comprehensive unit tests added.
Bug: 27365282
Bug: 30874706
Change-Id: I011443fbca9bb202deff7fffb40043f89e1f1fb1
2017-03-17 14:58:01 -07:00
TreeHugger Robot
a5b935ff67 Merge "Introduce FontCollection construct perf test" 2017-03-17 19:33:45 +00:00
Seigo Nonaka
2d0bfff203 Introduce FontCollection construct perf test
Test: ran minikin_perftest
Bug: 36232655
Change-Id: Ic4d88663d522be17540e2ac17c9b7ae64210275f
2017-03-17 07:42:21 -07:00
TreeHugger Robot
e4e4ea1ede Merge "Update emoji character data in Minikin" 2017-03-17 03:20:24 +00:00
Roozbeh Pournader
3d10a1ed4f Update emoji character data in Minikin
Update emoji character data to Unicode 10.0 / Emoji 5.0 (which also
removes U+1F93B MODERN PENATHLON from the emoji base letters).

Also add unit tests for line breaking for new characters (based on
earlier work by Seigo Nonaka).

Test: All new and existing unit tests pass;
Test: Manually tested line breaking of new emojis in TextView.

Bug: 28364892
Bug: 28678294
Bug: 30874706
Change-Id: I367cdab09187dc08a66a3112a5181a2b7fb338a5
2017-03-16 18:29:01 -07:00
TreeHugger Robot
bbc4943973 Merge "Update emoji grapheme breaking rules" 2017-03-16 22:54:13 +00:00
TreeHugger Robot
61bb3fbc81 Merge "Refactor WordBreaker" 2017-03-16 21:20:15 +00:00
Roozbeh Pournader
f2fd20ec54 Update emoji grapheme breaking rules
The rules are updated to the latest UAX #29, with tailorings based on
the font in use: we can now use the clustering information
calculated by Layout, so we will only disallow a grapheme break if an
emoji ligature is actually formed.

Test: Unit tests have been updated and pass.
Bug: 30917298
Bug: 34211654
Change-Id: Idc0ef9f1f4f45dc45a50ed69e45c43ebfaea0306
2017-03-16 13:34:52 -07:00
Roozbeh Pournader
f3399b503e Refactor WordBreaker
Refactor WordBreaker to make it ready for more complex behavior.

Test: existing unit tests continue to pass
Change-Id: Ife758f3e2cf48922ab56109e6c5d3cffa3673feb
2017-03-16 12:23:08 -07:00
TreeHugger Robot
464d63f0d8 Merge "Introduce minikin_stress_tests to find race condition." 2017-03-16 00:50:50 +00:00
TreeHugger Robot
4b613e361b Merge "Serialize and deserialize supported axes." 2017-03-15 23:30:30 +00:00
Seigo Nonaka
e64e9b2176 Introduce minikin_stress_tests to find race condition.
This is designed for catching race condition.
The stress_tests is splited from unit test binary since this takes
30 seconds on angler.

Bug: 36223724
Bug: 36208043
Test: ran minikin_stress_tests
Change-Id: I1bf4ba43e6e97cd04e7d6dd42d388dd17ce64c7b
2017-03-15 16:11:33 -07:00
TreeHugger Robot
0c8d074c0c Merge "Fallback from script-specific hyphens to normal hyphen first" 2017-03-15 22:45:31 +00:00
TreeHugger Robot
c044fd4ed7 Merge "In greedy line breaking, repeat breaks until the line fits" 2017-03-15 22:29:13 +00:00
Seigo Nonaka
ca8ac8a924 Serialize and deserialize supported axes.
To avoid reading font files during FontFamily construction, serialize
and deserialize supported axes and cmap coverage at the same time.

Bug: 36232655
Test: ran minikin_tests
Change-Id: I4086fb887e13f872390b533584bce6f1d5598ea0
2017-03-15 14:18:13 -07:00
Roozbeh Pournader
aae6468815 Fallback from script-specific hyphens to normal hyphen first
The previous code fell back directly from a script-specific hyphen to
the ASCII hyphen-minus if the font didn't support the script-specific
hyphen. Now we try the Unicode hyphen (U+2010) first before trying
the ASCII hyphen-minus.

Bug: 36201363
Test: Not needed
Change-Id: I374234fd73fab7edd990ea86f8937c38761c90bf
2017-03-15 14:15:46 -07:00
Roozbeh Pournader
d2aaf3394a In greedy line breaking, repeat breaks until the line fits
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
2017-03-15 13:52:21 -07:00
TreeHugger Robot
fde7453c82 Merge "Break grapheme clusters after viramas if they end a cluster" 2017-03-15 19:53:12 +00:00
Seigo Nonaka
3165aebe3b Do not keep FontCollection reference in Layout.
LayoutCache only keeps result of layout and can live after
FontCollection is destructed by GC.

This kind of failure will be captured by minikin_stress_tests in the
subsequent CL (I1bf4ba43e6e97cd04e7d6dd42d388dd17ce64c7b)

Test: ran minikin_tests
Bug: 36223724
Change-Id: I639b73c0f1041549158c43212a901c82df4b02db
2017-03-15 15:17:43 +00:00
Seigo Nonaka
8d9c9d7f20 Expose supportedAxes to frameworks/base
The list of supportedAxes are necessary for returning value of
setFontVariationSettings.

Bug: 35764323
Test: ran TextViewTest and PaintTest in cts
Change-Id: I52f244146ea0ce335df02c841f89285be2ed746e
2017-03-15 14:32:08 +00:00
Roozbeh Pournader
f4c0bd2e1b Break grapheme clusters after viramas if they end a cluster
Previously, we stayed on the conservative side and disallowed any
grapheme breaks (and thus cursoring) where a virama was followed by a
letter, since we did not know if the virama would be forming a
cluster with the letter or not. This created problems with Indic
languages with infrequent conjuncts, such as Tamil.

Now we use the information in calculated advances to find if a
cluster is formed. If there is no cluster, we break the grapheme and
allow cursoring after the virama.

Test: Unit tests added to GraphemeBreakTests and MeasurementTests.
Test: Also manually tested Tamil sequences.
Bug: 35721792
Change-Id: Ib159edb94b3ad6f693f0d3dad016b332b2cef447
2017-03-14 21:41:49 -07:00
Seigo Nonaka
44914ce013 Revert "Use std::mutex instead of android::Mutex"
This reverts commit 0eac702718.

Bug: 36208043
Test: N/A

Change-Id: I165ab7a0718ea50a8034adb6277809e271fd762c
2017-03-14 10:48:42 -07:00
Seigo Nonaka
7945b2d019 Fix build failure due to unexpected merge.
FontLanguageListCache::kEmptyListId is gone, use kEmptyLanguageListId
instead.

Test: N/A
Change-Id: I96075849c53f23fbce8dbc180a51d8f97e45f316
2017-03-13 16:42:46 -07:00
TreeHugger Robot
aed4ec33ad Merge "Make SparseBitSet serializable." 2017-03-13 23:07:04 +00:00
Seigo Nonaka
ff9a6740ed Make SparseBitSet serializable.
To share the calculated coverage information across the processes, make
SparseBitSet serializable.

Bug: 34042446
Test: minikin_tests passes
Change-Id: I0463138adcf234739bb3ce1cdadf382021921f3e
2017-03-13 14:07:55 -07:00
Seigo Nonaka
0eac702718 Use std::mutex instead of android::Mutex
This CL includes:
- Stop using utils/Mutex and use std::mutex instead.
- Stop using utils/Singleton.

Test: minikin_tests passed
Change-Id: Ib3f75b83397a546472bb5f91e066e44506e78263
2017-03-13 14:03:05 -07:00
Seigo Nonaka
684ac0b636 Reduce memory usage of FontCollection.
This is 2nd attempt at I9e01d237c9adcb05e200932401cb1a4780049f86.

The previous CL was reverted because 8-bit integers were too small to
store the indices of mFamilyVec. This CL changes it to 16-bit integers
since size_t is still unnecessary large.

Theoretically, 32-bit integers are necessary for the indices of
mFamilyVec since the size of mFamilyVec can be 0x10EE01. However, in
practice, 16-bit integers are enough for the indices of mFamilyVec.
The length of mFamilyVec for the system fonts is 2084. Even if the
developers load their own very large fonts, it can only increase the
number of elements in mFamilyVec to at most 0x10FF.

As the result, memory usage of the FontCollections for the system fonts
decreases as follows.
64-bit process: before: 398,264 bytes, after: 282,568 bytes (-115,696 bytes)
32-bit process: before: 199,132 bytes, after: 149,548 bytes (-49,584 bytes)

Bug: 33562608
Test: Verified Emoji and CJK characters are present.
Test: android.text.cts.EmojiTest passed
Test: Minikin unit tests passed
Change-Id: I6796fd55ac30fe30528a212ebf6097b1d672e2f8
2017-03-13 06:35:53 -07:00
Roozbeh Pournader
068c7ba2ea Customizable min suffix/prefix length for hyphenation in Minikin
With this change, different languages can have a different minimum
length for suffix and prefixes when hyphenating. Previously, the
defaults used for English, 2 and 3, were used for every language.

Bug: 35712376
Test: Minikin unit tests were updated and the pass
Change-Id: Iffaf11c6b208c57d28d45b17246e177572dc1210
2017-03-06 16:12:53 -08:00
TreeHugger Robot
0b451587cc Merge "Remove sample directory" 2017-03-06 23:47:55 +00:00
Roozbeh Pournader
22d4e7e3f3 Remove sample directory
Since there are no known users of Minikin outside Android yet, these
files are simply a maintenance burden with no actual benefit.
Removing the samples until there are potential external users.

Test: Not needed
Change-Id: If7f1fb775cae427fbe31b86c202d1380c701bf28
2017-03-06 14:05:23 -08:00
Roozbeh Pournader
319073941e Correct hyphenation for various complex cases
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
2017-03-02 15:26:13 -08:00
Seigo Nonaka
2f1aebfcc6 Merge "Remove MinikinRefCounted and use shared_ptr instead" 2017-02-27 04:30:31 +00:00