History log of /frameworks/minikin/libs/minikin/Layout.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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
9d48271c0480c27402cfba359f45964637927a63 02-Feb-2016 Keisuke Kuroyanagi <ksk@google.com> Optimize: Precompute the hash value for LayoutCacheKey.

Bug: 24505153
Change-Id: If61c063c175086dec88cda187eafd9ce923e4cb1
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
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
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
-- Normalize input to be BCP47 compliant identifier by ICU.

Bug: 26168983
Change-Id: I431b3f361a7635497c05b85e8ecbeb48d9aef63e
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
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
-- Normalize input to be BCP47 compliant identifier by ICU.

Bug: 26168983
Change-Id: I8df992a6851021903478972601a9a5c9424b100c
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
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
- 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
b4c799180458fc37b96ee43ef9111f64e0cc99f7 28-Oct-2015 Bart Sears <bsears@google.com> Revert "Add -Werror -Wall -Wextra to compiler option."

This reverts commit 63635cff5861dcaed963c7332eecf51b9d7d920a.

Change-Id: I2b4b10e8afedc85dbe2d07f3e47315652b65cd14
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
- Add -Werror for suppressing further warning.
- Add -Wall -Wextra for safety.

Change-Id: I30a0914a4633bd93eb60957cdf378770f04d8428
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
7c8ac67a9022590d32d25e61094f29f7af42357d 01-Oct-2015 Keisuke Kuroyanagi <ksk@google.com> Merge "Refactoring: Introduce helper class to iterate runs."
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
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
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
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
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
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
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
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
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

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
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
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
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
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
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
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

Change-Id: I64358b2dcf0e39d0f4e18fdc3473de867f84fcba
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++.
69d4fba2f2b7bb2c248cc0e78cf277a6e44665f8 12-Nov-2014 Dan Albert <danalbert@google.com> Move frameworks/minikin over to libc++.

Bug: 15193147
Change-Id: I5e15c95415c39515340e2663acd5fd26666db720
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
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
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
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
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
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
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
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
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
f0a1e5b2da5aaccbc1c010413365cd8c304cf5d9 25-Jul-2014 Behdad Esfahbod <behdad@google.com> Remove deprecated API

It has been unused outside minikin.

Change-Id: Iaa2237767d81c77f90d0264e633375e601dd72f1
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
8e7a3dae37e9a22b2c054aec852615843d71caf6 18-Jul-2014 Behdad Esfahbod <behdad@google.com> Add letter-spacing support

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

Bug: 15849380
Change-Id: Ib5285e57c5806bd399600fadd56e8bc809da323f
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
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
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
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
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
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
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

Change-Id: Ib56775a3a1a6ec3763da7f7432186954251cc048
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
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

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

Change-Id: I7fab23c12d4c797a6d339a16e497b79a3afe9df1
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

This is a fix for bug 15327918 "SIGSEGV in

Change-Id: I9b646785724c9b72d862b822cd84661c106fbe52
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
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
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)
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
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

Change-Id: I223433923c4eb06f90c0327e86bfbe0aff71d4f5
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
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
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
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

Change-Id: If20f92db9a43fd15b0fe9794b761ba00fb21338c
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

Change-Id: I789a2e47d11d71202dc84b4751b51a5e2cd9c451