Commit Graph

600 Commits

Author SHA1 Message Date
Seigo Nonaka
2d7e0faa4f Merge "Reduce memory usage of FontCollection." 2017-01-12 06:02:58 +00:00
Seigo Nonaka
0470cdb3e4 Remove FontFamily.addFont and make FontFamily immutable.
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
2017-01-12 13:27:00 +09:00
Seigo Nonaka
16768d72e0 Fix GraphemeBreak test failures.
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
2017-01-11 17:40:27 +09:00
Seigo Nonaka
4099825a5f Merge "Tune line breaking for justification" 2017-01-11 08:24:09 +00:00
Seigo Nonaka
d1c5b172cb Use HarfBuzz metric implementation for emoji font.
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
2017-01-11 17:21:40 +09:00
Mark Salyzyn
0043fb30d4 resolve merge conflicts of 9773115 to master
Test: compile
Bug: 30465923
Change-Id: I9bcbf910e90a9160ed2fd2f75c5d72dba6ad6fcf
2017-01-10 08:22:04 -08:00
Mark Salyzyn
9773115ad4 minikin: use log/log.h when utilizing ALOG macros am: 707bbae8ff am: 02c6dfea83
am: 869ad0c290

Change-Id: Ia4f4b30a4466a007c15f7606485611db9b168056
2017-01-10 16:09:13 +00:00
Mark Salyzyn
869ad0c290 minikin: use log/log.h when utilizing ALOG macros am: 707bbae8ff
am: 02c6dfea83

Change-Id: I228e76e2fffcab14996e38f19687e393985e2da0
2017-01-10 16:03:42 +00:00
Mark Salyzyn
02c6dfea83 minikin: use log/log.h when utilizing ALOG macros
am: 707bbae8ff

Change-Id: Ia5fd49e48b3223a708739782d6694d63d2932e48
2017-01-10 15:58:41 +00:00
Mark Salyzyn
707bbae8ff minikin: use log/log.h when utilizing ALOG macros
Use log/log.h to harden code against liblog changes.

Test: compile
Bug: 30465923
Change-Id: I3dea82e76d28d9ef52d7c0f11e038c4298863eb9
2017-01-09 13:33:48 -08:00
Seigo Nonaka
41ef8b376f Reduce memory usage of FontCollection.
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
2017-01-06 17:27:14 +09:00
Seigo Nonaka
311d94f416 Tune line breaking for justification
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
2017-01-02 22:51:40 +09:00
Mark Salyzyn
280e28b99d resolve merge conflicts of fbec42b to master
Test: build
Bug: 26552300
Bug: 31289077
Change-Id: I6181ae7e84f9bdcbed50841c70d07f6906a10eb7
2016-12-28 13:51:49 -08:00
Mark Salyzyn
fbec42b214 minikin: Replace cutils/log.h with android/log.h or log/log.h am: ff6cd90494 am: bc2dbaa9bf
am: 782d509a49

Change-Id: I97e1031fbf52cac46997e55444918d7c43abeb75
2016-12-28 21:32:23 +00:00
Mark Salyzyn
782d509a49 minikin: Replace cutils/log.h with android/log.h or log/log.h am: ff6cd90494
am: bc2dbaa9bf

Change-Id: Ie77d0b3e90aeafeef05b427750c04d5589a340dc
2016-12-28 21:24:57 +00:00
Mark Salyzyn
bc2dbaa9bf minikin: Replace cutils/log.h with android/log.h or log/log.h
am: ff6cd90494

Change-Id: I9bb9b1afaa27c1d5924c6d3888861dea1ff3c18b
2016-12-28 21:17:22 +00:00
Mark Salyzyn
ff6cd90494 minikin: Replace cutils/log.h with android/log.h or log/log.h
- replace cutils/log.h with android/log.h (main buffer logging)
- replace cutils/log.h with log.log.h (+SafetyNet logging)
- define LOG_TAG before use.

Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I7a4803dd66f31b7103e09e5ff5b8fa523fa0fd60
2016-12-27 10:10:18 -08:00
Dan Willemsen
2d48700bb1 Use LOCAL_TEST_DATA to install test data am: 7e38090b57 am: 62047ccb25 am: 4c1fe1e28c
am: 1e8d13909a  -s ours

