• Home
  • History
  • Annotate
  • only in /frameworks/minikin/libs/
History log of /frameworks/minikin/libs/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
74b56175e5d41c1c1dc992208842b5576973d452 26-May-2016 Roozbeh Pournader <roozbeh@google.com> Do not break after Myanmar viramas

This is to work around a bug in ICU's line breaker, which thinks
there is a valid line break between a Myanmar kinzi and a consonant.
See http://bugs.icu-project.org/trac/ticket/12561 for the ICU bug.

Bug: 28964845
Change-Id: I076ac15077e5627cbccf6732900bcc60d8596dda
inikin/WordBreaker.cpp
77f488345316fba46c271fc04bea470819ae1712 19-Apr-2016 Seigo Nonaka <nona@google.com> Do not break before and after ZWJ.

The emoji list is generated from external/unicode/emoji-data.txt

Bug: 28248662
Change-Id: Ie49b3782505665d62c24371ca23d317ae5e9c5f7
inikin/Android.mk
inikin/GraphemeBreak.cpp
inikin/MinikinInternal.cpp
inikin/MinikinInternal.h
inikin/WordBreaker.cpp
inikin/unicode_emoji_h_gen.py
994aa84f7b18466806fe552ea57da1852b909f24 08-Mar-2016 Seigo Nonaka <nona@google.com> Returns hasVariationSelector true for VS15/VS16

Minikin has a special font fallback for VS15/VS16, so
hasVariationSelector for emojis with VS15/VS16 should always return
true.

Bug: 27531970
Change-Id: Ieebd58f48b135b6ec50d999df68dcc09b1284606
inikin/FontCollection.cpp
inikin/FontFamily.cpp
b1203b648acb109fddd537f8d76d168b7f70103e 13-Apr-2016 Raph Levien <raph@google.com> Merge "Clear mLineWidths in LineBreaker::finish()" into nyc-dev
879e8a3a479b2cedd05e652f082683a02aa57dcf 13-Apr-2016 Raph Levien <raph@google.com> Clear mLineWidths in LineBreaker::finish()

There was the possibility of stale indents from previous invocations
persisting in the mLineWidths across multiple invocations. This patch
clears them.

Bug: 28090810
Change-Id: I3621dfbe983512046289373711709aeade52eab4
inikin/LineBreaker.cpp
6c60831cfce24b0749f50f37231e0a56d8fd4b85 11-Apr-2016 Seigo Nonaka <nona@google.com> Fix minikin_unittests

This CL fixes following test cases in minikin_tests
- FontFamilyTest.hasVariationSelectorTest
- HbFontCacheTest.getHbFontLockedTest
- HbFontCacheTest.purgeCacheTest

For the fix of FontFamilyTest.hasVariationSelectorTest, removing virtual
from GetUniqueId() in MinikinFont. After [1], MinikinFont's destructor
started calling purgeHbCache() which calls virtual method,
MinikinFont::GetUniqueId(). Fortunately, the SkTypeface::uniqueID()
returns just internal value, so we can store it at the construction time
and use it instead of calling SkTypeface::uniqueID() every time.

This patch also changes purgeHbFont to purgeHbFontLocked, as all uses of
it were already under global mutex. This change avoids deadlock on
explicit unref, as when invoked by a Java finalizer from the Java object
that holds a reference to the font.

Some of the tests needed to change to using the ref counting protocol
rather than explicitly destructing font objects, as well.

[1] 9afcc6e2bd4d89e4e1deb6e18c3c4daca4e114fd

Bug: 28105730
Bug: 28105688
Change-Id: Ie5983c4869147dacabdca81af1605066cd680b3f
inikin/HbFontCache.cpp
inikin/HbFontCache.h
inikin/MinikinFont.cpp
inikin/MinikinFontFreeType.cpp
aaa4e3470270496e6eb80704eadecb2cb7c56bf0 07-Apr-2016 Raph Levien <raph@google.com> Avoid copying of font table data

The hb_font_t object holds on to tables of font data, acquired through
the MinikinFont::GetTable interface, which is based on copying data
into caller-owned buffers. Now that we're caching lots of hb_font_t's,
the cost of these buffers is significant.

This patch moves to a different interface, inspired by HarfBuzz's
hb_reference_table API, where the font can provide a pointer to the
actual font data (which will often be mmap'ed, so it doesn't even
consume physical RAM).

Bug: 27860101
Change-Id: Id766ab16a8d342bf7322a90e076e801271d527d4
inikin/FontFamily.cpp
inikin/HbFontCache.cpp
inikin/Layout.cpp
inikin/MinikinFontFreeType.cpp
inikin/MinikinInternal.cpp
inikin/MinikinInternal.h
9afcc6e2bd4d89e4e1deb6e18c3c4daca4e114fd 07-Apr-2016 Raph Levien <raph@google.com> Purge hb font on Minikin font destruction

This patch eagerly purges the corresponding hb_font_t object from
the HbFontCache when the underlying MinikinFont is destroyed. After
that, the key will no longer be accessed, so having the entry is
wastes memory.

Bug: 27251075
Bug: 27860101
Change-Id: I1b98016133fe3baf6525ac37d970a65ddccadb4f
inikin/Android.mk
inikin/HbFontCache.cpp
inikin/HbFontCache.h
inikin/MinikinFont.cpp
f3afe92def0fff022889fd036d68451223aac146 25-Jan-2016 Seigo Nonaka <nona@google.com> Support multiple locales for font language settings.

Some fonts support multiple scripts, for example, some fonts for
Korean supports not only "Kore" but also "Jamo".

To select fonts based on their multiple languages, this CL introduces
the following changes:
- Compares all languages of the font family and use the maximum score
for font selection.
- Even if each language of the font family doesn't support the requested
language, the font get score of 2 if the requested font is covered by
all of the languages of the font family. For example, the font for
"ko-Hang,ko-Hani" gets score of 2 for the requested language "ko-Kore".

Bug: 26687969

Change-Id: I7f13b51464c9b01982bb573251d77052b9ddbd70
inikin/FontCollection.cpp
inikin/FontLanguage.cpp
inikin/FontLanguage.h
inikin/FontLanguageListCache.cpp
16ed4ef07ed8fb2333447b48055633bf8d4f38e4 31-Mar-2016 Roozbeh Pournader <roozbeh@google.com> Try putting combining marks in the same font run

Indic combining marks, when combined with a common character such as
a hyphen or a dotted circle, used to get rendered in a different font
due to the greedy algorithm used in determining runs, which resulted
in the base character and the combining mark getting rendered in
separate font runs, resulting in a dotted circle appearing in phrases
such as "100-ാം" (0031 0030 0030 002D 0D3E 0D02).

This change makes combining marks change the font run of the base
character if the base character is supported in the same font as the
combining mark, similar to the support for emoji modifiers and the
combining keycap.

Bug: 25036888
Bug: 24535344
Change-Id: I8e2798e8ecb8efaf723a0fd02c05c6fbdef8b365
inikin/FontCollection.cpp
d8917c69a9f7b7ca52f7ac850922dab4322113f5 16-Mar-2016 Roozbeh Pournader <roozbeh@google.com> Do not allow line breaks before currency symbols

