474 Commits

Author SHA1 Message Date
Roozbeh Pournader
4bce602bbe Add exception for Bulgarian to mk_hyb_file am: 2c97cc90c9 am: d911033995
am: d2e637ea00

Change-Id: Ieee903aff9b9759da30996d9c64cf0dcf94d7294
2017-02-24 14:46:53 +00:00
Roozbeh Pournader
d2e637ea00 Add exception for Bulgarian to mk_hyb_file am: 2c97cc90c9
am: d911033995

Change-Id: I960946e29e3aeb6bac9cc2028a2201e8c8d5ae4f
2017-02-24 14:43:52 +00:00
Roozbeh Pournader
d911033995 Add exception for Bulgarian to mk_hyb_file
am: 2c97cc90c9

Change-Id: I551c3cae80bf13ca43f13548777691b244197df1
2017-02-24 14:41:45 +00:00
Roozbeh Pournader
2c97cc90c9 Add exception for Bulgarian to mk_hyb_file
The Bulgarian hyphenation patterns contain a line consisting of '0ь0'
which has no practical effect on hyphenation. Add an exception in
roundtrip testing to make sure we don't fail while comparing our tables
with the input data.

Test: make -j works and creates .hyb files for bg and cu
Change-Id: Ia46b8a45fe522f5194d8105d31b34b0e27528cc9
(cherry picked from commit 3e203b7b62404d3cf4aaf5e11b946047461a7a82)
2017-02-24 13:04:41 +00:00
Roozbeh Pournader
3e203b7b62 Add exception for Bulgarian to mk_hyb_file
The Bulgarian hyphenation patterns contain a line consisting of '0ь0'
which has no practical effect on hyphenation. Add an exception in
roundtrip testing to make sure we don't fail while comparing our tables
with the input data.

Test: make -j works and creates .hyb files for bg and cu
Change-Id: Ia46b8a45fe522f5194d8105d31b34b0e27528cc9
2017-02-22 18:48:18 -08:00
Seigo Nonaka
39654bb644 Call hb_font_set_variation if font variations are provided.
Test: None
Change-Id: I203d9ba7e1a1fcfdb10cd6a711d9a35136cbddd6
2017-02-22 10:56:04 +09:00
Seigo Nonaka
22462be735 Pass region code to HarfBuzz.
Keep the region code and pass it to HarfBuzz during doing layout.

Test: minikin_tests
Bug: 30746293
Change-Id: I7c908701ca677238f663c82c597f8615d190e055
2017-02-15 20:29:38 +09:00
Roozbeh Pournader
90d8b567ef Add U+202F NARROW NO-BREAK SPACE to the sticky white list
Mongolian fonts need to shape across U+202F NARROW NO-BREAK SPACE
(NNBSP). But if the first font in the fallback chain supports NNBSP,
it would break Mongolian shaping since the text would be broken into
three font runs. By making NNBSP sticky, we make sure Mongolian text
is kept in one font run and is shaped properly.

See http://www.unicode.org/L2/L2017/17036-mongolian-suffix.pdf for
background. The proposed character in the proposal was not accepted
for encoding by the Unicode Techincal Committee, but the document
explains in more detail why this change in needed.

Bug: 34344220
Test: manual
Change-Id: I344a63f383fa5485875603570025eac3c4eb2574
2017-02-14 21:29:18 +00:00
TreeHugger Robot
d664479dcc Merge "Introduce unittests for flag sequence." 2017-02-08 17:00:39 +00:00
Seigo Nonaka
e05034f356 Introduce unittests for flag sequence.
The Flag sequence is well handled by latest ICU.
Just add unit tests for catching regression in future.

Test: ran minikin_tests
Change-Id: I78d5461de8ff4d002ca06fb5bb81fcd7bc45d95e
2017-02-09 00:10:35 +09:00
Seigo Nonaka
f980baa2be Update the instruction to run tests.
"adb sync data" pushes test data as well as test executables.

Test: ran minikin_perftests
Test: ran minikin_tests
Change-Id: I08219f8abc4b59bd26d8f9155975b65b56a88b7b
2017-02-07 15:52:25 +09:00
Seigo Nonaka
065c46a665 Introduce createCollectionWithVariation.
This is 2nd attempt of I08e9b74192f8af1d045f1276498fa4e60d73863e.
The original CL was reverted due to conflicting with another CL submitted
before.

