History log of /frameworks/minikin/libs/minikin/CmapCoverage.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
048b45f69c2a6a43329fc8efd056666f427a62d4 21-Mar-2018 Seigo Nonaka <nona@google.com> Revive support of duplicated entry in cmap format 4

Minikin rejects unordered (including duplicated) cmap entries for
security reasons. (Issue 32178311).
The duplicated entries are invalid for cmap format 12 or cmap format 14
but valid for cmap format 4.

Bug: 76103006
Test: manual
Test: minikin_test
Test: atest CtsWidgetTestCases:EditTextTest
CtsWidgetTestCases:TextViewFadingEdgeTest
FrameworksCoreTests:TextViewFallbackLineSpacingTest
FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
CtsTextTestCases FrameworksCoreTests:android.text
CtsWidgetTestCases:TextViewPrecomputedTextTest

Change-Id: I902a11a93d01ccb609662e86e5ae2f3897940fb4
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
c573e914829eece9dba3abf5a9c707e1c56606b5 02-Feb-2018 Seigo Nonaka <nona@google.com> Log the message only when the read size exceeds 32bit

Bug: 70808908
Test: N/A
Change-Id: I700a1eaa940bb20ad4b43ee946fd4f81b00bf44d
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
eff1470ea77dbe4cc009dbf33b05687b0ee66630 17-Jan-2018 Seigo Nonaka <nona@google.com> Fix OOB read due to integer overflow

This only happens on 32bit system.

Bug: 70808908
Test: minikin_tests
Change-Id: Id394e0ccf83bddd2db9957386dc3ed892feae8a5
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
524d294be051584e5506e5a4ad6ec70471bf4c08 12-Dec-2017 Seigo Nonaka <nona@google.com> Stop creating local vector for storing temporary hyphenation result

No temporary vector is necessary during hypheanation.
At the same time, this reveals Range name confliction. Remove internal
Range struct and use public one in CmapCoverage.cpp

Bug: 65024629
Test: minikin_tests
Change-Id: I31fb3472bb6a88e4e15d851723f34adc25e1d993
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
6c8722e217ff5238f0b849152d7936959a728103 30-Nov-2017 Seigo Nonaka <nona@google.com> Apply clang-format

Bug: 65125938
Test: m
Change-Id: I4a4319cc34c186aa0a3ce1d0301af1cd4e0feb81
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
1d461589869ee5b7102f96271b0ef0a776ab513c 20-Oct-2017 Seigo Nonaka <nona@google.com> Style cleanup.

This CL contains following cleanups:
- Rename the following classes and corresponding file names:
FontLanguage -> Locale
FontLanguages -> LocaleList
FontLanguageListCache -> LocaleListCache
- Remove unnecessary #include lines.
- Define the Minikin's header include ordering and follow that style.
See doc/minikin_style.md for details.
- Always use std::string and std::vector instead of string and vector
with using-declaration.
- Replace LOG_ALWAYS_FATAL_IF with MINIKIN_ASSERT so that the assertion
is removed on build configuration for user.

This CL does not change any behavior.

Bug: 65024629
Test: make checkbuild
Change-Id: If41bb3c3389303053bbe95e349eb2dd4b619257c
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
0261224adbab3a3735d37b41a38bdea046248406 29-Sep-2017 Seigo Nonaka <nona@google.com> Clean Up: Fix tests, remove verbose logs, use StringPiece.

Bug: 65024629
Test: minikin_tests
Change-Id: I585469a3c8c5fe8f6f910bf640f716166f560df8
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
c895d9ffd672c7bd3b1f3507738680bdd48eb477 21-Sep-2017 Seigo Nonaka <nona@google.com> Add log message if Cmap format 12 has too large code point.

Bug: 62134807
Test: N/A
Change-Id: Id674b6e462a3c41bc7ff3cfd4c3bf7fe1ac96054
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
0c943b002dfed4c19196a4d162737057f8ed5a56 07-Jul-2017 Seigo Nonaka <nona@google.com> Reject unsorted cmap entries.

addRange assumes the passing ranges are sorted in ascending order which
is a part of OpenType spec, but bad fonts can pass arbitrary ranges.
Now, addRange rejects invalid input and stop using such bad fonts.

