Commit Graph

600 Commits

Author SHA1 Message Date
Raph Levien
408d44a083 Reject fonts with invalid ranges in cmap am: f5d2fa97bb am: 8d10d3a0f9 am: 97ef1a4890 am: 0d004fc9b6 am: 5936f34f86 am: f76c8acaf6
am: 95a63d665b  -s ours

* commit '95a63d665b622d4e7002b1c09603a0d50f0b8947':
  Reject fonts with invalid ranges in cmap
2016-01-15 22:11:58 +00:00
Raph Levien
95a63d665b Reject fonts with invalid ranges in cmap am: f5d2fa97bb am: 8d10d3a0f9 am: 97ef1a4890 am: 0d004fc9b6 am: 5936f34f86
am: f76c8acaf6

* commit 'f76c8acaf67dc263dddc9f9691f6e87d2450c013':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:50:24 +00:00
Raph Levien
f76c8acaf6 Reject fonts with invalid ranges in cmap am: f5d2fa97bb am: 8d10d3a0f9 am: 97ef1a4890 am: 0d004fc9b6
am: 5936f34f86

* commit '5936f34f8604542b6ab2714195c69456974e2590':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:45:37 +00:00
Raph Levien
5936f34f86 Reject fonts with invalid ranges in cmap am: f5d2fa97bb am: 8d10d3a0f9 am: 97ef1a4890
am: 0d004fc9b6

* commit '0d004fc9b6e9f438ba67a0188e1072247a7618a9':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:43:03 +00:00
Raph Levien
0d004fc9b6 Reject fonts with invalid ranges in cmap am: f5d2fa97bb am: 8d10d3a0f9
am: 97ef1a4890

* commit '97ef1a4890fddf0945f06c644a8a27bf834df3f1':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:40:23 +00:00
Raph Levien
97ef1a4890 Reject fonts with invalid ranges in cmap am: f5d2fa97bb
am: 8d10d3a0f9

* commit '8d10d3a0f9d87d90839da17e20a1812aaaa1e754':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:36:37 +00:00
Raph Levien
8d10d3a0f9 Reject fonts with invalid ranges in cmap
am: f5d2fa97bb

* commit 'f5d2fa97bbdbf5075e293fb641cd2e5dbaa29cfa':
  Reject fonts with invalid ranges in cmap
2016-01-15 21:28:10 +00:00
Seigo Nonaka
6cefe2eab1 Introduce multiple language based font fallback.
The motivation of this CL is enhance the font fallback score design
to support multiple language font fallback.

This CL contains following changes:
- Break language based font score into two: script-based score and
  primary-language-based score.
- The primary-language-based score is 0 if the script-based score is 0.
  If the script-based score is not 0 and the primary language is the
  as same as the requested one, the font gets an extra score of 1.
- The language score gets a higher multiplier for languages higher in
  the locale list.

Bug: 25122318
Bug: 26168983
Change-Id: Ib999997a88e6977e341f4c325e2a1b41a59db2d5
2016-01-15 14:35:14 +09:00
Raph Levien
416a652c93 Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE am: c4e24421ec
am: 2dd7d8f92e  -s ours

* commit '2dd7d8f92e6e40abbc2ed643adce0fba15d9d584':
  Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
2016-01-13 23:52:06 +00:00
Raph Levien
2dd7d8f92e Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
am: c4e24421ec

* commit 'c4e24421ecb8b4532bde4e759625107367cd60e3':
  Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
2016-01-13 23:17:11 +00:00
Raph Levien
c4e24421ec Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
Make it so it's not possible to position the cursor inside an emoji
formed by a sequence including zero-width joiners.

Bug: 25368653
Change-Id: I67ec0874cd1505f3c82ab91492ffc3d39a52fae6
2016-01-13 14:12:56 -08:00
Raph Levien
4760a9f190 Tailor grapheme boundaries so sequence emoji are one grapheme
Make it so it's not possible to position the cursor inside an emoji
formed by a sequence including zero-width joiners.

Bug: 25368653
Change-Id: I67ec0874cd1505f3c82ab91492ffc3d39a52fae6
2016-01-13 12:52:38 -08:00
Raph Levien
f5d2fa97bb Reject fonts with invalid ranges in cmap
A corrupt or malicious font may have a negative size in its cmap
range, which in turn could lead to memory corruption. This patch
detects the case and rejects the font, and also includes an assertion
in the sparse bit set implementation if we missed any such case.

External issue:
https://code.google.com/p/android/issues/detail?id=192618