Change-Id: I802c851e0518533a0c845483dc94b603c60c328a
2016-12-15 20:39:23 +00:00
Dan Willemsen
1e8d13909a Use LOCAL_TEST_DATA to install test data am: 7e38090b57 am: 62047ccb25
am: 4c1fe1e28c

Change-Id: I3d7dd7c58c544e90176f25cac568c10facce726b
2016-12-15 20:32:52 +00:00
Dan Willemsen
4c1fe1e28c Use LOCAL_TEST_DATA to install test data am: 7e38090b57
am: 62047ccb25

Change-Id: Ie02fbdc89e59707c899175dadb9700a4873f8010
2016-12-15 20:25:53 +00:00
Dan Willemsen
62047ccb25 Use LOCAL_TEST_DATA to install test data
am: 7e38090b57

Change-Id: I09c27394d95417a0bb8b0ee8a48580e6e88dc8c6
2016-12-15 20:18:22 +00:00
Dan Willemsen
7e38090b57 Use LOCAL_TEST_DATA to install test data
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
2016-12-15 18:47:17 +00:00
Dan Willemsen
7383094bf6 Merge "Use LOCAL_TEST_DATA to install test data" 2016-12-15 18:39:53 +00:00
Yirui Huang
a4a8c9cad6 Merge "Change language score calculation" 2016-12-14 05:45:23 +00:00
Dan Willemsen
6c5e3f1844 Use LOCAL_TEST_DATA to install test data
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
2016-12-13 17:12:32 -08:00
Colin Cross
88e53947ad Merge "Move LOCAL_PICKUP_FILES out of $OUT/data" am: 8d6a018645 am: 77f96edc2f am: 03959097a9
am: 8dc83b4547

Change-Id: I0d13d864021b47eed3ee730fb09783044423ecd4
2016-12-09 02:20:54 +00:00
Colin Cross
8dc83b4547 Merge "Move LOCAL_PICKUP_FILES out of $OUT/data" am: 8d6a018645 am: 77f96edc2f
am: 03959097a9

Change-Id: I5bd69940f0e495119dd6154fb9e1efe34fa9a062
2016-12-09 02:10:36 +00:00
Colin Cross
03959097a9 Merge "Move LOCAL_PICKUP_FILES out of $OUT/data" am: 8d6a018645
am: 77f96edc2f

Change-Id: I1e38ef5ae3a4d6a977df856abbb160b2e5fcde4e
2016-12-09 02:05:35 +00:00
Colin Cross
77f96edc2f Merge "Move LOCAL_PICKUP_FILES out of $OUT/data"
am: 8d6a018645

Change-Id: I0aac6741d2c92bbe46fdf89931460fbb41acc1ea
2016-12-09 02:01:37 +00:00
Colin Cross
8d6a018645 Merge "Move LOCAL_PICKUP_FILES out of $OUT/data" 2016-12-09 01:53:13 +00:00
Yirui Huang
f20a2ef271 Change language score calculation
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
2016-12-06 18:17:54 +09:00
Colin Cross
be7c33a74e Move LOCAL_PICKUP_FILES out of $OUT/data
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
2016-12-02 18:04:42 -08:00
Hal Canary
ccce2fd909 SkImageEncoder->SkEncodeImage
Test: none
Change-Id: I9115c41f1699ab5d9d677251d96ea8f4fb844845
2016-11-24 12:09:19 -05:00
yirui
9bc8f53117 Parse Emoji subtag and store it to FontLanguage
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
2016-11-21 06:24:26 +00:00
Seigo Nonaka
964f053ea4 Clean Up: Removing unused interface GetTable from MinikinFont.
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
2016-11-17 17:36:51 +09:00
Seigo Nonaka
e906f2b416 Merge "Implement word spacing" 2016-11-17 08:00:05 +00:00
Martijn Coenen
7c620ba62d Fix calls to deprecated range_x.
Test: fixes master build.
Change-Id: I8b2822d310c0cf423b15834e6d6ae3a9ea64233b
2016-11-16 10:30:01 +01:00
Seigo Nonaka
6b9c9dec1f Implement word spacing
Add a wordSpacing paint parameter, which will be used for
justification.