Implement the change proposed in UTC document L2/16-043R
(http://www.unicode.org/L2/L2016/16043r-line-break-pr-po.txt) to make
sure we do not break between letters and currency symbols.

Bug: 24959657
Change-Id: Ia29d0e5625f84870bd910d0c6e19036d17206704
inikin/WordBreaker.cpp
cee83d40324b1f3b8e113eb8c9eda8e12ef36923 04-Mar-2016 Seigo Nonaka <nona@google.com> Suppress log span due to returning null for itemize result.

Bug: 26808815
Change-Id: I2a5a52f2c441d27c7ef270342b4ef93c3de9e56e
inikin/FontCollection.cpp
450e96c8170c3d59a5896e734c90d3f9def505f8 02-Mar-2016 Seigo Nonaka <nona@google.com> Break regional indicators at even numbered code points.

Bug: 23288449
Change-Id: If1419ff9e44e8e640616979bae88311f414b42a1
inikin/GraphemeBreak.cpp
1934c2c3cb2c93aa12f852f95915190f8ac81fac 27-Feb-2016 Raph Levien <raph@google.com> Fix wrong conditions in isEmojiBase

I computed ranges using low <= c || c <= high, should be &&.

Bug: 26829153
Change-Id: Ic1002d90b6a408a0b415f2d117d0e57adcbc2fa9
inikin/MinikinInternal.cpp
56840e8006ca2b822adb401fc8a65f3c075cde10 25-Feb-2016 Raph Levien <raph@google.com> Suppress line breaks in emoji + modifier

An emoji base with an emoji modifier renders as a single glyph and
thus should not be a line break. Current (Unicode 8) logic does
indicate a line break, so we override the results of the ICU line
break iterator. The code references a proposal to improve Unicode
behavior; when that is adopted and we upgrade ICU accordingly, the
special-case code should be deleted, but the tests can remain.

Bug: 27343378
Change-Id: I5de9c53e9a34c503816f9131e3d894e6f7a57d13
inikin/WordBreaker.cpp
0036da164e3b25f1ac29c840c1fe15b03dc6677f 25-Feb-2016 Seigo Nonaka <nona@google.com> Use color font if skin tone is specified.

If skin tone is specified, the base emoji should be emoji style even
if it is text presentation default emoji.

This patch also removes wrong test case which expects default emoji
presentation but it is controlled by family order in /etc/fonts.xml
and there is no special logic for default presentation in minikin.
Thus the default presentation unit test should not be in minikin.

Bug: 27342346

Change-Id: I74a2b2feab4d559535049e368cfd833063cce81c
inikin/FontCollection.cpp
inikin/GraphemeBreak.cpp
inikin/MinikinInternal.cpp
inikin/MinikinInternal.h
94d5525508b60407c9224fbd279a9f6932d5fb6c 24-Feb-2016 Raph Levien <raph@google.com> Merge "Suppress grapheme cluster breaks in emoji with modifiers" into nyc-dev
adfa580f1f067c846509b4346e5be2cb19177c1b 22-Feb-2016 Raph Levien <raph@google.com> Suppress grapheme cluster breaks in emoji with modifiers

An emoji with a modifier should be treated as a single grapheme, i.e.
it should not be possible to place the cursor between the base and
modifier. This patch implements the proposed Rule GB9c from Mark
Davis's proposal entitled "Fixing breaking properties for emoji",
L2/16-011R3.

The patch also skips over variation sequences attached the to the
preceding character, for computing grapheme cluster boundaries.

Bug: 26829153
Change-Id: Iff5bc2bb8e5246223a017c7cf33acfbf63817f16
inikin/GraphemeBreak.cpp
dbf5c2776bb2de1baf1cd5e53ce21f5bd3226052 23-Feb-2016 Seigo Nonaka <nona@google.com> Merge "Support Hanb script." into nyc-dev
30bf8a7c05925a970f1cab87c38bec8dd97fa82e 19-Feb-2016 Raph Levien <raph@google.com> Merge "Suppress linebreaks in emoji ZWJ sequences" into nyc-dev
d3f45892c721fb1738bf02fe19a5143a320ca4bf 19-Feb-2016 Raph Levien <raph@google.com> Suppress linebreaks in emoji ZWJ sequences

Due to the way emoji ZWJ sequences are defined, the ICU line breaking
algorithm determines that there are valid line breaks inside the
sequence. This patch suppresses these line breaks.

This is an adaptation of I225ebebc0f4186e4b8f48fee399c4a62b3f0218a
into the nyc-dev branch.

Bug: 25433289
Change-Id: I84b50b1e6ef13d436965eab389659d02a30d100f
inikin/WordBreaker.cpp
ea408fc18e8e78d984ebdf63703da668a15720de 18-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Optimize: Use measureText instead of doLayout.

With this CL, measureText is used for getRunAdvance,
getOffsetForAdvance and line breaking.

Bug: 24505153
Change-Id: Ib699f6b1391b46537736fc274cdb41686586b550
inikin/LineBreaker.cpp
inikin/Measurement.cpp
aa736d00548da691e75a09a70deb886e1f68b060 18-Feb-2016 Raph Levien <raph@google.com> Disable hyphenation when word overlaps style boundary

In cases when a word (as defined by the ICU break iterator) overlaps a
style boundary, the returned wordStart can be extend before the range
currently being measured for layout. When we try to hyphenate the
resulting substrings, we get a negative range, which crashes. This
patch disables hyphenation in this case.

Bug: 27237112
Change-Id: I76d04b39dd3b4d6d267aaaf4bebc9ab361891646
inikin/LineBreaker.cpp
533a01ea8438bb102b0dbc71f6c4ef356b260ed5 22-Jan-2016 Seigo Nonaka <nona@google.com> Support Hanb script.

Hanb is a union of Han and Bopomofo.

Bug: 26687969
Change-Id: Ic696bcbbc9607f3842fd0115668b8e7bd917e62b
inikin/FontLanguage.cpp
inikin/FontLanguage.h
bcb024df56c8ae7a5914d6f060ac99a2b5d118d9 18-Feb-2016 Seigo Nonaka <nona@google.com> Merge "Improve Paint.measureText and Paint.hasGlyph for variation sequences." into nyc-dev
2f0604dce2207ba3223cc5f5cdd0642e25c0b6e3 18-Feb-2016 Raph Levien <raph@google.com> Add error logging on invalid cmap am: 734f037130 am: c91a77cf22
am: c3433aca7a

* commit 'c3433aca7acac7f642ba0dcc07429027d0453348':
Add error logging on invalid cmap
c3433aca7acac7f642ba0dcc07429027d0453348 18-Feb-2016 Raph Levien <raph@google.com> Add error logging on invalid cmap am: 734f037130
am: c91a77cf22

* commit 'c91a77cf2236f8806b503a14adbbc19828f7bc89':
Add error logging on invalid cmap
c91a77cf2236f8806b503a14adbbc19828f7bc89 18-Feb-2016 Raph Levien <raph@google.com> Add error logging on invalid cmap
am: 734f037130

* commit '734f037130e14b3d44bc74026d3d065c025a8280':
Add error logging on invalid cmap
c88ef135fcc2661ec7addc171ebc60787df38aff 09-Sep-2015 Raph Levien <raph@google.com> Add penalty for breaks in URLs and email addresses

Recent changes have added special cases for line breaks within URLs
and email addresses. Such breaks are undesirable when they can be
avoided, but at other times are needed to avoid huge gaps, or indeed
to make the line fit at all.

This patch assigns a penalty for such breaks, equal to the hyphenation
penalty. The mechanism is currently very simple, but would be easy to
fine-tune based on more detailed information about break quality.

Bug: 20126487
Bug: 20566159
Change-Id: I0d3323897737a2850f1e734fa17b96b065eabd9c
inikin/LineBreaker.cpp
inikin/WordBreaker.cpp
6d15657e4a3826d4d47d5358f1dde211484527e9 09-Sep-2015 Raph Levien <raph@google.com> Add line breaks to email addresses and URLs

This change adds accceptable line breaks according to sections 7.42
(Dividing URLs and e-mail addresses) and 14.12 (URLs or DOIs and line
breaks) of the Chicago Manual of Style (16th ed.). In general, these
place breaks before punctuation symbols, and suppresses them after
hyphens.

Bug: 20126487
Bug: 20566159
Change-Id: I2d07d516b920a506a2f718c38fb435c5eb1ee1f8
inikin/WordBreaker.cpp
9c4cc648abcae144f3b99d612e58ef01d5e52cce 09-Sep-2015 Raph Levien <raph@google.com> Special-case URLs and email addresses for line breaking

Detect URLs and email addresses, and suppress both line breaking and
hyphenation within them.

Bug: 20126487
Bug: 20566159

Change-Id: I43629347a063dcf579e355e5b678d7195f453ad9
inikin/WordBreaker.cpp
6b1c227da6492a435f0341d7fe95d9992669920e 02-Feb-2016 Seigo Nonaka <nona@google.com> Improve Paint.measureText and Paint.hasGlyph for variation sequences.

Before this patch, the font fallback chain iterated all installed font
families if a variation selector was specified.

This CL narrows down the range of iteration.
To decide the font family for the variation sequence, we need to search
for both the variation sequence and its base code point.
The new range of the iteration is a union of them.

With this change, the running time of Paint.hasGlyph for the variation
sequence improves 50% and the running time of Paint.measureText for the
variation sequence improves 40% for the large text case on Nexus 6
userdebug.

Bug: 26784699
Bug: 11750374

Change-Id: Iced1349e3ca750821d8882c551551f65bb569794
inikin/CmapCoverage.cpp
inikin/FontCollection.cpp
inikin/FontFamily.cpp
57b6dae9894b9362ef04517ff477fd491f9d433b 05-Sep-2015 Raph Levien <raph@google.com> Refine hyphenation around punctuation

Implement a WordBreaker that defines our concept of valid word
boundaries, customizing the ICU behavior. Currently, we suppress line
breaks at soft hyphens (these are handled specially). Also, the
new WordBreaker class has methods that determine the start and end
of the word (punctuation stripped) for the purpose of hyphenation.

This patch, in its current form, doesn't handle email addresses and
URLs specially, but the WordBreaker class is the correct place to do
so. Also, special case handling of hyphens and dashes is still done
in LineBreaker, but all of that should be moved to WordBreaker.

Bug: 20126487
Bug: 20566159
Change-Id: I492cbad963f9b74a2915f010dad46bb91f97b2fe
inikin/Android.mk
inikin/LineBreaker.cpp
inikin/WordBreaker.cpp
734f037130e14b3d44bc74026d3d065c025a8280 11-Feb-2016 Raph Levien <raph@google.com> Add error logging on invalid cmap

This patch logs instances of fonts with invalid cmap tables.

Bug: 25645298
Bug: 26413177
Change-Id: I183985e9784a97a2b4307a22e036382b1fc90e5e
inikin/CmapCoverage.cpp
9d48271c0480c27402cfba359f45964637927a63 02-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Optimize: Precompute the hash value for LayoutCacheKey.

Bug: 24505153
Change-Id: If61c063c175086dec88cda187eafd9ce923e4cb1
inikin/Layout.cpp
89e80237bc27af084c9ff316d4f47abf426eced8 03-Feb-2016 Seigo Nonaka <nona@google.com> Improve Paint.hasGlyph performance by caching hb_font_t

It turned out that hb_font_t creation is not a lightweight operation.
Especially, Paint.hasGlyph creates hb_font_t for all existing fonts
every time. To improve the performance, cache hb_font_t instead
of hb_face_t.

Note that to calculate horizontal advance, MinikinPaint needs to be
associated with hb_font_t by calling hb_font_set_funcs. With this patch,
hb_font_set_funcs may be called multiple times for the same hb_font_t
object. However this is not an issue since MinikinPaint is unique
during layout.

Bug: 26784699

Change-Id: I516498ae9f0127d700fc9829327e9789845a1416
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/HbFaceCache.cpp
inikin/HbFaceCache.h
inikin/HbFontCache.cpp
inikin/HbFontCache.h
inikin/Layout.cpp
e5f01d0e954b1cace4ff000d63e383f8b1888a1f 26-Jan-2016 Stephen Hines <srhines@google.com> Disable unsigned integer overflow sanitization until libc++ is fixed. am: 4553fa41c3
am: 3d15532afc

* commit '3d15532afc73f2286b83f5c1b027b5d31feb1294':
Disable unsigned integer overflow sanitization until libc++ is fixed.
3d15532afc73f2286b83f5c1b027b5d31feb1294 26-Jan-2016 Stephen Hines <srhines@google.com> Disable unsigned integer overflow sanitization until libc++ is fixed.
am: 4553fa41c3

* commit '4553fa41c3f031e0fb3395d57018272d59869afa':
Disable unsigned integer overflow sanitization until libc++ is fixed.
4553fa41c3f031e0fb3395d57018272d59869afa 26-Jan-2016 Stephen Hines <srhines@google.com> Disable unsigned integer overflow sanitization until libc++ is fixed.

Bug: http://b/26781196
Bug: http://b/25884483
Bug: http://b/26432628

Although this issue was first only manifesting on Fugu, it now affects
N9 and N6p as well. This change disables unsigned overflow sanitization
on all platforms. The real fix for libc++ (r257368) can't be committed
until we have updated Clang at least one more time.

Change-Id: I71e9c50d25ae4566d4c06f348183c4b22a4bb60a
inikin/Android.mk
6344de60fa37c4e4246cb37d82215564826c2b8b 13-Oct-2015 Keisuke Kuroyanagi <ksk@google.com> Add light weight methods for text measurement.

The intruduced method measureText can be used instead of
doLayout for text measurement purpose.

Bug: 24505153
Change-Id: Ic29bbb347daf18d1f6c13f86970dcdd11dd6a2bd
inikin/Layout.cpp
97d7265862a9df05b3521ac4954de9cc82ec989d 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap am: ca8ac8acda am: 3034e8b4ab am: a3df6da30b am: e82552ae00 am: 545b36d667
am: 98dd15e2cd

* commit '98dd15e2cde1eb1835753c9af66d630779c18bc0':
Reject fonts with invalid ranges in cmap
98dd15e2cde1eb1835753c9af66d630779c18bc0 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap am: ca8ac8acda am: 3034e8b4ab am: a3df6da30b am: e82552ae00
am: 545b36d667

* commit '545b36d667c5b13c1b397b4c5ece20f097bf1f8b':
Reject fonts with invalid ranges in cmap
545b36d667c5b13c1b397b4c5ece20f097bf1f8b 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap am: ca8ac8acda am: 3034e8b4ab am: a3df6da30b
am: e82552ae00

* commit 'e82552ae0094efdb1b1b40ebfc832540eeb1234b':
Reject fonts with invalid ranges in cmap
e82552ae0094efdb1b1b40ebfc832540eeb1234b 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap am: ca8ac8acda am: 3034e8b4ab
am: a3df6da30b

* commit 'a3df6da30bdfda0b5b188e6511deeffddeeb9409':
Reject fonts with invalid ranges in cmap
a3df6da30bdfda0b5b188e6511deeffddeeb9409 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap am: ca8ac8acda
am: 3034e8b4ab

* commit '3034e8b4ab627278b88faae2f4813562f31a7c2b':
Reject fonts with invalid ranges in cmap
3034e8b4ab627278b88faae2f4813562f31a7c2b 15-Jan-2016 Raph Levien <raph@google.com> Reject fonts with invalid ranges in cmap
am: ca8ac8acda

* commit 'ca8ac8acdad662230ae37998c6c4091bb39402b6':
Reject fonts with invalid ranges in cmap
6f9966ea7c1910fd780cf7779cc59701c9b98a2b 12-Dec-2015 Seigo Nonaka <nona@google.com> 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
inikin/FontCollection.cpp
inikin/FontLanguage.cpp
inikin/FontLanguage.h
inikin/FontLanguageListCache.cpp
850fcc0b6fb848b383ab3123d243faf9c73efda0 14-Jan-2016 Raph Levien <raph@google.com> Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
am: 2e98eb6be1

* commit '2e98eb6be123ec64070f7524ff24df538695d7c8':
Tailor grapheme boundaries so sequence emoji are one grapheme - DO NOT MERGE
2e98eb6be123ec64070f7524ff24df538695d7c8 29-Oct-2015 Raph Levien <raph@google.com> 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
inikin/GraphemeBreak.cpp
6638e05ac2de397455c30cae05aca399a567428d 29-Oct-2015 Raph Levien <raph@google.com> 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
inikin/GraphemeBreak.cpp
ca8ac8acdad662230ae37998c6c4091bb39402b6 06-Jan-2016 Raph Levien <raph@google.com> 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
inikin/CmapCoverage.cpp
inikin/SparseBitSet.cpp
73abbd59344770601991248cc56846cd199812b8 06-Jan-2016 Raph Levien <raph@google.com> 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
inikin/CmapCoverage.cpp
inikin/SparseBitSet.cpp
a5706e4ef922af9a04c03a4768dd3f7186784882 07-Jan-2016 Andreas Gampe <agampe@google.com> Minikin: Disable sanitizer on x86 am: 72c026822d
am: 0497c013f6

* commit '0497c013f640324550ff731bc088bb62fbb6882a':
Minikin: Disable sanitizer on x86
0497c013f640324550ff731bc088bb62fbb6882a 07-Jan-2016 Andreas Gampe <agampe@google.com> Minikin: Disable sanitizer on x86
am: 72c026822d

* commit '72c026822d32550b10bb62949644c10826d7658e':
Minikin: Disable sanitizer on x86
72c026822d32550b10bb62949644c10826d7658e 07-Jan-2016 Andreas Gampe <agampe@google.com> Minikin: Disable sanitizer on x86

Disable unsigned-integer-overflow sanitizer on x86, as it crashes.

Bug: 25884483
Bug: 26432628
Change-Id: Ia658ed56a6c81660a36edf71f7116118056aa917
inikin/Android.mk
97944f285636b4d9ba277a6e1acfd60d2f22cd7c 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin am: 7087da2519
am: cf6ebc1ebc

* commit 'cf6ebc1ebcc9137c12e221799f3b20436d2984c1':
Enable integer sanitization in libminikin
cf6ebc1ebcc9137c12e221799f3b20436d2984c1 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin
am: 7087da2519

* commit '7087da2519f0aa303e5941e7d8cfbe2a73e696a2':
Enable integer sanitization in libminikin
7087da2519f0aa303e5941e7d8cfbe2a73e696a2 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin

Enable signed and unsigned integer sanitization in libminikin.

Bug: 25884483
Change-Id: I98905827174d16138d20bb443fe2e1d7228ea1a3
inikin/Android.mk
728ae8d629eaf5e7cedba98866ebcbd96bf204b9 06-Jan-2016 Dan Austin <danielaustin@google.com> Revert "Enable integer sanitization in libminikin." am: 342cd45a5e
am: 5255614d23

* commit '5255614d230d241432c7f86c4ce3582a8cb71545':
Revert "Enable integer sanitization in libminikin."
5255614d230d241432c7f86c4ce3582a8cb71545 06-Jan-2016 Dan Austin <danielaustin@google.com> Revert "Enable integer sanitization in libminikin."
am: 342cd45a5e

* commit '342cd45a5e5779e81155515d36cd500bfd975fdf':
Revert "Enable integer sanitization in libminikin."
342cd45a5e5779e81155515d36cd500bfd975fdf 06-Jan-2016 Dan Austin <danielaustin@google.com> Revert "Enable integer sanitization in libminikin."

This reverts commit 9c13a3dc96d16976c45417bdc34e0fc5670815b9.

Change-Id: Iecd1f61a5fdf5955d871a920cb243553857d46ff
inikin/Android.mk
679f147edaba19a05a341bc60a99679e6a96cc34 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin. am: 9c13a3dc96
am: ebe371670e

* commit 'ebe371670e760b5318db6a02e10775e4a4ed7b96':
Enable integer sanitization in libminikin.
ebe371670e760b5318db6a02e10775e4a4ed7b96 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin.
am: 9c13a3dc96

* commit '9c13a3dc96d16976c45417bdc34e0fc5670815b9':
Enable integer sanitization in libminikin.
7564b7fd5b78e3fb985b593545625112a0afbd56 06-Jan-2016 Seigo Nonaka <nona@google.com> Merge "Fix race condition in Paint.hasGlyph()"
a6f5c46836090d1197e453c15c7f04c3c796a7ab 05-Jan-2016 Seigo Nonaka <nona@google.com> 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
inikin/Android.mk
inikin/FontCollection.cpp
inikin/MinikinInternal.cpp
9c13a3dc96d16976c45417bdc34e0fc5670815b9 06-Jan-2016 Dan Austin <danielaustin@google.com> Enable integer sanitization in libminikin.

Enable signed and unsigned integer sanitization in libminikin.

Bug: 25884483
Change-Id: I53abf6affea8e2bb3a5abd381a9f19003a306b36
inikin/Android.mk
b5aba20c13e32c90b0396cf75afb19fb40d495f5 05-Jan-2016 Roozbeh Pournader <roozbeh@google.com> Merge "Replace Qaae script with Zsye"
d3376522332e1e016e59fabb22c24025092c724d 22-Dec-2015 Seigo Nonaka <nona@google.com> Replace Qaae script with Zsye

The emoji variant script "Zsye" is registered in ISO 15924.

Bug: 26226285
Change-Id: Ibc2bc740d57c48f99b6f66b1ad7595bfa8c3cff4
inikin/FontLanguage.cpp
198b46f1fea3f47ef8eb6317799c0d77aaec52f6 15-Dec-2015 Seigo Nonaka <nona@google.com> 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
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/FontLanguage.cpp
inikin/FontLanguage.h
inikin/FontLanguageListCache.cpp
inikin/FontLanguageListCache.h
inikin/Layout.cpp
6c4c098cbd37eccef483ab1986127250b4d2ddf2 22-Dec-2015 Bart Sears <bsears@google.com> Revert "Save all kind of script tags into FontLanguage."

This reverts commit 5e995fb850c2b32631914c3815dfb421855fba9b.

Change-Id: I761e0e41906742fbe3d3ac34170af3101e18042a
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/FontLanguage.cpp
inikin/FontLanguage.h
inikin/FontLanguageListCache.cpp
inikin/FontLanguageListCache.h
inikin/Layout.cpp
5e995fb850c2b32631914c3815dfb421855fba9b 15-Dec-2015 Seigo Nonaka <nona@google.com> 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
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/FontLanguage.cpp
inikin/FontLanguage.h
inikin/FontLanguageListCache.cpp
inikin/FontLanguageListCache.h
inikin/Layout.cpp
1f0d7947373882f812a119aedeb1948e12a440a0 14-Dec-2015 Dan Austin <danielaustin@google.com> Refactored unsigned long negations am: 1bbe03d215
am: b9f27a2509

* commit 'b9f27a2509241a0f2dfcf6921958dab4b14fbc42':
Refactored unsigned long negations
b9f27a2509241a0f2dfcf6921958dab4b14fbc42 14-Dec-2015 Dan Austin <danielaustin@google.com> Refactored unsigned long negations
am: 1bbe03d215

* commit '1bbe03d215c9452bc9917111e63f19160cc5f56a':
Refactored unsigned long negations
1bbe03d215c9452bc9917111e63f19160cc5f56a 12-Dec-2015 Dan Austin <danielaustin@google.com> 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
inikin/SparseBitSet.cpp
43bb9743ca91a761b9723674ac862660dd2be834 10-Dec-2015 Seigo Nonaka <nona@google.com> 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
inikin/FontCollection.cpp
inikin/FontFamily.cpp
6d9dcd2cf3d3ed26a886e02d94c907311e7b1f83 02-Dec-2015 Seigo Nonaka <nona@google.com> Introduce FontLanguageListCache.

FontLanguageListCache is an intentionally leaky singleton and its
internal cache won't be purged.

BUG: 25122318

Change-Id: I272097e979fe44b83fd86822235350e12eda8f51
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/FontLanguageListCache.cpp
inikin/FontLanguageListCache.h
inikin/Layout.cpp
a47969c90ac9ef5d2c7c439030d3cfcabbecc539 08-Dec-2015 Seigo Nonaka <nona@google.com> Merge "Select emoji font based on variation selectors."
8921cfe226e9b7774810c9711579586b5b227b82 08-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts am: 6299a6ba13 am: 998293f985 am: ffadd191a0 am: d56908571d
am: 7aec64b909

* commit '7aec64b9099d0b5bbbe766a2c29b9f09f0939a4c':
Avoid integer overflows in parsing fonts
7aec64b9099d0b5bbbe766a2c29b9f09f0939a4c 08-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts am: 6299a6ba13 am: 998293f985 am: ffadd191a0
am: d56908571d

* commit 'd56908571d3dc28686a198484d1cc8a399276d86':
Avoid integer overflows in parsing fonts
d56908571d3dc28686a198484d1cc8a399276d86 08-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts am: 6299a6ba13 am: 998293f985
am: ffadd191a0

* commit 'ffadd191a041f16c52b693d8dc0c42b3b9f01b2b':
Avoid integer overflows in parsing fonts
ffadd191a041f16c52b693d8dc0c42b3b9f01b2b 08-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts am: 6299a6ba13
am: 998293f985

* commit '998293f985dc6c23f90b160f3bc647807c76d3fe':
Avoid integer overflows in parsing fonts
998293f985dc6c23f90b160f3bc647807c76d3fe 08-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts
am: 6299a6ba13

* commit '6299a6ba13906c695f7a4f6748f7bc5856a110e5':
Avoid integer overflows in parsing fonts
369d2d44cb09ac4346cdd9e3b131bb173d764f88 29-Oct-2015 Seigo Nonaka <nona@google.com> Select emoji font based on variation selectors.

If U+FE0E is appended to the emoji code point, the glyph should have a
text presentation.
On the other hand, if U+FE0F is appended to the emoji code point, the
glyph should have an emoji presentation.

Bug: 11256006
Change-Id: I5187d44500b13a138e7ffbcf2c72e2da06374c8c
inikin/FontCollection.cpp
inikin/FontFamily.cpp
6299a6ba13906c695f7a4f6748f7bc5856a110e5 01-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts

A malformed TTF can cause size calculations to overflow. This patch
checks the maximum reasonable value so that the total size fits in 32
bits. It also adds some explicit casting to avoid possible technical
undefined behavior when parsing sized unsigned values.

Bug: 25645298
Change-Id: Id4716132041a6f4f1fbb73ec4e445391cf7d9616
(cherry picked from commit 183c9ec2800baa2ce099ee260c6cbc6121cf1274)
inikin/CmapCoverage.cpp
183c9ec2800baa2ce099ee260c6cbc6121cf1274 01-Dec-2015 Raph Levien <raph@google.com> Avoid integer overflows in parsing fonts

A malformed TTF can cause size calculations to overflow. This patch
checks the maximum reasonable value so that the total size fits in 32
bits. It also adds some explicit casting to avoid possible technical
undefined behavior when parsing sized unsigned values.

Bug: 25645298
Change-Id: Id4716132041a6f4f1fbb73ec4e445391cf7d9616
inikin/CmapCoverage.cpp
66a34a04ab34519723f682ef2e71d22405d267c2 20-Nov-2015 Seigo Nonaka <nona@google.com> Merge "Search all families instead of using mRanges for variation sequence."
fc119c68f5def1e44e65ae4cdd147c01d62c9ad2 18-Nov-2015 Seigo Nonaka <nona@google.com> Search all families instead of using mRanges for variation sequence.

To optimize the font family search, mRanges is used for narrowing down
the search range. However, mRanges is constructed from format 4 or
format 12 entries. So, if the font supports a variation sequence but doesn't
support the base character of the sequence, the font may not be listed in
mRanges.

The proper way to fix this issue is using format 14 subtable information
for mRanges construction. However, this is not a trivial work since currently
we rely on HarfBuzz for variation sequence lookup and it doesn't provide any
API for retrieving coverage information.

Thus, as the quick fix, iterate all font families in font fallback chain if
the variation sequence is specified.

Change-Id: I278da84be8fb8f553590e2e42ed450b7e4a34eca
inikin/FontCollection.cpp
80d113bcd4bbc395218503354af1a5a6dba59b4b 21-Oct-2015 Seigo Nonaka <nona@google.com> Introduce FontCollection::hasVariationSelector method.

To implement Paint.hasGlyph(), we need a new method to ask the
FontCollection if it has a glyph for the code point and variation
selector pair.

Bug: 11256006
Change-Id: Ie4185c91bcaa4d01aee6beb97784b1f9d2a88f12
inikin/FontCollection.cpp
3dd8757fcf48976295bac566277b6da1046e8362 30-Oct-2015 Seigo Nonaka <nona@google.com> Fix invalid decrement range of KEYCAP handling in itemize.

This issue was introduced by I22ce0e9eadc941f84e3a9b23462f194e51dd7180.
Need to decrement the two utf16 chars in KEYCAP handling.

To add unit tests, this CL also addresses the Bug: 24184208 by
introducing self built fonts since there is no good example in system
installed fonts.

Bug: 24184208
Change-Id: I23fa008adbaced78a3cb96442a6bc8892ab84ce8
inikin/FontCollection.cpp
c65e6f1ee0b2f32183766726ac459188b1a37b35 03-Nov-2015 Raph Levien <raph@google.com> Suppress linebreaks in emoji ZWJ sequences - DO NOT MERGE

Due to the way emoji ZWJ sequences are defined, the ICU line breaking
algorithm determines that there are valid line breaks inside the
sequence. This patch suppresses these line breaks.

Bug: 25433289
Change-Id: I225ebebc0f4186e4b8f48fee399c4a62b3f0218a
inikin/LineBreaker.cpp
adaf42f0d3444de2b0bb977ccc94801458497f46 29-Oct-2015 Raph Levien <raph@google.com> Accept variation selector in emoji sequences - DO NOT MERGE

This patch basically ignores variation selectors for the purpose of
itemization into font runs. This allows GSUB to be applied when input
sequences contain variation selectors.

Bug: 25368653
Change-Id: I9c1d325ae0cd322c21b7e850d0ec4d73551b2372
inikin/FontCollection.cpp
bae347682989d2627081310129a5b60541ed6ad0 27-Oct-2015 Seigo Nonaka <nona@google.com> Add -Werror -Wall -Wextra to compiler option.

This is 2nd trial of I30a0914a4633bd93eb60957cdf378770f04d8428

- To suppress noisy unused parameter warnings, comment out unused
arguments.
- Add -Werror for suppressing further warning.
- Add -Wall -Wextra for safety.
- Use "z" prefix for format string of size_t.

Verified that compile succeeded on all arm,arm64,mips,x86,x86_64.

Change-Id: I7ad208464486b8a35da53929cb1cfe541ed0052f
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/HbFaceCache.cpp
inikin/Layout.cpp
inikin/LineBreaker.cpp
inikin/MinikinFontFreeType.cpp
b4c799180458fc37b96ee43ef9111f64e0cc99f7 28-Oct-2015 Bart Sears <bsears@google.com> Revert "Add -Werror -Wall -Wextra to compiler option."

This reverts commit 63635cff5861dcaed963c7332eecf51b9d7d920a.

Change-Id: I2b4b10e8afedc85dbe2d07f3e47315652b65cd14
inikin/Android.mk
inikin/HbFaceCache.cpp
inikin/Layout.cpp
inikin/MinikinFontFreeType.cpp
63635cff5861dcaed963c7332eecf51b9d7d920a 27-Oct-2015 Seigo Nonaka <nona@google.com> Add -Werror -Wall -Wextra to compiler option.

- To suppress noisy unused parameter warnings, comment out unused
arguments.
- Add -Werror for suppressing further warning.
- Add -Wall -Wextra for safety.

Change-Id: I30a0914a4633bd93eb60957cdf378770f04d8428
inikin/Android.mk
inikin/HbFaceCache.cpp
inikin/Layout.cpp
inikin/MinikinFontFreeType.cpp
4b723bf22b1bbc5fcdaa9bd96178c921199905d5 20-Oct-2015 Roozbeh Pournader <roozbeh@google.com> Basic scaffolding for handling a language list.

The behavior hasn't changed much yet: all languages are ignored for
rendering text, except the very first supported language.

Change-Id: I1695fb985927ae5e28e4f59c1b531e4993af8688
inikin/FontFamily.cpp
16da66db748ce4877bc1d3e7af783eed8a08c77a 20-Oct-2015 Seigo Nonaka <nona@google.com> Merge "Support Variation Selector in font selection."
bbdd73ec077a1bb6801b25a639834be16dfd78cb 01-Oct-2015 Seigo Nonaka <nona@google.com> Support Variation Selector in font selection.

This CL contains the following changes:
- Add a variation selector argument into getFamilyForChar to be able to
select fonts which support variation selector.
- In case no fonts support the codepoint and variation selector pair,
add a fallback rule which selects font family with ignoring variation
selector.
- Change FontCollection::itemize to not change the font family
immediately preceding a variation selector.
- Introduce unit tests for variation selectors.

With this CL, TextView can render the variation selectors correctly.

Bug: 11256006
Change-Id: I22ce0e9eadc941f84e3a9b23462f194e51dd7180
inikin/FontCollection.cpp
210dfa01db0defb3c23b60c446e97b1ee6f1287e 13-Oct-2015 Seigo Nonaka <nona@google.com> Remove MinikinFont::GetGlyph interface.

MinikinFont:GetGlyph is no longer used.
No behavior chnages are expected with this CL.

Change-Id: I13398503841ac06f930b04815017d4b33338efa1
inikin/MinikinFontFreeType.cpp
e8264e065f0edd58a9fa04bbdd777f2af2794789 15-Oct-2015 Roozbeh Pournader <roozbeh@google.com> Complete half-done cherry-picking of Android.mk. DO NOT MERGE

The previous commit, 6e2cccdc518f8d3424c84ae6fbe0e87ae3c3f66a, was
incompletely cherry-picked. This adds the missing parts.

Bug: 24570591
Change-Id: I1097c60587fb8a88cfe6b8ffed5b1689d9bdd429
inikin/Android.mk
6e2cccdc518f8d3424c84ae6fbe0e87ae3c3f66a 27-Aug-2015 Raph Levien <raph@google.com> Binary format for hyphenation patterns

In the current state, hyphenation in all languages than Sanskrit seems
to work (case-folding edge cases). Thus, we just disable Sanskrit.
Packed tries are implemented, but not the finite state machine
(space/speed tradeoff).

This commit contains a throw-away test app, which runs on the host.
I think I want to replace it with unit tests, but I'm including it in
the CL because it's useful during development.

Bug: 21562869
Bug: 21826930
Bug: 23317038
Bug: 23317904
Bug: 24570591
Change-Id: I7479a565a4a062fa319651c2c14c0fa18c5ceaea
(cherry picked from commit f0be43de02a1e07308d3d95408349c3c7f973430)
inikin/Android.mk
inikin/Hyphenator.cpp
0f2a025d135f9ca52cc3cf917fffc29d6c126094 24-Sep-2015 Seigo Nonaka <nona@google.com> Introduce FontFamily::hasVariationSelector

This CL introduces new method hasVariationSelector into FontFamily but it
is not used in production code. So no behavior changes are expected.

This CL contains the following changes:
- Introduce hasVariationSelector which returns true if the corresponding
font has a glyph for a code point and variation selector pair.
- Introduce purgeHbFontCache since hb_face_t won't be released by
keeping hb_font_t.
- Introduce unit tests with self-built font.

Change-Id: I659a6d03d9ec446b409e1fba2758452abb9f44fa
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
7c8ac67a9022590d32d25e61094f29f7af42357d 01-Oct-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Refactoring: Introduce helper class to iterate runs."
6ac8ca4ce7e3da669209aac1572085b49425e3cf 01-Oct-2015 Raph Levien <raph@google.com> Merge "Binary format for hyphenation patterns"
f0be43de02a1e07308d3d95408349c3c7f973430 27-Aug-2015 Raph Levien <raph@google.com> Binary format for hyphenation patterns

In the current state, hyphenation in all languages than Sanskrit seems
to work (case-folding edge cases). Thus, we just disable Sanskrit.
Packed tries are implemented, but not the finite state machine
(space/speed tradeoff).

This commit contains a throw-away test app, which runs on the host.
I think I want to replace it with unit tests, but I'm including it in
the CL because it's useful during development.

Bug: 21562869
Bug: 21826930
Bug: 23317038
Bug: 23317904

Change-Id: I7479a565a4a062fa319651c2c14c0fa18c5ceaea
inikin/Android.mk
inikin/Hyphenator.cpp
fb0d396929e534a3686469b474d4f670864aa5ac 17-Sep-2015 Seigo Nonaka <nona@google.com> Extract hb_face_t object cache mechanism from Layout.cpp.

This CL does following things:
- Extract hb_face_t object cache mechanism from Layout.cpp to be able to
use it from other cpp file, especially from FontFamily.cpp.
To address Bug 11256006 and Bug 17759267, need to touch
hb_face_t from FontFamily.
- Make hb_face_t cache mechanism thread-safe.
- Add unit tests for HbFaceCache test cases.

Bug: 11256006
Bug: 17759267
Change-Id: Ic183634ef34326793bd9a32167236611d0af34d6
inikin/Android.mk
inikin/HbFaceCache.cpp
inikin/HbFaceCache.h
inikin/Layout.cpp
inikin/MinikinInternal.cpp
inikin/MinikinInternal.h
6292e1a966da86af7045c356fcad6ab8864089b8 24-Sep-2015 Keisuke Kuroyanagi <ksk@google.com> Refactoring: Introduce helper class to iterate runs.

This doesn't change current behavior. It's a preparation
for the following CLs.

Bug: 22408712
Change-Id: Ic018422254aa3904655f499194caad74f0c0fc5d
inikin/Layout.cpp
2a79f59e73294e43f32cc0138e23fcde34eec28a 01-Sep-2015 Seigo Nonaka <nona@google.com> Resolve glyph ID by HarfBuzz function.

Currently codepoint to glyph ID resolution is done through MinikinFont
interface. To support variation selector, use HarfBuzz API instead of
calling this interface since one of its implementation Skia doesn't
support variation selector.

On the other hand, we don't want to get glyph horizontal advance values
by HarfBuzz since HarfBuzz doesn't return correct values when the hinting
is active.

Thus, use ot_font as a parent font and override
glyph_h_advance/glyph_h_origin functions as is.

With this change, MinikinFont::GetGlyph is no longer necessary but not
removing in this CL for easy reverting since removing interface requires
multi-repository commit.

This is a base work of b/11256006 and this patch doesn't provide any
user visible changes.

Bug: 11256006
Change-Id: I061172c0b674bb649ce8bc013ffecf38708bdc41
inikin/Layout.cpp
4e3adc6fb2073d5b466b88b8f5329d281038aba1 25-Aug-2015 Seigo Nonaka <nona@google.com> Update word breaker to be aware tone mark and variation selector.

This CL does:
1. Move the getNextWordBreak/getPrevWordBreak function to a separate source file.
2. Adding "ForCache" suffix for function name for making clear these function is
for layout cache.
3. Introduce unit tests for them.

Bug: 11256006
Change-Id: I4138751a4570915f1a0d6c8921f89700f8ec7f35
inikin/Android.mk
inikin/Layout.cpp
inikin/LayoutUtils.cpp
inikin/LayoutUtils.h
d8dd94b81ea7efd776859fbbdf4a76458e270eab 12-Aug-2015 Raph Levien <raph@google.com> Add basic unit tests for Minikin

Initial unit tests for Minikin functionality. Also fixes an incorrect
Hangul case (uncovered in testing), and improves handling of broken
UTF-16.

Change-Id: I69b441d8e3b19ed06abcc56f13271abadf3d1010
inikin/Android.mk
inikin/GraphemeBreak.cpp
2967a13420ffd1d426e6edd1648414910593d179 12-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Clean up use of printf() in Layout.cpp.

Reported externally at https://code.google.com/p/android/issues/detail?id=167715.
Bug: 21498085

Change-Id: I73f22de03b0151ce31a6b3070d051a2a701b33d2
inikin/Layout.cpp
71ec97055357b6ccb13a2697a56254bb19f43ae9 08-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Support three-letter language codes in FontLanguage.

Also handle the case of weird language code that we don't understand
properly better, by treating them not equal to each other.

Change-Id: Iaccb251fa38d700932f6eadac254d3d1fa09b3ea
inikin/FontFamily.cpp
c02138bf556739fa9c9212da13aee89aa520c8ef 06-Aug-2015 Roozbeh Pournader <roozbeh@google.com> Gold plate grapheme cluster breaks.

This tailors Unicode's Grapheme_Cluster_Break property to better
classify characters currently with the Control property value.

Also adds support for rule GB9b of UAX #29, needed since there are
now characters we are tailoring to be Prepend. The rule was
previously ommited in our implementation because there was no
characters in the Prepend class.

Bug: 15653110
Change-Id: If10da88df0980f7d676c8c0b950eda5fb8dbe741
inikin/GraphemeBreak.cpp
90a09c3f36d98530822392446884b8af68035908 29-Jul-2015 Raph Levien <raph@google.com> Improve fallback where explicit variant is not given

In computing scores for which fallback font to choose, a match of a
variant given explicitly in the xml config file scores higher than a
family with no explicit variant. One consequence is that U+2010
HYPHEN is chosen from the Naskh Arabic font in the fallback case.

This patch scores families with no variants as a match (effectively
the same as if the xml file specified both variants). Thus, it will
choose the first matching font (Roboto), which is a better choice.

This patch also revises the list of "sticky" characters to include
various hyphens, so Arabic (and potentially other scripts) text that
includes hyphens can access the script-specific variants matched to
the underlying text.

Bug: 22824219
Change-Id: I6ec1043037f89cad50ca99ac24c473395546bcdf
inikin/FontCollection.cpp
5ba60b1c255efee72316f002bc850908b7f0fe4e 21-Jul-2015 Raph Levien <raph@google.com> Merge "Revert "Allow clusters to start with zero-width characters"" into mnc-dev
542572394dfb35b6b78b73837ec13c8e3170385a 21-Jul-2015 Raph Levien <raph@google.com> Revert "Allow clusters to start with zero-width characters"

This reverts commit 3e0fc64da064b8c4156daf53242b8eeb47830f64.

Bug: 22589743
Bug: 22121742
Change-Id: I7b482ffb8a0ee174ddc804aa890de45bdbd758e3
inikin/Measurement.cpp
e9ec9a1d1b9e177659b7cc2cd3a102760fcfec14 21-Jul-2015 Raph Levien <raph@google.com> Consistently apply break opportunities in text spans

It's essential not to apply a break opportunity within a replacement
span, otherwise things can happen such as displaying the span twice.
The old code tested this case based on zero-width characters.
However, this test was both imprecise, and also in some cases read
uninitialized values from the mCharWidths array, which in turn led
to inconsistent line breaking of the same text.

This patch applies all line break opportunities (as identified by
ICU) within text (as opposed to replacement spans), and also applies
break opportunities at the beginning and end of replacement spans,
but avoids breaks within a replacement span.

Bug: 20138621
Change-Id: I36baeb44d6808356649e1bb69ca57f093fc8c723
inikin/LineBreaker.cpp
cdd19dadd11a611409c24bb69e6629eab6812d98 15-Jul-2015 Roozbeh Pournader <roozbeh@google.com> Use ICU to lowercase words to hyphenate.

Previously, the standard C tolower() function was used, which
didn't support any characters beyond the basic ASCII letters.

Bug: 22506121
Change-Id: Ibb81121caa29be44fbb59aa98891e9faafc57592
inikin/Hyphenator.cpp
daf62d0eef9e339c9d3269e5eaa2007d25c18194 15-Jul-2015 Roozbeh Pournader <roozbeh@google.com> Add missing hyphen-like characters.

This adds various hyphen-like characters missed in the previous
patch, that should disallow automatic hyphenation of words containing
them.

Bug: 22484266
Change-Id: Ie972cb50384dbe0aa1ab5ec50286b75f9877953a
inikin/LineBreaker.cpp
baf6d0a41fdabb0f859bd065f3724921a3e91089 14-Jul-2015 Roozbeh Pournader <roozbeh@google.com> Avoid re-hyphenating already-hyphenated phrases.

Previously, automatic hyphenation blindly took almost every line
breaking opportunity as a word break, so words like "low-budget" were
treated as two separate words, "low-", and "budget", each
automatically hyphenated.

This patch makes sure the subwords in already-hyphenated phrases are
not passed to the automatic hyphenator, while keeping the possibility
of a potential line break where a hyphen already exists.

Bug: 22484266
Bug: 22287425
Change-Id: Ie46dbdd70e993d64a9b9cf44b4ae93b21459dbc2
inikin/LineBreaker.cpp
6c4d167bff33c24c239d77ddb1044b18d180766a 10-Jul-2015 Raph Levien <raph@google.com> Add HyphenEdit to layout cache

We bypass the word layout cache for "complex" cases, which includes
things like OpenType features. We were counting a hyphen edit as such
a case, but the problem is that we measure a _lot_ of these when
doing layout with hyphenation.

This patch adds plumbing for hyphen edits to the layout cache, so
that word fragments with hyphens can be cached as well.

Bug: 22378829

Change-Id: Idba4df4faa14f48a5faccc8a7a7955a36c19ef27
inikin/Layout.cpp
3e0fc64da064b8c4156daf53242b8eeb47830f64 30-Jun-2015 Raph Levien <raph@google.com> Allow clusters to start with zero-width characters

The logic in getRunAdvance() assumed that any zero-width character was
part of the preceding cluster, which is valid most of the time. However,
characters such as ZWNBSP (U+FEFF) renders as a zero width glyph
and is also a grapheme cluster boundary. This patch adds a clause to
handle that case.

Bug: 22121742
Change-Id: Iad79a7d988bded1ef05f0fd7905d20669ea22051
inikin/Measurement.cpp
91425f0564581e258d3f9b2f44d13f3b6d7a60ea 29-Jun-2015 Raph Levien <raph@google.com> Fix logspam and incorrect cluster offset

An incorrect cluster offset calculation was causing a lot of log
messages to appear. Separately, a confusion between #if and #ifdef was
causing unintended logging of line breaks. This patch fixes both.

Bug: 22178333
Change-Id: I2b3673ed66c784f5082fd127a8dc10bd3df6ed79
inikin/Layout.cpp
inikin/LineBreaker.cpp
e8721b2d293ba1a0e5d92a066aa9aa15807357cc 26-Jun-2015 Raph Levien <raph@google.com> Disable letterspacing for connected scripts

The appearance of letterspacing with scripts with cursive connections
is poor, so we simply disable letterspacing for those scripts. There
may be some cases where some form of letterspacing is desirable, but
this gives the highest likelihood that the final result will be good
without requiring additional work from clients.

Bug: 21935803
Change-Id: Ie25266249ac3a2605aa89ef5132e8edbe3a06d35
inikin/Layout.cpp
a6f8bf6f530f80b00a7cc64605667dd1d75a971c 24-Jun-2015 Raph Levien <raph@google.com> Separate additional penalty for last line with hyphen

A recent change added a penalty for a hyphen at the last line break,
which is visually undesirable. However, the penalty was assessed to
"widthScore", which broke the assumption (used for another
optimization) that widthScore increases monotonically. This patch
separates the penalty into a different parameter, restoring the
validity of the monotonicity assumption.

Bug: 22066119
Change-Id: I6a47a350ef3ceee2f00ee430d6954d0c307227f0
inikin/LineBreaker.cpp
0d2dbb55c90cc540aad264577c756103660ddff5 13-Jun-2015 Roozbeh Pournader <roozbeh@google.com> Merge "Use ASCII HYPHEN-MINUS when there's no HYPHEN in the font." into mnc-dev
f997dd21968bac16966269aede235247fb08a00b 12-Jun-2015 Roozbeh Pournader <roozbeh@google.com> Use ASCII HYPHEN-MINUS when there's no HYPHEN in the font.

Previously, we just assumed the font in use had a U+2010 HYPHEN
character, resulting in a tofu (or an empty space) being shown when
U+2010 was not supported in the font used to render the hyphenated
word.

Now we try to fallback to U+002D HYPHEN-MINUS, which has a very good
chance of being available in at least any Latin font.

We still show a tofu when neither character is supported, to
intentionally alert that something is missing.

Bug: 20497913
Bug: 21088552
Bug: 21570828
Change-Id: Iff69bbc38836c03495e9124502b5207c39270da2
inikin/Layout.cpp
17e78fa864df7b1f3ee737db6ad6c193dffc2396 12-Jun-2015 Raph Levien <raph@google.com> Merge "Increase hyphenation penalty for short last line" into mnc-dev
4ea1cc82b0e8170d6ab6a7e9ee274c81315cd59e 10-Jun-2015 Keisuke Kuroyanagi <ksk@google.com> Fix: getOffsetForAdvance can return worng offset.

searchStart was passed to getRunAdvance, but it can be
different from the start that has been used to initialize
Layout object. As a result, wrong index could be used in
getRunAdvance.

Bug: 21744454
Change-Id: Ibe83cc50ed6f0da2a1532318bc224502be350699
inikin/Measurement.cpp
abae97a39c26e191e350575932611a90e6b04d06 08-Jun-2015 Raph Levien <raph@google.com> Increase hyphenation penalty for short last line

Tuning for hyphenation parameters. We discourage hyphenation on the
last line, but offset this penalty by also applying a penalty for
each line, which optimizes for minimizing the number of lines. Thus,
when hyphenation can reduce the number of lines, it increases the
chance they're used.

There's probably more tuning and refinement that can be done, but
testing suggests that the tunable parameters are appropriate.

Bug: 20883322

Change-Id: Ida7eaf8aced109e426694f5a386924a842d29c4b
inikin/LineBreaker.cpp
73fa6dfd6366c6ac04d6a25cdcc0721f5b3e7fbb 01-Jun-2015 Raph Levien <raph@google.com> Merge "Use context start correctly in getRunAdvance" into mnc-dev
95af01c57b60130ba4c098340ba6ea4b4ebfee3f 01-Jun-2015 Raph Levien <raph@google.com> Use context start correctly in getRunAdvance

We were not taking context start into account when deciding whether
to split a ligature, which was causing inconsistent behavior. This
patch consistently references the widths array relative to the start
of the context.

Bug: 21549197
Change-Id: I7c71e10c1af84354fefe782fc0b87120016e6555
inikin/Measurement.cpp
a019665898d830283a99f505f72d3899ba137b62 01-Jun-2015 Raph Levien <raph@google.com> Disable hyphenation for unreasonably long words

Very long words cause O(n^2) behavior. These are unlikely to happen in
real text, but do happen with synthetic strings, so in those cases we
just disable hyphenation.

Bug: 20790394
Change-Id: Idf957dd40b24efe1476f619f17093a48b5bc56f7
inikin/LineBreaker.cpp
0dc07c0be325b7c12c50729e04c4b2785a673fd7 12-May-2015 Roozbeh Pournader <roozbeh@google.com> Support hyphenation frequency in Minikin.

Three hyphenation frequencies are now supported:

kHyphenationFrequency_None, which turns off both automatic
hyphenation and soft hyphens.

kHyphenationFrequency_Normal, which has aconservative amount of
hyphenation useful as a conservative default.

kHyphenationFrequency_Full, which has a typographic-quality amount of
hyphenation useful for running text and tight screens.

Bug: 21038249
Change-Id: I2800f718c887c9389a1a059d7ec07d7fa2ca1dee
inikin/LineBreaker.cpp
8920e81717c6e51b92ff8f4479a1f959af260556 17-Apr-2015 John Reck <jreck@google.com> Move Bitmap to a different namespace

namespace naming collision. Move minikin's
Bitmap out of android:: and into minikin::

Change-Id: I5ae3925f81b848dc79576429ab55243b96f7fed2
inikin/Layout.cpp
68ae337aa05f598af18b09fe4125146d4d67db83 23-Apr-2015 Raph Levien <raph@google.com> Don't include trailing newline in width for line breaking

In a paragraph with a trailing newline, the width of the newline
character was included in the line width for breaking purposes,
basically as if it were a non-breaking space. This caused a
discrepancy, where Layout.getDesiredWidth() suggested that the text
would fit in a single line, but StaticLayout would break it because of
the added width of the newline character.

The proposed fix is simply to consider newline to be a space that
disappears at the end of a line.

Bug: 20152308
Change-Id: I539574c5b8ea892c8ed6aca6c59e90ccdf74a680
inikin/LineBreaker.cpp
40beb7744a61248de82a6077996c83c14e0122c2 07-Apr-2015 Raph Levien <raph@google.com> Add functions for measuring cursor positioning

New functions for computing the correspondence between cursor
position and advance, respecting grapheme boundaries.

Change-Id: I620378d5f64cd74300cd43db522adeb555825dff
inikin/Android.mk
inikin/GraphemeBreak.cpp
inikin/Measurement.cpp
bb86b433f97a301c11800806b1ce5331fa227d4a 16-Apr-2015 Raph Levien <raph@google.com> Rename "margins" to "indents"

The name "margin" conflicts with another meaning, so we're making the
name in the public api "idents" and the code consistent in naming.

Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
inikin/LineBreaker.cpp
dc7bc6e39e1ef6b713b927baf24db8b4f02f1a3f 15-Apr-2015 Raph Levien <raph@google.com> Add margins array to line widths object

In order to support layout in non-rectangular regions, the LineWidths
object needs to accept an arbitrary array of margins. This is
implemented in addition to the existing firstWidthLineCount/restWidth
mechanism for convenience, though using only arrays would have the
same expressive power.

Bug: 20182243
Change-Id: Iea96bca1a92012314ac27e617c67f306c1f1b2f2
inikin/LineBreaker.cpp
5cdad92c300a65cab89b172e952186f0c5870657 30-Mar-2015 Raph Levien <raph@google.com> Revert "Fix build: Revert "Add hyphenation to line breaking""

This reverts commit 0b25d5ac85533f64764a0d53d5e5d33b46b715fa.
inikin/Android.mk
inikin/Hyphenator.cpp
inikin/LineBreaker.cpp
0b25d5ac85533f64764a0d53d5e5d33b46b715fa 30-Mar-2015 Ed Heyl <edheyl@google.com> Fix build: Revert "Add hyphenation to line breaking"

This reverts commit daf6a6bdbf2ff1f66496d6200cb253e2f50759d5.

Change-Id: I3fed65046274d3aeb748f0730585ab89927f5741
inikin/Android.mk
inikin/Hyphenator.cpp
inikin/LineBreaker.cpp
daf6a6bdbf2ff1f66496d6200cb253e2f50759d5 19-Mar-2015 Raph Levien <raph@google.com> Add hyphenation to line breaking

This patch adds hyphenation using the Liang hyphenation algorithm,
similar to TeX. It also improves the optimized line breaker so that
it works correctly and efficiently even when the line width is not
constant (there is a specialization for constant width, which is
probably worthwhile, but performance TODOs remain).

Still to be done:

* hyphenator has many shortcuts, only tested with English

* interaction between punctuation and hyphenation is problematic

Change-Id: I2d94a1668ebc536398b7c43fcf486333eeb7c6aa
inikin/Android.mk
inikin/Hyphenator.cpp
inikin/LineBreaker.cpp
01f526614431e3a0a6e1a48039e00b8a9b7d6fbf 14-Mar-2015 Raph Levien <raph@google.com> Add LineBreaker to Minikin

This patch adds a LineBreaker class to Minikin, which will be used for
computing line breaks in StaticLayout. The version in this patch
contains basically the same functionality that existed before, but
hopefully better performance and an interface that's suitable for more
sophisticated paragraph layout.

Note that this version contains a high quality strategy, which mostly
works but doesn't respect varying line width.

Change-Id: I02485d58b1e52856296a72cdd4efd963bc572933
inikin/Android.mk
inikin/Layout.cpp
inikin/LineBreaker.cpp
d692d6a9791145d41d7778cdf6b40b20c2be8cb4 30-Jan-2015 Raph Levien <raph@google.com> HyphenEdit in support of hyphenation

Adds a "HyphenEdit" field to the Minikin Paint object, which represents
an edit to the text to add a hyphen (and, in the future, other edits to
support nonstandard hyphenation).

Change-Id: Ib4ee690b0fe2137e1d1e2c9251e5526b274ec3a7
inikin/Layout.cpp
0bbff3a96d3836079371cdd4398c21afad3c5234 25-Feb-2015 Roozbeh Pournader <roozbeh@google.com> Disable HarfBuzz's fallback to compatibility decompositions

Previously, HarfBuzz's default fallback to compatibility
decompositions resulted in Mathematical Alphanumeric Symbols getting
rendered as normal letters and digits when there was no font
available to render them. This patch disables that fallback, to
ensure they are displayed as tofus.

Based on a patch by Behdad Esfahbod.

Bug: 19202569
Change-Id: I357f172302448d4ab0b24efc86119f1977b5996b
inikin/Layout.cpp
30c70ff7142e9cf3cd795a7afdf2b5afe8bc4564 05-Jan-2015 Narayan Kamath <narayan@google.com> am 79298c34: am 5870d4f0: Remove hardcoded ICU include paths.

* commit '79298c346088e13a0ddc93d49f4bb100afdbd14b':
Remove hardcoded ICU include paths.
79298c346088e13a0ddc93d49f4bb100afdbd14b 05-Jan-2015 Narayan Kamath <narayan@google.com> am 5870d4f0: Remove hardcoded ICU include paths.

* commit '5870d4f0d46f185568a2d2ea45afe48ae999b223':
Remove hardcoded ICU include paths.
5870d4f0d46f185568a2d2ea45afe48ae999b223 05-Jan-2015 Narayan Kamath <narayan@google.com> Remove hardcoded ICU include paths.

ICU exports them using LOCAL_EXPORT_C_INCLUDE_DIRS.

bug: 18581021
Change-Id: Ia57b3b4d231966203274b0e7e7b850beb1bd11c0
inikin/Android.mk
da09490825ce49e103d511ec1b92c79df0923ada 04-Dec-2014 Andreas Gampe <agampe@google.com> am 919fbb99: am cb20a2f0: Minikin: Remove unused variables, fix init order

* commit '919fbb99f1d5d0c95bf165cec9b7b178b42908ec':
Minikin: Remove unused variables, fix init order
919fbb99f1d5d0c95bf165cec9b7b178b42908ec 04-Dec-2014 Andreas Gampe <agampe@google.com> am cb20a2f0: Minikin: Remove unused variables, fix init order

* commit 'cb20a2f0b366bfc16db3a489a60156dec7a9fe21':
Minikin: Remove unused variables, fix init order
cb20a2f0b366bfc16db3a489a60156dec7a9fe21 25-Nov-2014 Andreas Gampe <agampe@google.com> Minikin: Remove unused variables, fix init order

For build-system CFLAGS clean-up, fix unused variables.

Reorder initializer list to initialize in the order of member
declarations.

Change-Id: I64358b2dcf0e39d0f4e18fdc3473de867f84fcba
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
inikin/MinikinFontFreeType.cpp
13f1aae02bacd475722bc8ea3fc2cf6abc1a82e3 29-Oct-2014 Raph Levien <raph@google.com> Move coverage bitmap from FontCollection to FontFamily

This will significantly reduce memory usage and also speed the creation
of new font families. In particular, the coverage bitmaps for the fonts
in the fallback stack will be computed once in the Zygote, rather than
separately in each app process.

Bug: 17756900
Change-Id: I66f5706bddd4658d78fe5b709f7251ca9d2ff4f8
inikin/FontCollection.cpp
inikin/FontFamily.cpp
e8b4a1b78a29878c89659860a7b7fa5605b3be0e 12-Nov-2014 Dan Albert <danalbert@google.com> am dc81fbad: am 69d4fba2: Move frameworks/minikin over to libc++.

* commit 'dc81fbad809f08564199c8f08df7e7f72310961a':
Move frameworks/minikin over to libc++.
dc81fbad809f08564199c8f08df7e7f72310961a 12-Nov-2014 Dan Albert <danalbert@google.com> am 69d4fba2: Move frameworks/minikin over to libc++.

* commit '69d4fba2f2b7bb2c248cc0e78cf277a6e44665f8':
Move frameworks/minikin over to libc++.
69d4fba2f2b7bb2c248cc0e78cf277a6e44665f8 12-Nov-2014 Dan Albert <danalbert@google.com> Move frameworks/minikin over to libc++.

Bug: 15193147
Change-Id: I5e15c95415c39515340e2663acd5fd26666db720
inikin/Android.mk
inikin/Layout.cpp
92065a6f3f8bf1a97c57f2f7c22aee750c0ce3b8 31-Oct-2014 Raph Levien <raph@google.com> am 253320d2: Move coverage bitmap from FontCollection to FontFamily

* commit '253320d25fccbb49621926d49dcf5ef64cf529c6':
Move coverage bitmap from FontCollection to FontFamily
253320d25fccbb49621926d49dcf5ef64cf529c6 29-Oct-2014 Raph Levien <raph@google.com> Move coverage bitmap from FontCollection to FontFamily

This will significantly reduce memory usage and also speed the creation
of new font families. In particular, the coverage bitmaps for the fonts
in the fallback stack will be computed once in the Zygote, rather than
separately in each app process.

Bug: 17756900
Change-Id: I66f5706bddd4658d78fe5b709f7251ca9d2ff4f8
inikin/FontCollection.cpp
inikin/FontFamily.cpp
168d3ef0e086a98f4c344f233863b6751a00583a 24-Oct-2014 Raph Levien <raph@google.com> am 5f11abd3: Silently ignore invalid rangeOffset values

* commit '5f11abd31fa8cfa723f54bd1c98ce4e27e7d3c77':
Silently ignore invalid rangeOffset values
5f11abd31fa8cfa723f54bd1c98ce4e27e7d3c77 23-Oct-2014 Raph Levien <raph@google.com> Silently ignore invalid rangeOffset values

Some fonts contain a cmap segment for char 0xffff that contains an
invalid rangeOffset. This was rejected by the existing code, which
means the font is considered to have empty Unicode coverage. This patch
just discards the invalid segment (consistent with OpenType Sanitizer),
making the custom font display.

Bug: 18106256
Change-Id: Icc8616a3030f80e62db906332be64d434ae72ea2
inikin/CmapCoverage.cpp
60cc2ccf68058f3d3ff1c0a863ef796ad388eed5 23-Sep-2014 Raph Levien <raph@google.com> am d5804e39: Fine-tune fake-bolding condition

* commit 'd5804e3937a961736e5cef0e8a70eacf91ee00bb':
Fine-tune fake-bolding condition
d5804e3937a961736e5cef0e8a70eacf91ee00bb 22-Sep-2014 Raph Levien <raph@google.com> Fine-tune fake-bolding condition

The old logic for fake bolding results in no fake bolding for a bold
span on a light weight (300) because the target weight (600 in this
case) didn't meet the condition. This patch fine-tunes the threshold
to enable fake bolding for this.

Bug: 17587185

Change-Id: I04abd00a74240cbed79c417f81486aa2158b2806
inikin/FontFamily.cpp
9f00aaec705f667fc62710c5b1cd2cb8d005e1d5 04-Sep-2014 Raph Levien <raph@google.com> am 6740536e: Snap advance widths to integers

* commit '6740536e3927d25bf5c2567e5f6e8c175973cbb7':
Snap advance widths to integers
6740536e3927d25bf5c2567e5f6e8c175973cbb7 03-Sep-2014 Raph Levien <raph@google.com> Snap advance widths to integers

Fractional advance widths were causing subtle problems with text
positioning when the same text was drawn with different spans in the
hwui renderer. Quantizing the coordinates on layout (as opposed to
waiting until the renderer draws the glyphs) solves the problem.

This patch also fixes a discrepancy between x position and advance
widths when letterspacing.

Bug: 17347779
Change-Id: Ia705944047408c2839d5ad078eefd6bbec446872
inikin/Layout.cpp
df0178d7d22efabe922f5c1f90a100d2b740ebf4 27-Aug-2014 Raph Levien <raph@google.com> am 997c799e: Try Unicode decomposition for selecting fallback font

* commit '997c799e3ec6bf8adf687e29670d23d91e0f5fee':
Try Unicode decomposition for selecting fallback font
997c799e3ec6bf8adf687e29670d23d91e0f5fee 27-Aug-2014 Raph Levien <raph@google.com> Try Unicode decomposition for selecting fallback font

This patch finds an appropriate fallback font in the case where no font
directly maps the requested character, but a font does exist for the
character's canonical decomposition. This yields correct rendering of
compatibility characters such as U+FA70.

Bug: 15816880
Bug: 16856221
Change-Id: Idff8ed6b942fec992a0815a32028b95af091d0ee
inikin/FontCollection.cpp
10d07727cf81c86352493e2241e17a0008c04bb5 22-Aug-2014 Behdad Esfahbod <behdad@google.com> am 56c7fb8c: Allocate font vector on stack

* commit '56c7fb8c0633f1b02115bb4370854016f8c84fb4':
Allocate font vector on stack
56c7fb8c0633f1b02115bb4370854016f8c84fb4 22-Aug-2014 Behdad Esfahbod <behdad@google.com> Allocate font vector on stack

This reduces another allocation (last one?) we were doing when
fulfilling shaping requests from the cache.

Bug: 17111260
Change-Id: Ieb8ae1ccfcaacedb257e1e9263777f10623aaf98
inikin/Layout.cpp
c01aa1e323e078a3103219f3646b369c73126f2b 22-Aug-2014 Behdad Esfahbod <behdad@google.com> am 6da7796c: Fix Layout initialization in the skipCache path

* commit '6da7796cbe8a17efd61a3302369e69bb222fdb4f':
Fix Layout initialization in the skipCache path
6da7796cbe8a17efd61a3302369e69bb222fdb4f 21-Aug-2014 Behdad Esfahbod <behdad@google.com> Fix Layout initialization in the skipCache path

C++ local var initialization always tricks me. Previously, Layout
didn't have a constructor, which meant that defining it on the stack
left mAdvance uninitialized. This was not an issue when we were doing
"new Layout()", since that invokes zero-initialization, but was an
issue for the skipCache path that was allocating layout on stack by
just "Layout l" instead of "Layout l = Layout()". To avoid surprises,
add a constructors that clears everything.

Also adds reset() method to reset the layout for reuse.

Change-Id: I3e02f00da9dd7d360abe13f63c310f6882292d0a
inikin/Layout.cpp
338de7c42303c9710d37242fac8727c36caee174 21-Aug-2014 Behdad Esfahbod <behdad@google.com> am 288c9159: Speed up cache lookup

* commit '288c915963b3500c7efb958ba613650e2ecdfdfa':
Speed up cache lookup
288c915963b3500c7efb958ba613650e2ecdfdfa 20-Aug-2014 Behdad Esfahbod <behdad@google.com> Speed up cache lookup

Avoid copying the string for cache lookup.

Bug: 17111260
Change-Id: Ic220bfc991fc6b3dada197304aabdf72a8941bd7
inikin/Layout.cpp
8e865a08c03bae9bbdae69c5ad1a79b47adb047f 08-Aug-2014 Behdad Esfahbod <behdad@google.com> am f952161b: Choose same font for Emoji keycap and its base character

* commit 'f952161b874fd2e9af474b9fd2ebcca1f3bb4555':
Choose same font for Emoji keycap and its base character
f952161b874fd2e9af474b9fd2ebcca1f3bb4555 08-Aug-2014 Behdad Esfahbod <behdad@google.com> Choose same font for Emoji keycap and its base character

The U+20E3 COMBINING KEYCAP is used in our fonts to generate an emoji
rendering of ASCII numbers and letters through GSUB. For that to work
we need to choose the same (Emoji) font for the character coming
*before* the COMBINING KEYCAP character.

This is a special-case of a broader need to choose fonts per grapheme
cluster as opposed to per character, but for now, special-case U+20E3.

Bug: 7557244
Change-Id: I958e5a01068df8495bbb9bc3b9ed871cea1838b6
inikin/FontCollection.cpp
143a999611a780f2549887b60702eee1f8c33bdc 30-Jul-2014 Behdad Esfahbod <behdad@google.com> am 5986f604: Support fontFeatureSettings

* commit '5986f6048ae21e0ec094c1f2ca0169d0ca6ec6b5':
Support fontFeatureSettings
5986f6048ae21e0ec094c1f2ca0169d0ca6ec6b5 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Support fontFeatureSettings

Bug: 15246510
Change-Id: I544915d29b2be4fb9f82f1989188a3a918c50fbc
inikin/Layout.cpp
11b08d8be3e2487488608173693180d6044f67bb 29-Jul-2014 Behdad Esfahbod <behdad@google.com> am d50c99df: Merge "Remove CSS string doLayout entrypoint and supporting code" into lmp-dev

* commit 'd50c99df4efbc57eb4419bd7944a979b9a1d53cc':
Remove CSS string doLayout entrypoint and supporting code
c924dd126db5d029af407ae6dd1a41c3652a6a64 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Remove CSS string doLayout entrypoint and supporting code

All usage is ported to the new doLayout() API now.

Bug: 16651112
Change-Id: I2c959138a69853b5e30098889d771fe5f4cfaa66
inikin/Android.mk
inikin/CssParse.cpp
inikin/Layout.cpp
09f1901d6befcab49ed46cb77151a5d4af14a3b9 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Add doLayout variant that does NOT take css string

New API removes CSS string and directly takes needed objects.

Bug: 16651112
Change-Id: Ie5f7c2ab05be6cbd77cae0a5fd6bb453771ada59
inikin/Layout.cpp
41b1aa18d7c32b4383993cd1b0a7e2e6648be14e 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Merge "Don't get stuck on invalid UTF-16" into lmp-dev
b8208bc19c178b73175f76323381a1eeb8059807 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Don't get stuck on invalid UTF-16

Replaces invalid unicode with replacement character U+FFFD and always
makes forward progress.

Bug: 15849380

Change-Id: Ic59ef6c64b0f5c4450bcae61597adcc269d6e7c5
inikin/Layout.cpp
a5bb91190edbea0be0e78a8511b3c920b6e99c4e 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Towards CSS removal

Extract language from FontStyle during shaping. Don't attach CSS
to LayoutContext.

Change-Id: Ie621d3415410178d0d15fa7b810eb8e412342ab6
inikin/FontFamily.cpp
inikin/Layout.cpp
f0a1e5b2da5aaccbc1c010413365cd8c304cf5d9 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Remove deprecated API

It has been unused outside minikin.

Change-Id: Iaa2237767d81c77f90d0264e633375e601dd72f1
inikin/Layout.cpp
a3aa943b865077123352a9309c9af28af8bb0347 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Merge "Revert "Don't pass invalid Unicode codepoint to Skia""
75d33a31f661d9eb98f3d1b4ac180ed5a9dec014 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Revert "Don't pass invalid Unicode codepoint to Skia"

After update to HarfBuzz 0.9.33 we don't need this anymore. HarfBuzz takes care of invalid input and passes U+FFFD to us.

This reverts commit 4422f4dd941628ad289bcabc75fbd788d37415f6.

Change-Id: Icfd0dc836a8d684fb1723fc215aa01f99639ff59
inikin/Layout.cpp
8e7a3dae37e9a22b2c054aec852615843d71caf6 18-Jul-2014 Behdad Esfahbod <behdad@google.com> Add letter-spacing support

Bug: 15594400
Change-Id: Ied94d7674be4097b0f44c9b0770d3294dc6433c1
inikin/CssParse.cpp
inikin/Layout.cpp
4422f4dd941628ad289bcabc75fbd788d37415f6 11-Jul-2014 Behdad Esfahbod <behdad@google.com> Don't pass invalid Unicode codepoint to Skia

Bug: 15849380
Change-Id: Ib5285e57c5806bd399600fadd56e8bc809da323f
inikin/Layout.cpp
a8e7eb6316e7d5169f0800e8f6e5af6508d97b72 11-Jul-2014 Behdad Esfahbod <behdad@google.com> Merge "Use __builtin_clzl if element is long"
329ae0639e332fa0ca85049f738776083b6dbafc 10-Jul-2014 Behdad Esfahbod <behdad@google.com> Use __builtin_clzl if element is long

Change-Id: I50a112739847fa826088854f6d172a188ff4cfb3
inikin/SparseBitSet.cpp
fbe7ebf529b3d429ae9f153b7df3529554bfc64d 10-Jul-2014 Elliott Hughes <enh@google.com> Switch minikin to the new icu.

Change-Id: I29a59edfe6102257c9f308aac1b4348ef7a18db7
inikin/Android.mk
156acb18f53b32655abb34166ea737e4320ca366 07-Jul-2014 Raph Levien <raph@google.com> Assign non-coverage font runs to base font

When a run has no cmap coverage in any font, use the base font. Most of
the time, this will cause rendering of the .notdef glyph, which is
preferable to displaying nothing. In some cases, Harfbuzz may be able to
decompose the characters (not in the cmap) to ones that are, in which
case we'll render those, as long as they're in the base font.

Bug: 6629748
Bug: 15816880
Change-Id: Ibb1b9242c83626e0c7db363ad65ce44a967a005e
inikin/FontCollection.cpp
67ea671fe421d0e4642caef619ec39ec86bdcaef 26-Jun-2014 Raph Levien <raph@google.com> Disable "palt" OpenType feature

Proper Japanese layout requires sophisticated rules for spacing
punctuation, not just turning on the "palt" (proportional alternate)
feature. Until we can support the whole set, roll back palt.

Change-Id: If2359c529b70b1dd45dddc00e5f4aa1c91f8b0e9
inikin/Layout.cpp
22e41754f6470ff1f4c0e0a56d01f7f555b59e21 26-Jun-2014 Raph Levien <raph@google.com> Add purgeCaches() method

Expose a method to purge caches used for TextLayout, useful for low
memory conditions.

Change-Id: I92f41afe987b7be4af5ca0a0c50fb51be35a2758
inikin/Layout.cpp
3d28a3fcebfed4744d1ef0307a8bdc8fc01e364c 16-Jun-2014 Raph Levien <raph@google.com> Implement grapheme cluster breaking

This patch includes an implementation of grapheme cluster breaking,
which is especially useful for repositioning the cursor for left and
right arrow key presses. The implementation is closely based on Unicode
TR29, and uses the ICU grapheme cluster break property, but is tailored
to more closely match the existing implementation and expected behavior.

Part of a fix for b/15653110 Improve behavior of arrow keys in EditText

Change-Id: I8eb742f77039c9ab7b2838285018cf8a8fc88343
inikin/Android.mk
inikin/GraphemeBreak.cpp
bb601b67dd05947f92cc23092bfb8a059c2e3377 19-Jun-2014 Raph Levien <raph@google.com> Make font runs less sticky

Fixes b/15734816 In the text "Wi-Fi", "-Fi" appears bolder than "Wi"

The problem was caused by "stickiness" in choosing fonts, where layout
would prefer using a font used for preceding characters as long as it
mapped the following characters in a run, in favor of the "best match"
rules. This patch adds a whitelist for making the stickiness more
conservative, only applying it for characters necessary for correct
shaping (ZWJ and ZWNJ in particular) and basic punctuation, where it is
desirable to match the style of the preceding text.

Change-Id: I1cf116879f074a5a71c351846707bfdd07b0d320
inikin/FontCollection.cpp
92207c3e831ce4214f60137da9430a1ce65351c0 12-Jun-2014 Raph Levien <raph@google.com> Merge "Fix missing text on nonexistent font file"
9f9f3b1ef40f7358dca6acd9dfef686cedefb6aa 12-Jun-2014 Raph Levien <raph@google.com> Tighten requirements for fake bold

The simple predicate for fake bold (2 or more grades darker than
requested) was applying it to thin (100 weight) when normal was
requested. This patch tightens the predicate to also require that
the requested weight be in the bold range.

Fix for bug 15588352 "sans-serif-thin doesn't work on lockscreen"

Change-Id: Id9988bd149a9c8a7c943e3b221f7fb4b37fb6ddb
inikin/FontFamily.cpp
bd36ec766a451c62ffdd407d5ce1a355e8f7dfd8 12-Jun-2014 Raph Levien <raph@google.com> Fix missing text on nonexistent font file

Fix for bug 15570313 "Missing text on nonexistent font file"

This patch makes sure that the lastChar and mInstances arrays are in
sync with each other even when a FontFamily being added has no valid
fonts in it. Previously, when they got out of sync, unicode coverage
calculation would be wrong, resulting in missing text.

Change-Id: I69c727ef69e2c61e2b2d6b81d5a28c806327f865
inikin/FontCollection.cpp
1c7b403ad8026fdebd0185319183d0a7a2c377bd 10-Jun-2014 Raph Levien <raph@google.com> Merge "Provisionally enable "palt" OpenType feature"
9a5f713add8cfb91ac2c9ed5c917309053201ab6 07-Jun-2014 Raph Levien <raph@google.com> Support for fake bold and italics

This patch adds support for computing when fake bold and fake italics
are needed (because the styles are requested but not provided by the
matching FontFamily), and providing them as part of the layout result.

Part of the fix for bug 15436379 Fake bold doesn't fully work (Minikin)

Change-Id: I180c034b559837943673b5c272c8e890178dff0d
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
4043f6f6d9c584bc61bc3d81d1680bf1b558330e 07-Jun-2014 Raph Levien <raph@google.com> Provisionally enable "palt" OpenType feature

We want to test configurations where the Noto Japanese font will have
its "palt" feature (to select tighter spacing in kana) will be enabled
for framework but not WebView or Chrome rendering of Japanese text. This
patch simply hardcodes this feature on.

This is also a first step towards more general setting of OpenType
features. The hardcoded feature list will grow into one set by
parameters which will eventually be plumbed up to Java.

Change-Id: Ie284e0487a1434155c8ac1cb68ddc4fc4b3c018a
inikin/Layout.cpp
89566f0ada1cafe673efa064cde38467990235d4 06-Jun-2014 Raph Levien <raph@google.com> Add baseFont method to FontCollection

This patch adds a method to retrieve the base font from a
FontCollection, which is useful when querying global font metrics.

Part of the fix for bug 15467288 "Inconsistent line heights on
Minikin builds"

Change-Id: I268ae5128d0852a020d746bc22af81fc1a623228
inikin/FontCollection.cpp
3f1ea5da2ee12b0d95c17c56928c3e553d4eeda0 05-Jun-2014 Raph Levien <raph@google.com> Support for context in API

This patch completes support for adding context for complex script
layout, for example when a string with joins straddles two spans.

Part of the fix for 15431028: "Properly support context for joining
scripts (Minikin)"

Change-Id: I65b0833be92eb477aa531bbef0ac6eddeb3a962a
inikin/Layout.cpp
3164d1a77eecf3185347a44342131f4275de824f 05-Jun-2014 Raph Levien <raph@google.com> Make paint flags consistently uint32_t

Change internal plumbing of paint flags (including CssParse) to uint32_t
consistently, to match the type used in the client. This will probably
prevent compiler warnings. Also renames "float" to "double" to avoid
confusion about precision.

Change-Id: I80374712c4067ca9e7711cc2d4ec33c440ab9c7c
inikin/CssParse.cpp
inikin/Layout.cpp
893399732b64203133c22ad3c1f3535e46bf35a7 04-Jun-2014 Raph Levien <raph@google.com> Fix unmatching type

Missed a slightly mismatched type (int vs int32_t) from a previous code
review.

Change-Id: Ib56775a3a1a6ec3763da7f7432186954251cc048
inikin/Layout.cpp
448b0fd720d7ba902b9be224a287d08abe3ebea8 31-May-2014 Raph Levien <raph@google.com> Support for scaleX and skewX

Adds pseudo-css properties for scaleX and skewX, as well as paint flags,
and plumb them through to the MinikinPaint abstraction and to Harfbuzz,
to support nontrivial scale and stretch of text.

This is the Minikin part of the fix for bug 15186705 "Usability of the
suggestion strip in recent OTA's is severely reduced"

Change-Id: Ifa60355e086e4691ff92c5d50d84eb7cea0fea95
inikin/CssParse.cpp
inikin/Layout.cpp
066e8575af64fb452617ac6005de6ccf6509553b 29-May-2014 Raph Levien <raph@google.com> Fix ZWJ not working for Indic fonts

This is a fix for bug 15185229 ZWJ not working in Sinhala and Kannada.

Indic fonts (unlike Arabic) require the entire string, including ZWJ,
to be passed to Harfbuzz; it's not enough for the ZWJ to be present in
the context. The solution is to be "sticky" in font itemization,
continuing to use the same font as long as it has Unicode coverage.

Change-Id: I7673bc56fbda09f1e1a4582e8d88342343b706f1
inikin/FontCollection.cpp
7b221d97b7b64dc5ce457e19666d55d042e22e62 27-May-2014 Raph Levien <raph@google.com> Language and variant selection

This patch adds a "lang" pseudo-CSS property and uses it both to select
an appropriate font and control the "locl" OpenType feature to get the
most appropriate rendering for the langauge and script. In addition,
the "-minikin-variant" property selects between "compact" and "elegant"
variants of a font, as the former is needed for vertically cramped
spaces.

This is part of the fix for bug 15179652 "Japanese font isn't shown on
LMP".

Change-Id: I7fab23c12d4c797a6d339a16e497b79a3afe9df1
inikin/CssParse.cpp
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
0297ee985c26b49fc2a3b0941db354c27f436bbf 29-May-2014 Raph Levien <raph@google.com> Fix for Minikin native crash

The context start offset wasn't being taken into account for
accumulating the advance values, leading in some cases to array index
overflow.

This is a fix for bug 15327918 "SIGSEGV in
android::MinikinFontSkia::GetSkTypeface()"

Change-Id: I9b646785724c9b72d862b822cd84661c106fbe52
inikin/Layout.cpp
7c382381191b2280b53c375fe83dfc6217bbdfa9 26-May-2014 Raph Levien <raph@google.com> Fix for bug 15252902 native crash in Minikin

This is a fix for bug 15252902 "Crash observed on keep launch or
existing youtube app after playing video". It was doing the test for a
null font after trying to resolve the font in a cache, which caused a
crash when there was no font for the run. This patch just tests before
cache lookup.

Change-Id: Iee41f7ce6b69cb09438462b6aaa916f242da7b77
inikin/Layout.cpp
4d4e6bc8118d15542f1f2a9218f0f7a91a29474f 21-May-2014 Raph Levien <raph@google.com> Caching for layouts and harfbuzz faces

This patch adds caching for both layouts and for HarfBuzz face objects.
The granularity of the cache for layouts is words, so it splits the
input string at word boundaries (using a heuristic). There are is also
some refactoring to reduce the amount of allocation and copying, and
movement towards properly supporting contexts.

The size of the caches is a fixed number of entries; thus, it is
possible to consume a large amount of memory by filling the cache with
lots of large strings. This should be refined towards a scheme that
bounds the total memory used by the cache.

This patch fixes bug 15237293 "Regression: Measure performance is
significantly slower with minikin".

Change-Id: Ie8176857e2d78656ce5479a7c04969819ef2718d
inikin/Android.mk
inikin/FontCollection.cpp
inikin/Layout.cpp
d973b3926b3a34c19d3d6f309fae1138e782e4dc 27-May-2014 Raph Levien <raph@google.com> Merge "Do BiDi algorithm for text layout" into lmp-preview-dev
86fa46c5ebb0d2c3319e08f4fbf487d8c2abbbfc 19-May-2014 Raph Levien <raph@google.com> Do BiDi algorithm for text layout

This is a fix for bug 15130102 "Language name for Hebrew displayed the
wrong way around on keyboard".

This patch extends the previous BiDi support (when the direction for the
entire string was given by the caller) to run the BiDi algorithm
(provided by ICU) over the string to break it into BiDi runs. Thus, it
handles mixed LTR and RTL strings in a single layout, and also respects
heuristics for inferring the paragraph direction from the string.

Change-Id: Ia4b869de3c139c5a7d16b8ce7766870b98a815ea
(cherry picked from commit 4b3a941128454e55893d65433a835e78a9e9781d)
inikin/Android.mk
inikin/Layout.cpp
72fe9422c869b7878240a23e4650d9d90edb1c2a 24-May-2014 Raph Levien <raph@google.com> Fix native crash in Latin-1 typefaces

This is a fix for bug 15171911 Timely crashes (native crash in
libminikin) when I go to add a new alarm

This patch fixes an off-by-one error that caused typefaces with only one
page of Unicode coverage (ASCII or Latin-1) to have nPages = 0 instead
of the correct value of 1 in the corresponding FontCollection.

Change-Id: Id8be0c9e5713b8af22d863992921ee6382416a34
inikin/FontCollection.cpp
c31e3883456e018d742e9f29815ba5ff8b315ea1 19-May-2014 Raph Levien <raph@google.com> Fix incomplete refcounting and locking

These changes were supposed to be committed in the previous patch
"Better refcounting and locking" but seem to have gotten lost in a
rebase. It fixes a memory leak and some possible race conditions.

Change-Id: I54ca1e37500ec49756fe317cc6d6d03da9911501
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
d231a4b0b1d482c7ae7717b048112e1fe5d0f5a9 13-May-2014 Raph Levien <raph@google.com> Initial BiDi support

This patch contains a very basic implementation of BiDi. It respects the
BiDi flags passed in as an explicit parameter (through the
"-minikin-bidi" pseudo-CSS property), but doesn't yet do its own BiDi
run detection. It also takes some shortcuts (marked as TODO) that are
based on reasonable assumptions of the current font stack, but not
universally valid.

Even with these shortcomings, it seems to display RTL text from TextView
correctly.

Change-Id: I223433923c4eb06f90c0327e86bfbe0aff71d4f5
inikin/CssParse.cpp
inikin/Layout.cpp
0a689bb956183beebe7d59fccb226a82680f265a 14-May-2014 Raph Levien <raph@google.com> Fix 64-bit cleanliness problem

This patch fixes a problem where int and ssize_t were being conflated.

Change-Id: I642a4ee1d59d81723034fdfe33bd8ca29a5dc322
inikin/Layout.cpp
d133eab2a1a59ce4a5b1b3db04ec00dc0dbdf349 14-May-2014 Raph Levien <raph@google.com> Fix build breakage in sample code

This updates the Skia sample implementation to implement GetBounds,
but the FreeType implementation is NYI (to be fixed in future commit).

Change-Id: I24eda14d5fb11c2a1e81394ad8c779de3292dd79
inikin/MinikinFontFreeType.cpp
b80c1f19c58b927820a8a24bf2218e5645724608 06-May-2014 Raph Levien <raph@google.com> Better refcounting and locking

All major externally accessible objects (especially FontFamily and
FontCollection) are now reference counted. In addition, there is a
global lock intended to make operations thread-safe.

WIP notice: in this version of the patch, not all external API entry
points are protected by the lock. That should be fixed.

Change-Id: I14106196e99eb101e8bf1bcb4b81359759d2086c
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
inikin/MinikinInternal.cpp
inikin/MinikinInternal.h
inikin/MinikinRefCounted.cpp
ecc2d34ac23a497988f21e5f415b53c007b9d8c5 15-Jul-2013 Raph Levien <raph@google.com> A basket of features: itemization, bounds, refcount

This patch improves script run itemization and also exposes metrics
and bounds for layouts. In addition, there is a fair amount of internal
cleanup, including ref counting, and making the MinikinFont abstraction
strong enough to support both FreeType and Skia implementations. There
is also a sample implementation using Skia, in the sample directory.

As part of its functionality, his patch measures the bounds of the
layout and gives access through Layout::GetBounds(). The corresponding
method is not implemented in the FreeType-only implementation of
MinikinFont, so that will probably have to be fixed.

Change-Id: Ib1a3fe9d7c90519ac651fb4aa957848e4bb758ec
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
1279a3bf5ec6131efefbc51d52d24850fd81f676 12-Sep-2013 Kenny Root <kroot@google.com> Use canonical UniquePtr.h header

Change-Id: Id50e9d6fe2f08d3121b168b45791a8e8fb045d7f
inikin/FontFamily.cpp
1686c1d7a2562360bfcca52e9c53ebbcd1bed00c 28-Jun-2013 Victoria Lease <violets@google.com> Use shared ft2 lib, deal with libpng/zlib deps

Bug: 9603326
Change-Id: I7df1f68fa3a44b37b1b279387f4ddfe942928bb0
inikin/Android.mk
bcc3dc5a2591a95a57e379e27cbad69c18e91e67 23-May-2013 Raph Levien <raph@google.com> Introduce MinikinFont abstraction

This commit removes the direct dependency on FreeType and replaces it
with a MinikinFont abstraction, which is designed to support both
FreeType and Skia fonts (and possibly others in the future).

Also adds a "total advance" to the Layout, with an API for retrieving
it.

Change-Id: If20f92db9a43fd15b0fe9794b761ba00fb21338c
inikin/Android.mk
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
inikin/MinikinFontFreeType.cpp
9cc9bbe1461f359f0b27c5e7645c17dda001ab1d 24-Apr-2013 Raph Levien <raph@google.com> Initial commit of Minikin library

This is the initial draft of Minikin, a library intended to perform text
layout functions. This version does basic weight selection and font runs
for scripts, and also has a simple renderer for drawing into bitmaps,
but is lacking measurement, line breaking, and a number of other
important features. It also lacks caching and other performance
refinements.

Change-Id: I789a2e47d11d71202dc84b4751b51a5e2cd9c451
inikin/AnalyzeStyle.cpp
inikin/Android.mk
inikin/CmapCoverage.cpp
inikin/CssParse.cpp
inikin/FontCollection.cpp
inikin/FontFamily.cpp
inikin/Layout.cpp
inikin/SparseBitSet.cpp