Bug: 26413177
Change-Id: Icc0c80e4ef389abba0964495b89aa0fae3e9f4b2
2016-01-07 21:39:25 +00:00
Raph Levien
116708d9a3 Reject fonts with invalid ranges in cmap
A corrupt or malicious font may have a negative size in its cmap
range, which in turn could lead to memory corruption. This patch
detects the case and rejects the font, and also includes an assertion
in the sparse bit set implementation if we missed any such case.

External issue:
https://code.google.com/p/android/issues/detail?id=192618

Bug: 26413177
Change-Id: Icc0c80e4ef389abba0964495b89aa0fae3e9f4b2
2016-01-07 13:38:42 -08:00
Andreas Gampe
4bb53ef025 Minikin: Disable sanitizer on x86 am: 251f4772fb
am: 473628753d

* commit '473628753d2187af012f7486723ab9b8ccbbc2b3':
  Minikin: Disable sanitizer on x86
2016-01-07 04:47:52 +00:00
Andreas Gampe
473628753d Minikin: Disable sanitizer on x86
am: 251f4772fb

* commit '251f4772fb6996b5b8555fa94dd67f97a0377650':
  Minikin: Disable sanitizer on x86
2016-01-07 04:45:20 +00:00
Andreas Gampe
251f4772fb Minikin: Disable sanitizer on x86
Disable unsigned-integer-overflow sanitizer on x86, as it crashes.

Bug: 25884483
Bug: 26432628
Change-Id: Ia658ed56a6c81660a36edf71f7116118056aa917
2016-01-06 20:28:52 -08:00
Seigo Nonaka
410f1e69a7 Merge "Fix lock assertion failures in unit test." 2016-01-07 03:14:25 +00:00
Dan Austin
c3a7ec8af1 Enable integer sanitization in libminikin am: da13d5e835
am: 7521326d4f

* commit '7521326d4fcd3bfda5aaa02a2b54122cce6fcadd':
  Enable integer sanitization in libminikin
2016-01-06 20:44:58 +00:00
Dan Austin
7521326d4f Enable integer sanitization in libminikin
am: da13d5e835

* commit 'da13d5e835bf4657246e2410dcf29c0b4a61887b':
  Enable integer sanitization in libminikin
2016-01-06 20:42:47 +00:00
Dan Austin
da13d5e835 Enable integer sanitization in libminikin
Enable signed and unsigned integer sanitization in libminikin.

Bug: 25884483
Change-Id: I98905827174d16138d20bb443fe2e1d7228ea1a3
2016-01-06 12:30:12 -08:00
Dan Austin
1854e6c2df Revert "Enable integer sanitization in libminikin." am: 2ffc286102
am: 8c5fc9931f

* commit '8c5fc9931fec0ccaff1181ff82f4965236f17036':
  Revert "Enable integer sanitization in libminikin."
2016-01-06 18:38:18 +00:00
Dan Austin
8c5fc9931f Revert "Enable integer sanitization in libminikin."
am: 2ffc286102

* commit '2ffc28610290d221109105ba17969db83b317ca1':
  Revert "Enable integer sanitization in libminikin."
2016-01-06 18:36:33 +00:00
Dan Austin
2ffc286102 Revert "Enable integer sanitization in libminikin."
This reverts commit 147ce0acb9.

Change-Id: Iecd1f61a5fdf5955d871a920cb243553857d46ff
2016-01-06 18:31:38 +00:00
Dan Austin
1d362de4cc Enable integer sanitization in libminikin. am: 147ce0acb9
am: ea647a237d

* commit 'ea647a237d8ded834b585f5556b98509e2221ca1':
  Enable integer sanitization in libminikin.
2016-01-06 17:08:33 +00:00
Dan Austin
ea647a237d Enable integer sanitization in libminikin.
am: 147ce0acb9

* commit '147ce0acb9ccb2c7594e47512ac0f5d68eafb580':
  Enable integer sanitization in libminikin.
2016-01-06 17:06:22 +00:00
Seigo Nonaka
02345a5e8f Fix lock assertion failures in unit test.
The assertion for the lock state has now activated by
I9c4b1e1f09c6793e387fbdb8bb654cc0a13c65d5.
This CL fixes the assertion failure in the unit tests by acquiring
lock before calling the functions.

