History log of /frameworks/minikin/include/minikin/MinikinFont.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
55e37071ab06ae46a87add9d54fe2b371b720241 31-Mar-2017 Roozbeh Pournader <roozbeh@google.com> Remove unused classes and methods

Removed Bitmap and MinikinFontFreeType classes, as well
as the Layout::draw() method.

The code was there for debugging purposes and for potential
third-party users. We no longer support third-party uses of
Minikin, since we don't know of any.

Test: mmma -j frameworks/minikin builds with no errors
Change-Id: Iddc9e8d35334053bd5255bccf3dbe5ba1eecf814
/frameworks/minikin/include/minikin/MinikinFont.h
c7ef4000c1e840c3d3b66e85a40ebd34a5a2a8ee 18-Feb-2017 Roozbeh Pournader <roozbeh@google.com> Correct hyphenation for various complex cases

This adds better support for Arabic script languages, Armenian,
Catalan, Hebrew, Kannada, Malayalam, Polish, Tamil, and Telugu by
adding various hyphenation types and edits appropriate for the
locales.

For Arabic script languages, soft hyphens act transparently with
regard to joining: If a line is broken at a soft hyphen where the two
characters around the soft hyphen were joining each other before,
they will continue to appear joining if the line is broken at the
soft hyphen and a hyphen glyph is inserted. This is needed for
Central Asian languages such as Uighur.

For Armenian, U+058A ARMENIAN HYPHEN is used for line breaks caused
by either automatic hyphenation or soft hyphens.

For Catalan, nonstandard line breaks are implemented for "l·l", which
hyphenates as "l-/l".

For Polish, when there is a line break at a hyphen, the hyphen is
repeated at the next line.

For the South Indic languages, when breaks happen due to soft breaks
or automatic hyphenation, no visible hyphen is inserted, although a
penalty is added.

For Hebrew, support for using U+05BE HEBREW PUNCTUATION MAQAF has
been implemented, but it's turned off pending confirmation of
desirability.

Also, hard hyphens, which previously had no penalty added for
breaking the line after them, now have the same penalty as an
automatic or soft break, with the difference that no hyphen is
inserted when they break.

Finally, some bugs have been fixed with hyphenating multiscript and
multi-font words.

Bug: 19950445
Bug: 19955011
Bug: 25623243
Bug: 26154469
Bug: 26154471
Bug: 33387871
Bug: 33560754
Bug: 33752592
Bug: 33754204
Test: Unit tests added, plus thorough manual testing
Change-Id: Iaccf776ce8d1d434ee8b1c534ff3659d80fdc338
/frameworks/minikin/include/minikin/MinikinFont.h
dfbc6e374259f9d81940b5195ac013b02429af27 10-Feb-2017 Seigo Nonaka <nona@google.com> Remove MinikinRefCounted and use shared_ptr instead

Let's use shared_ptr since manual ref counting can be a bug-prone and
using the global mutex inside destructor is not useful for some time.

To remove raw pointer manipulation, needed to change Layout
constructors. Layout is no longer copyable and need to pass
FontCollection to constructor.

Bug: 28119474
Test: minikin_tests passed
Test: hwui_unit_tests passed
Test: No performance regression in minikin_perftest.
Change-Id: I8824593206ecba74cbc9731e298f045e1ae442a3
/frameworks/minikin/include/minikin/MinikinFont.h
39654bb6441b55f99341b613fc1194121b1e740b 13-Feb-2017 Seigo Nonaka <nona@google.com> Call hb_font_set_variation if font variations are provided.

Test: None
Change-Id: I203d9ba7e1a1fcfdb10cd6a711d9a35136cbddd6
/frameworks/minikin/include/minikin/MinikinFont.h
065c46a665d562c93ffa82fda10dee52a16ac23b 22-Nov-2016 Seigo Nonaka <nona@google.com> Introduce createCollectionWithVariation.

This is 2nd attempt of I08e9b74192f8af1d045f1276498fa4e60d73863e.
The original CL was reverted due to conflicting with another CL submitted
before.

Here is the original commit message of reverted change.

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

Test: minikin_tests
Bug: 33062398
Change-Id: Ib25bf1bb5a5191e15a6523954146521464c91906
/frameworks/minikin/include/minikin/MinikinFont.h
1c7b0261542f8a54e7b3e52236070f62d073e17f 20-Jan-2017 Siyamed Sinir <siyamed@google.com> Revert "Introduce createCollectionWithVariation."

This reverts commit 90e6b1885d44c33b1da9477a85dc7dd066acd33f.

Bug: 34378805
Change-Id: I22b683f774813724f220b1b8584ab188f3cf4fa7
/frameworks/minikin/include/minikin/MinikinFont.h
90e6b1885d44c33b1da9477a85dc7dd066acd33f 22-Nov-2016 Seigo Nonaka <nona@google.com> Introduce createCollectionWithVariation.

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

