OSDN Git Service

Implement family fallback.
authorSeigo Nonaka <nona@google.com>
Fri, 30 Jun 2017 00:50:33 +0000 (17:50 -0700)
committerSeigo Nonaka <nona@google.com>
Thu, 13 Jul 2017 17:47:48 +0000 (10:47 -0700)
commit0d253e46aa0b4cb2ea56e220812aeab92de64ae1
tree790b3171f79c25b3be1878d0e2070be84a84fb4e
parentab78a4707b276a58c758e5a7122a21d75403497b
Implement family fallback.

Introduce new attribute "fallbackFor" to font element.
By specifying name of the family to this attribute, that font is used
when the developer specifies the font family.
For example, if fonts.xml has the following family entry,
  <family lang="ja">
    <font fallbackFor="serif">NotoSerifJP-Regular.ttf</font>
    <font>NotoSansJP-Regular.ttf</font>
  </family>
the Japanese text is rendered by NotoSansJP-Regular.ttf by default.
Then, if developer specifies fontFamily="serif" in TextView, the Japanese
text is rendered by NotoSerifJP-Regular.ttf.

Bug: 37328609
Bug: 31491668
Test: bit FrameworksCoreTests:android.graphics.TypefaceSystemFallbackTest

Change-Id: I2744db7384c8056795e841c88b387545434131f4
15 files changed:
core/java/android/text/FontConfig.java
core/tests/coretests/assets/fonts/a3em.ttf [new file with mode: 0644]
core/tests/coretests/assets/fonts/a3em.ttx [new file with mode: 0644]
core/tests/coretests/assets/fonts/all2em.ttf [new file with mode: 0644]
core/tests/coretests/assets/fonts/all2em.ttx [new file with mode: 0644]
core/tests/coretests/assets/fonts/b3em.ttf [new file with mode: 0644]
core/tests/coretests/assets/fonts/b3em.ttx [new file with mode: 0644]
core/tests/coretests/assets/fonts/c3em.ttf [new file with mode: 0644]
core/tests/coretests/assets/fonts/c3em.ttx [new file with mode: 0644]
core/tests/coretests/assets/fonts/no_coverage.ttf [new file with mode: 0644]
core/tests/coretests/assets/fonts/no_coverage.ttx [new file with mode: 0644]
core/tests/coretests/src/android/graphics/TypefaceSystemFallbackTest.java [new file with mode: 0644]
graphics/java/android/graphics/FontListParser.java
graphics/java/android/graphics/Typeface.java
libs/hwui/hwui/Typeface.cpp