Change-Id: I6a6afefb4de01e8610c2abfe6c779afa9442cc67
2016-01-06 22:49:33 +09:00
Seigo Nonaka
ce3b0ada93 Merge "Fix race condition in Paint.hasGlyph()" 2016-01-06 06:00:38 +00:00
Seigo Nonaka
5f7e7e239e Fix race condition in Paint.hasGlyph()
The caller of FontFamily::hasVariationSelector needs to acquire the
lock before calling it, but FontCollection::hasVariationSelector
didn't acquire the lock. This caused a race condition.
This CL fixes this race condition.

Also, it turned out that assertMinikinLocked didn't assert even on
eng or userdebug device. This CL enables assertion on eng and userdebug
device since this assertion must be treated as bug.

BUG: 26323806

Change-Id: I9c4b1e1f09c6793e387fbdb8bb654cc0a13c65d5
2016-01-06 03:21:37 +00:00
Dan Austin
147ce0acb9 Enable integer sanitization in libminikin.
Enable signed and unsigned integer sanitization in libminikin.

Bug: 25884483
Change-Id: I53abf6affea8e2bb3a5abd381a9f19003a306b36
2016-01-05 17:36:31 -08:00
Roozbeh Pournader
ce6d478f39 Merge "Replace Qaae script with Zsye" 2016-01-05 21:54:29 +00:00
Seigo Nonaka
9d30380ce9 Replace Qaae script with Zsye
The emoji variant script "Zsye" is registered in ISO 15924.

Bug: 26226285
Change-Id: Ibc2bc740d57c48f99b6f66b1ad7595bfa8c3cff4
2016-01-05 05:05:57 +00:00
Seigo Nonaka
5bacbeb514 Save all kind of script tags into FontLanguage.
This is 2nd attempt of I8df992a6851021903478972601a9a5c9424b100c.

The main purpose of this CL is expanding FontLanguage to be able to
save full script tag. Previously, FontLangauge kept only limited script
tags. With this CL, FontLanguage keeps all script tags.

This CL contains the following changes:
- FontLanguage changes:
-- Moved to private directory not to be instantiated outside of Minikin.
-- Removed bool(), bits(), FontLanguage(uint32_t) methods which are no
   longer used.
-- Change the FontLanguage internal data structure.
-- Introduces script match logic.

- FontLanguages changes:
-- Moved to private directory not to be instantiated outside of Minikin.
-- This is now std::vector<FontLanguage>

- FontLanguageListCache changes:
-- Now FontLanguageListCache::getId through
   FontStyle::registerLanguageList is the only way to instantiate the
   FontLanguage.
-- Normalize input to be BCP47 compliant identifier by ICU.

Bug: 26168983
Change-Id: I431b3f361a7635497c05b85e8ecbeb48d9aef63e
2016-01-05 14:00:32 +09:00
Raph Levien
9b120f1134 Suppress linebreaks in emoji ZWJ sequences - DO NOT MERGE am: d40c0c59e4 -s ours am: 3871933e15 -s ours
am: d86eba7db1  -s ours

* commit 'd86eba7db180d8f77bcf3951b8a50d50d1f97aa7':
2015-12-23 18:11:56 -08:00
Bart Sears
89ddae5f59 Merge "Revert "Save all kind of script tags into FontLanguage."" 2015-12-22 09:07:09 +00:00
Bart Sears
40c8b088bd Revert "Save all kind of script tags into FontLanguage."
This reverts commit bb5c10092c.

Change-Id: I761e0e41906742fbe3d3ac34170af3101e18042a
2015-12-22 09:06:03 +00:00
Seigo Nonaka
bc11d65c44 Merge "Save all kind of script tags into FontLanguage." 2015-12-22 04:01:19 +00:00
Seigo Nonaka
bb5c10092c Save all kind of script tags into FontLanguage.
The main purpose of this CL is expanding FontLanguage to be able to
save full script tag. Previously, FontLangauge kept only limited script
tags. With this CL, FontLanguage keeps all script tags.

This CL contains the following changes:
- FontLanguage changes:
-- Moved to private directory not to be instantiated outside of Minikin.
-- Removed bool(), bits(), FontLanguage(uint32_t) methods which are no
   longer used.
-- Change the FontLanguage internal data structure.
-- Introduces script match logic.

- FontLanguages changes:
-- Moved to private directory not to be instantiated outside of Minikin.
-- This is now std::vector<FontLanguage>

- FontLanguageListCache changes:
-- Now FontLanguageListCache::getId through
   FontStyle::registerLanguageList is the only way to instantiate the
   FontLanguage.
-- Normalize input to be BCP47 compliant identifier by ICU.