Test: minikin_tests
Bug: 33062398
Change-Id: I08e9b74192f8af1d045f1276498fa4e60d73863e
/frameworks/minikin/include/minikin/MinikinFont.h
fd77b01ff2cb5c55f02929b5821ddc41aee0cd05 18-Oct-2016 Seigo Nonaka <nona@google.com> Clean Up: Removing unused interface GetTable from MinikinFont.

This is 2nd attempt of Ifcd7a348d7fb5af081192899dbcdfc7fb4eebbf9

After Id766ab16a8d342bf7322a90e076e801271d527d4, GetTable is no longer
used in production due to poor performance and it is now only used in
tests. This CL removes GetTable interface from MinikinFont and update
tests code to use new interfaces, GetFontData, GetFontSize and
GetFontIndex.

Bug: 27860101
Test: Manually done
Change-Id: Ib48973ff25cdc61a4c666d28128266df0aaea83e
/frameworks/minikin/include/minikin/MinikinFont.h
acd401d02981af51419f4b740abb2c41e4980fdb 15-Nov-2016 Seigo Nonaka <nona@google.com> Implement word spacing

Add a wordSpacing paint parameter, which will be used for
justification.

Bug: 31707212
Test: ran minikin_tests
Change-Id: I91224ab8ef882ac0c87425c28ab731fead283612
/frameworks/minikin/include/minikin/MinikinFont.h
8d7ed7374b67fe16e8ce0815ec6f8d12c5126c9e 25-Oct-2016 Seigo Nonaka <nona@google.com> Revert "Clean Up: Removing unused interface GetTable from MinikinFont."

This reverts commit 1d525df4f0849a980c3204d5e4d41cbcc42f4ad6.

This causes a crash on Android Auto.

Bug: 32374752
Change-Id: Ia2ff77bf9a12351c6949f79ef6fa2d8016e3022d
/frameworks/minikin/include/minikin/MinikinFont.h
1d525df4f0849a980c3204d5e4d41cbcc42f4ad6 18-Oct-2016 Seigo Nonaka <nona@google.com> Clean Up: Removing unused interface GetTable from MinikinFont.

After Id766ab16a8d342bf7322a90e076e801271d527d4, GetTable is no longer
used in production due to poor performance and it is now only used in
tests. This CL removes GetTable interface from MinikinFont and update
tests code to use new interfaces, GetFontData, GetFontSize and
GetFontIndex.

Bug: 27860101
Test: Manually done

Change-Id: Ifcd7a348d7fb5af081192899dbcdfc7fb4eebbf9
/frameworks/minikin/include/minikin/MinikinFont.h
47b905f6840ea6776d6f6778915e7408a1ff8be4 15-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings in minikin

* Add explicit keyword to conversion constructors,
or add NOLINT(implicit) for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1

Change-Id: I0c7b90f9bb953a9f2e4f0fb2032fa65ac604b9ca
/frameworks/minikin/include/minikin/MinikinFont.h
14e2d136aaef271ba131f917cf5f27baa31ae5ad 09-Jun-2016 Seigo Nonaka <nona@google.com> Always use minikin namespace.

Here is a new policy of the namespace of minikin.
- All components should be in minikin namespace.
- All tests are also in minikin namespace and no anonymous namespace.

Bug: 29233740
Change-Id: I71a8a35049bb8d624f7a78797231e90fed1e2b8c
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
5986f6048ae21e0ec094c1f2ca0169d0ca6ec6b5 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Support fontFeatureSettings

Bug: 15246510
Change-Id: I544915d29b2be4fb9f82f1989188a3a918c50fbc
/frameworks/minikin/include/minikin/MinikinFont.h
83d5a3c53d77c34fbeac7012ab3612933982d494 29-Jul-2014 Behdad Esfahbod <behdad@google.com> Initialize MinikinPaint members

We are stack-allocating MinikinPaint objects in Minikin clients, and
without a constructor adding new members to the struct cannot be done
without updating all clients (only one right now!).

Change-Id: I4170f16498bb6b07cb795495011aca58087ed0bd
/frameworks/minikin/include/minikin/MinikinFont.h
8e7a3dae37e9a22b2c054aec852615843d71caf6 18-Jul-2014 Behdad Esfahbod <behdad@google.com> Add letter-spacing support

Bug: 15594400
Change-Id: Ied94d7674be4097b0f44c9b0770d3294dc6433c1
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h
f660ef9ee63a500b7fb878e502ea5fd519c39607 14-Jun-2013 Raph Levien <raph@google.com> Fix build breakage

The MinikinFont class was missing a destructor. The build error was
not caught because incremental builds didn't see fit to relink after
I deleted one of the source files (that contained the impl of this
destructor).

Change-Id: Ic72d56fe28316cd2b2f808910e34ca6f177a1220
/frameworks/minikin/include/minikin/MinikinFont.h
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
/frameworks/minikin/include/minikin/MinikinFont.h