Here is the original commit message of reverted change.

This lays the groundwork for variation settings support.
Since we should regard different variations of a font as different fonts, we
need to create new typefaces. To reuse the same instance of MinikinFont, as
much as possible, FontFamily::createFamilyWithVariation now reuses an
existence instance, while incrementing the reference count.

Test: minikin_tests
Bug: 33062398
Change-Id: Ib25bf1bb5a5191e15a6523954146521464c91906
2017-01-31 13:19:56 +09:00
Seigo Nonaka
41718c770d Remove FontFamily.addFont and make FontFamily immutable.
This is 2nd attempt of 41e02e96131c1ec66d013e4615348be013518dc4
The difference is adding clearElementsEithLock to Font class which
is necessary to delete Fonts object outside of minikin. This method
should be removed once http://b/28119474 is fixed.

Here is original commit message of reverted change.

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
Bug: 28119474
Bug: 34378805
Test: minikin_tests has passed
Change-Id: Ice433931196f5ae79a1a7ee0c98020f914aeb5f2
2017-01-20 17:59:42 +09:00
Siyamed Sinir
cc0352cc67 Revert "Remove FontFamily.addFont and make FontFamily immutable."
This reverts commit 41e02e96131c1ec66d013e4615348be013518dc4.

Bug: 34378805
Change-Id: I8f1ee00b365c8b17c6140e9e286fbea082e31364
2017-01-20 02:01:21 +00:00
Siyamed Sinir
e1d0fe1e93 Merge "Revert "Introduce createCollectionWithVariation."" 2017-01-20 01:59:54 +00:00
Siyamed Sinir
1c7b026154 Revert "Introduce createCollectionWithVariation."
This reverts commit 90e6b1885d44c33b1da9477a85dc7dd066acd33f.

Bug: 34378805
Change-Id: I22b683f774813724f220b1b8584ab188f3cf4fa7
2017-01-20 01:13:24 +00:00
Siyamed Sinir
22e7e464af Merge "Revert "Reduce memory usage of FontCollection."" 2017-01-12 20:19:57 +00:00
Siyamed Sinir
1d753f6fe9 Revert "Reduce memory usage of FontCollection."
This reverts commit c4b989fc812af6c94018bad2e30ed6a006e2f8f5.

Test: Manually tested
Bug: 34247671
Change-Id: I0510009b2deac784770f26059681b1980800abc8
2017-01-12 20:13:11 +00:00
TreeHugger Robot
646a6f8035 Merge "Introduce createCollectionWithVariation." 2017-01-12 16:59:26 +00:00
Seigo Nonaka
0decbb3686 Fix inverse condition of forColorEmoji.
We should override the advance function only when the glyph is came
from color bitmap. This was introduced by
Ia88cb670ca9e0bb352bccef22c5ea3a789bcc1da.

Bug: 21705974
Test: ran minikin_tests
Change-Id: I3489d75ace8bffdd9035a5986a2641313feef04d
2017-01-12 18:35:27 +09:00
Seigo Nonaka
90e6b1885d Introduce createCollectionWithVariation.
This lays the groundwork for variation settings support.
Since we should regard different variations of a font as different fonts, we
need to create new typefaces. To reuse the same instance of MinikinFont, as
much as possible, FontFamily::createFamilyWithVariation now reuses an
existence instance, while incrementing the reference count.