Bug: 32178311
Test: minikin_tests
Test: bit CtsGraphicsTestCases:.TypefaceTest
Change-Id: Ice845a1206e1c9da08ea20c7b56fde2e6ec8b673
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
722841005f805a5023fd7edefc4016968d1fae10 18-Mar-2017 Seigo Nonaka <nona@google.com> Compute SparseBitSet for cmap format 14 subtables.

By computing cmap format 14 subtables similar to cmap format 4 or 12,
there are following benefits:
- FontCollection::hasVariationSelector becomes 70x faster for the worst
case, 10x faster for the normal case.
- FontFamily::hasGlyph becomes lock-free.
- FontCollection::itemize becomes 2x faster than before for some cases.

On the other hand, following negative things happen:
- Initial FontFamily construction takes 2.5x longer than before, but this
only happens in Zygote and should not happen at application launch time.
- FontFamily construction from buffer takes longer time than before but
it is still around 800µs.
- Consumes additionally memory (about 30kB for NotoSansCJK-Regular.ttc
of ttc index 0, 2.5kB for NotoColorEmoji.ttf), but this is shared across
all applications. No additional memory is necessary if the font doesn't
support variation sequences.

Bug: 36401726
Test: minikin_tests passed
Test: minikin_stress_tests passed
Test: android.graphics.cts.PaintTest passed
Change-Id: I3ebc9ad5050fb9ab6283810d31ae8d13af168ec5
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
818fbee83a72ca86f64527eb90b2f15ec9b28504 14-Apr-2017 Seigo Nonaka <nona@google.com> Reduce heap memory in minikin.

This patch reduces about 73 kB memory.
The original SparseBitSet could contain full 32bit integers, but all of
that is not necessary for Unicode code points. By reducing the supported
range to up to Unicode maximum, U+10FFFF, we can save extra memory.

SparseBitSet holds 256-bit sliced pages and indices of them.
Previously, we needed to hold up to 2^24-1 pages for keeping 32-bit
integers.

This CL limits the number of pages to 2^16-1 (65535), so that
SparseBitSet only supports 24-bit integers now, but this is sufficient
for keeping all Unicode code points. With this change, we can change the
index integer type from uint32_t to uint16_t.

Bug: 37357593
Test: minikin_tests passes
Change-Id: I462cc27927752c942ac5da0bf303a5afb81b87a3
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
db1b6cb7765091453d9b4dc7f6c2fb4d7123ab11 25-Mar-2017 Seigo Nonaka <nona@google.com> Support cmap tables with platform ID == 0

Some fonts don't have cmap subtables of Microsoft Platform ID (3) and
only have cmap subtables of Unicode Platform ID (0).

Bug: 32505843
Test: minikin_unittest passed
Test: android.graphics.cts.TypefaceTest passed
Change-Id: I24aa49860790c0ae8d8e578efd728b95ec0f93ae
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
32c12c0ac825453f4c3bba07718cfe684ec90bec 28-Dec-2016 Mark Salyzyn <salyzyn@google.com> resolve merge conflicts of 2377a00 to master

Test: build
Bug: 26552300
Bug: 31289077
Change-Id: I6181ae7e84f9bdcbed50841c70d07f6906a10eb7
555d84c6f98eafcbe677cdcb8e9605760acd8ce5 29-Sep-2016 Mark Salyzyn <salyzyn@google.com> minikin: Replace cutils/log.h with android/log.h or log/log.h

- replace cutils/log.h with android/log.h (main buffer logging)
- replace cutils/log.h with log.log.h (+SafetyNet logging)
- define LOG_TAG before use.

Test: compile
Bug: 26552300
Bug: 31289077
Change-Id: I7a4803dd66f31b7103e09e5ff5b8fa523fa0fd60
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
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/libs/minikin/CmapCoverage.cpp
bcb024df56c8ae7a5914d6f060ac99a2b5d118d9 18-Feb-2016 Seigo Nonaka <nona@google.com> Merge "Improve Paint.measureText and Paint.hasGlyph for variation sequences." into nyc-dev
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
/frameworks/minikin/libs/minikin/CmapCoverage.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
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
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
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
/frameworks/minikin/libs/minikin/CmapCoverage.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
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
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
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)
/frameworks/minikin/libs/minikin/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
/frameworks/minikin/libs/minikin/CmapCoverage.cpp
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
/frameworks/minikin/libs/minikin/CmapCoverage.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
/frameworks/minikin/libs/minikin/CmapCoverage.cpp