This lays the groundwork for making SparseBitSet serializable.
FontFamily.addFont is only used when the FontFamily is constructed.
Thus, instead of calling FontFamily.addFont multiple time, passes
Font list to the constructor. By this change, FontFamily can be
immutable now.
By making FontFamily immutable, We can create FontFamily with
pre-calculated SparseBitSet.
Bug: 34042446
Test: minikin_tests has passed
Change-Id: I2576789fba6cb27687e920e2488e8bedbcf7d36f
GraphemeBreak.tailoring/GraphemeBreak.genderBalancedEmoji start failing
after ICU update to 58. The failure is around Rule GB9 in Unicode Standard
Annex #29. GB9 forbids breaks before extending characters and before ZWJ.
However the implementation in minikin only checks for extending characters.
It used to work with Unicode 8.0 since ZWJ had the Grapheme_Cluster_Break
property of Extend in Unicode 8.0 but it no longer has that property in
Uniocde 9.0.
Thus, we need to check for ZWJ explicitly.
At the same time, this removes manually added PREPEND characters case from
tailoredGraphemeClusterBreak which is already supported in ICU 58.
Test: minikin_tests passes
Bug: 34117643
Change-Id: Ib46d48bebe4a866208e050d7defc715c61fcbeb1
To avoid lock contention in Skia, use HarfBuzz implementation
for retrieving boundary box and advance information from font.
Bug: 21705974
Test: Manually done
Change-Id: Ia88cb670ca9e0bb352bccef22c5ea3a789bcc1da
Since switching to 64-bit devices, size_t is now a 64-bit integer.
FontCollection::Range uses two size_t integers but they just point to an index
in mFamilies. To reduce the memory usage, this CL changes the size_t integers to
uint8_t.
The maximum size of each integer in Range is the size of FontCollection::mFamilies.
The largest this can go is the system font list plus a user defined family, which
has 91 families. So an 8-bit integer should be enough.
With this change, about 84 KiB of memory will be saved per font collection. Since
eight font collections are created during bootstrap, about 670 KiB of memory will
be saved with this CL.
Bug: 33562608
Test: Ran FontCollection.collectionAllocationSizeTest on a 64-bit device.
On my Nexus 5X, it changed from 327358 to 241342.
Change-Id: I9e01d237c9adcb05e200932401cb1a4780049f86
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
This will handle installation for local builds as well as for the test
bundles.
Test: m -j minikin_tests; ls $OUT/data/nativetest*/minikin_tests
Test: m -j continous_native_tests dist; zipinfo -1 out/dist/*continuous_native_tests*.zip
Test: /data/nativetest{,64}/minikin_tests/minikin_tests
Change-Id: Iafd31fa119e7c4d92937ca8ae8346e268a6c1f38
Merged-In: Iafd31fa119e7c4d92937ca8ae8346e268a6c1f38
This will handle installation for local builds as well as for the test
bundles.
Test: m -j minikin_tests; ls $OUT/data/nativetest*/minikin_tests
Test: m -j continous_native_tests dist; zipinfo -1 out/dist/*continuous_native_tests*.zip
Test: /data/nativetest{,64}/minikin_tests/minikin_tests
Change-Id: Iafd31fa119e7c4d92937ca8ae8346e268a6c1f38
Change language score calculation in the calculation of the font family.
Instead of language and script matching, a match in subtag is added.
In addition, a match in subtag has a higher priority than a match in
script. The score levels are divided into 5 score levels and the limit
of the number of font languages is changed to 12 from 17. Multiple
languages selection rule could to be added in the future.
Bug: 31608997
Test: Done by unittests.
Change-Id: I1e7177095f604fd1794bc99ca36c705dcb4c56e7
minikin_tests was copying its test data to
$OUT/data/DATA/nativetest/minikin_test, and then packaging that with
LOCAL_PICKUP_FILES=$OUT/data/DATA, which would also pick up anything
any other module copyied to $OUT/data/DATA. $OUT/data/DATA isn't
where the tests expect to find their data, they look in
/data/nativetest/minikin_test. Copy the files to the intermediates
directory instead.
A future change will install LOCAL_PICKUP_FILES for local builds
to the correct place, so adb sync and
adb shell /data/nativetest/minikin_tests/minikin_tests will run the
tests.
Test: mma -j
Change-Id: I808ce743f51e5ccac711e22821e7e0d7cd94ffdf
Parse Emoji subtag and store into 4 different styles: default, text,
color and empty. Replace hasEmojiFlag function with getEmojiStyle to
get effective status according to script and subtag. However, score
calculation for the font selection needs to be completed in the next
stage. No performance regression is observed with this CL.
Bug: 31608997
Test: Done by unittests.
Change-Id: I923243641c946248dd5a0aa9fb9c940515310d34
This is 2nd attempt of Ifcd7a348d7fb5af081192899dbcdfc7fb4eebbf9
After Id766ab16a8d342bf7322a90e076e801271d527d4, GetTable is no longer
used in production due to poor performance and it is now only used in
tests. This CL removes GetTable interface from MinikinFont and update
tests code to use new interfaces, GetFontData, GetFontSize and
GetFontIndex.
Bug: 27860101
Test: Manually done
Change-Id: Ib48973ff25cdc61a4c666d28128266df0aaea83e
Add a wordSpacing paint parameter, which will be used for
justification.
Bug: 31707212
Test: ran minikin_tests
Change-Id: I91224ab8ef882ac0c87425c28ab731fead283612
After Id766ab16a8d342bf7322a90e076e801271d527d4, GetTable is no longer
used in production due to poor performance and it is now only used in
tests. This CL removes GetTable interface from MinikinFont and update
tests code to use new interfaces, GetFontData, GetFontSize and
GetFontIndex.
Bug: 27860101
Test: Manually done
Change-Id: Ifcd7a348d7fb5af081192899dbcdfc7fb4eebbf9
This is partial revert of Iced1349e3ca750821d8882c551551f65bb569794.
Due to sorting of target family vectors, the font family order from XML
settings file is broken. Making unique operation stable doesn't fix the
issue completely since some font families are appended for the fallback
which also breaks the original order.
By this change, itemization becomes 3x slower than before if variation
selector is appended.
Bug: 29585939
Change-Id: I7c1a8a57f04111a30cd41a5cd5bec25fcfb3972e