Bug: 26168983
Change-Id: I8df992a6851021903478972601a9a5c9424b100c
2015-12-22 09:34:04 +09:00
Seigo Nonaka
e745083812 No op build should not build minikin_tests
Previous CL[1] adds module names into LOCAL_ADDITIONAL_DEPENDENCIES, but
it was wrong. LOCAL_ADDITIONAL_DEPENDENCIES only accepts file path.

However, BUILD_PREBUILT doesn't provide a file path of the installed
font. So use custom tool and LOCAL_GENERATED_SOURCES instead.

Confirmed no-op build doesn't built minikin_tests and
continuous_native_tests.zip contains all necessary files.

[1]: I7d83abc077bce4e38fd93c7d607bc7e1f7871e6b

BUG: 26197092
Change-Id: I90e80036248ae72e0e0f9c6144a259f5f96ec9ce
2015-12-15 16:11:21 -08:00
Dan Austin
d41c16fb7e Refactored unsigned long negations am: 10fbe684fb
am: 6dc8b89df4

* commit '6dc8b89df4ef861937d308301683ea30da0645eb':
  Refactored unsigned long negations
2015-12-14 09:30:20 -08:00
Dan Austin
6dc8b89df4 Refactored unsigned long negations
am: 10fbe684fb

* commit '10fbe684fbabfb51112bcd44e7f2a80d5c9807cb':
  Refactored unsigned long negations
2015-12-14 09:12:42 -08:00
Dan Austin
10fbe684fb Refactored unsigned long negations
Replaced two instances of negating an unsigned long, which was
resulting in aborts from unsigned integer sanitization with the
equivalent logical not-add 1.

Bug: 25884483
Change-Id: Ic7498e0af638dcd438ce69803021d3cdc3acd4f6
2015-12-11 16:33:23 -08:00
Seigo Nonaka
eb3ba19800 Remove script matching score from the font selection fallback.
Removing the extra score of 2 for the script matching from the font
fallback score calculation.  If the two langauges have different
scripts, we should treat them as different languages.

Change-Id: Ie0d6f27bd1086248895935a7bd01b5d404044ad0
2015-12-10 18:41:03 -08:00
Seigo Nonaka
01c7dcc124 Copy test font files into data directory.
To work native tests with additional font related files, copy
the files into /data/nativetest/minikin_tests/.
This copy only happens when the minikin_tests is built.
It is not an expected to copy the font files into the product image.

Change-Id: I7d83abc077bce4e38fd93c7d607bc7e1f7871e6b
2015-12-09 14:44:12 -08:00
Seigo Nonaka
091810c32b Introduce FontLanguageListCache.
FontLanguageListCache is an intentionally leaky singleton and its
internal cache won't be purged.

BUG: 25122318

Change-Id: I272097e979fe44b83fd86822235350e12eda8f51
2015-12-08 18:49:18 -08:00
Seigo Nonaka
4248406195 Merge "Select emoji font based on variation selectors." 2015-12-08 21:29:42 +00:00
Raph Levien
4d95cc5f8e Avoid integer overflows in parsing fonts am: 1fd1c39021 am: fa84e49423 am: 47e7a9b486 am: e275a0a2bd am: bc9873b55a am: 4b48ea9558
am: 10cd33807c

* commit '10cd33807c4c654c46e42802274106d14bce7795':
  Avoid integer overflows in parsing fonts
2015-12-08 19:58:04 +00:00
Raph Levien
10cd33807c Avoid integer overflows in parsing fonts am: 1fd1c39021 am: fa84e49423 am: 47e7a9b486 am: e275a0a2bd am: bc9873b55a
am: 4b48ea9558

* commit '4b48ea95580e818840c8d39439575aeed50e2239':
  Avoid integer overflows in parsing fonts
2015-12-08 19:54:42 +00:00
Raph Levien
4b48ea9558 Avoid integer overflows in parsing fonts am: 1fd1c39021 am: fa84e49423 am: 47e7a9b486 am: e275a0a2bd
am: bc9873b55a

* commit 'bc9873b55a20b2ae64260add695e4b1a81014ce6':
  Avoid integer overflows in parsing fonts
2015-12-08 11:36:58 -08:00
Raph Levien
bc9873b55a Avoid integer overflows in parsing fonts am: 1fd1c39021 am: fa84e49423 am: 47e7a9b486
am: e275a0a2bd

* commit 'e275a0a2bdd2c06b84e154a3c2c34b8a133048ff':
  Avoid integer overflows in parsing fonts
2015-12-08 19:33:14 +00:00