Test: minikin_tests
Bug: 33062398
Change-Id: I08e9b74192f8af1d045f1276498fa4e60d73863e
2017-01-12 18:26:46 +09:00
Seigo Nonaka
dfab450f81 Merge "Use HarfBuzz metric implementation for emoji font." 2017-01-12 08:18:25 +00:00
Seigo Nonaka
a559cfd5df Merge "Fix GraphemeBreak test failures." 2017-01-12 08:17:32 +00:00
TreeHugger Robot
bdb50a7cc5 Merge "Remove FontFamily.addFont and make FontFamily immutable." 2017-01-12 07:43:53 +00:00
Seigo Nonaka
212f327e3d Merge "Reduce memory usage of FontCollection." 2017-01-12 06:02:58 +00:00
Seigo Nonaka
41e02e9613 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
8a805cd265 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
afc31403d5 Merge "Tune line breaking for justification" 2017-01-11 08:24:09 +00:00
Seigo Nonaka
58ee6af0c3 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
77baca2bda resolve merge conflicts of dff2a9d to master
Test: compile
Bug: 30465923
Change-Id: I9bcbf910e90a9160ed2fd2f75c5d72dba6ad6fcf
2017-01-10 08:22:04 -08:00
Mark Salyzyn
dff2a9d887 minikin: use log/log.h when utilizing ALOG macros am: 39ab40115f am: 585b3720fb
am: cefa7dfd3d

Change-Id: Ia4f4b30a4466a007c15f7606485611db9b168056
2017-01-10 16:09:13 +00:00
Mark Salyzyn
cefa7dfd3d minikin: use log/log.h when utilizing ALOG macros am: 39ab40115f
am: 585b3720fb

Change-Id: I228e76e2fffcab14996e38f19687e393985e2da0
2017-01-10 16:03:42 +00:00
Mark Salyzyn
585b3720fb minikin: use log/log.h when utilizing ALOG macros
am: 39ab40115f

Change-Id: Ia5fd49e48b3223a708739782d6694d63d2932e48
2017-01-10 15:58:41 +00:00
Mark Salyzyn
39ab40115f 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
c4b989fc81 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
3a74bcd0b4 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
32c12c0ac8 resolve merge conflicts of 2377a00 to master
Test: build
Bug: 26552300
Bug: 31289077
Change-Id: I6181ae7e84f9bdcbed50841c70d07f6906a10eb7
2016-12-28 13:51:49 -08:00
Mark Salyzyn
2377a00c8c minikin: Replace cutils/log.h with android/log.h or log/log.h am: 555d84c6f9 am: c95a40896d
am: debbbc817c

Change-Id: I97e1031fbf52cac46997e55444918d7c43abeb75
2016-12-28 21:32:23 +00:00
Mark Salyzyn
debbbc817c minikin: Replace cutils/log.h with android/log.h or log/log.h am: 555d84c6f9
am: c95a40896d

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

Change-Id: I9bb9b1afaa27c1d5924c6d3888861dea1ff3c18b
2016-12-28 21:17:22 +00:00
Mark Salyzyn
555d84c6f9 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
99303e284b Use LOCAL_TEST_DATA to install test data am: 068eab8ffa am: 2344eecf96 am: 3aca9aeeb8
am: 512defc2b8  -s ours

Change-Id: I802c851e0518533a0c845483dc94b603c60c328a
2016-12-15 20:39:23 +00:00
Dan Willemsen
512defc2b8 Use LOCAL_TEST_DATA to install test data am: 068eab8ffa am: 2344eecf96
am: 3aca9aeeb8

Change-Id: I3d7dd7c58c544e90176f25cac568c10facce726b
2016-12-15 20:32:52 +00:00
Dan Willemsen
3aca9aeeb8 Use LOCAL_TEST_DATA to install test data am: 068eab8ffa
am: 2344eecf96

Change-Id: Ie02fbdc89e59707c899175dadb9700a4873f8010
2016-12-15 20:25:53 +00:00
Dan Willemsen
2344eecf96 Use LOCAL_TEST_DATA to install test data
am: 068eab8ffa

Change-Id: I09c27394d95417a0bb8b0ee8a48580e6e88dc8c6
2016-12-15 20:18:22 +00:00
Dan Willemsen
068eab8ffa 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
3eaaa8b366 Merge "Use LOCAL_TEST_DATA to install test data" 2016-12-15 18:39:53 +00:00
Yirui Huang
b21586059f Merge "Change language score calculation" 2016-12-14 05:45:23 +00:00
Dan Willemsen
549e231517 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
c72d7a680c Merge "Move LOCAL_PICKUP_FILES out of $OUT/data" am: c4b8bdc4ba am: 930de2656b am: 03a647911f
am: 50fbc9db9e

Change-Id: I0d13d864021b47eed3ee730fb09783044423ecd4
2016-12-09 02:20:54 +00:00