Bug: 31707212
Test: ran minikin_tests
Change-Id: I91224ab8ef882ac0c87425c28ab731fead283612
2016-11-16 17:36:26 +09:00
Seigo Nonaka
c2a51ec51b Merge "Fix lookup order for VS in itemization." 2016-11-07 07:28:37 +00:00
Seigo Nonaka
dc8de001df Revert "Clean Up: Removing unused interface GetTable from MinikinFont."
This reverts commit 7b02f5e95c.

This causes a crash on Android Auto.

Bug: 32374752
Change-Id: Ia2ff77bf9a12351c6949f79ef6fa2d8016e3022d
2016-10-25 00:49:52 +00:00
Seigo Nonaka
7b02f5e95c Clean Up: Removing unused interface GetTable from MinikinFont.
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
2016-10-18 08:16:18 +00:00
Seigo Nonaka
5bd8edea61 Fix lookup order for VS in itemization.
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
2016-09-15 16:23:40 +09:00
Dan Willemsen
4d688b0172 Merge "Rename libicuuc-host/libicui18n-host to libicuuc/libicui18n" am: f8ca78ffa4 am: 90f9f8d7a2 am: e2217d5b85
am: b4c239f555

Change-Id: I85ee278323a578fcf941651161b46ef0559098cc
2016-09-13 04:32:28 +00:00
Dan Willemsen
b4c239f555 Merge "Rename libicuuc-host/libicui18n-host to libicuuc/libicui18n" am: f8ca78ffa4 am: 90f9f8d7a2
am: e2217d5b85

Change-Id: I346fddaa5822eee2371d877a8bdeb055b6244c0d
2016-09-13 03:58:51 +00:00
Dan Willemsen
e2217d5b85 Merge "Rename libicuuc-host/libicui18n-host to libicuuc/libicui18n" am: f8ca78ffa4
am: 90f9f8d7a2

Change-Id: Ia8b56a95d11d74af5a2cac1fe8e604532c44a9cf
2016-09-13 03:56:10 +00:00
Dan Willemsen
90f9f8d7a2 Merge "Rename libicuuc-host/libicui18n-host to libicuuc/libicui18n"
am: f8ca78ffa4

Change-Id: Ia005ecb8dedc90aa8a908edda839da563152e861
2016-09-13 03:51:13 +00:00
Dan Willemsen
f8ca78ffa4 Merge "Rename libicuuc-host/libicui18n-host to libicuuc/libicui18n" 2016-09-13 03:47:02 +00:00
Elliott Hughes
88ca7498cc Switch minikin to std::unique_ptr. am: fba88d3b3c am: c5e0585ac7 am: 83bdd0ae73
am: b150a633ba

Change-Id: I56cce90607bce82d337d4da3b4ac5f167c7cc1b4
2016-09-13 01:50:14 +00:00
Elliott Hughes
b150a633ba Switch minikin to std::unique_ptr. am: fba88d3b3c am: c5e0585ac7
am: 83bdd0ae73

Change-Id: I9c0b81d55e01b08b053a7031a214626351244607
2016-09-13 01:29:45 +00:00
Elliott Hughes
83bdd0ae73 Switch minikin to std::unique_ptr. am: fba88d3b3c
am: c5e0585ac7

Change-Id: Ie9f9aac239cb29568819de699e4999989a7a11bf
2016-09-13 01:27:07 +00:00