6 Commits

Author SHA1 Message Date
Seigo Nonaka
f3afe92def 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
2016-04-04 22:31:16 +09:00
Seigo Nonaka
2342e5310f Fix lock assertion failures in unit test.
The assertion for the lock state has now activated by
I9c4b1e1f09c6793e387fbdb8bb654cc0a13c65d5.
This CL fixes the assertion failure in the unit tests by acquiring
lock before calling the functions.

Change-Id: I6a6afefb4de01e8610c2abfe6c779afa9442cc67
2016-01-06 22:49:33 +09:00
Seigo Nonaka
198b46f1fe 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
2016-01-05 14:00:32 +09:00
Bart Sears
6c4c098cbd Revert "Save all kind of script tags into FontLanguage."
This reverts commit 5e995fb850c2b32631914c3815dfb421855fba9b.

Change-Id: I761e0e41906742fbe3d3ac34170af3101e18042a
2015-12-22 09:06:03 +00:00
Seigo Nonaka
5e995fb850 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
2015-12-22 09:34:04 +09:00
Seigo Nonaka
6d9dcd2cf3 Introduce FontLanguageListCache.
FontLanguageListCache is an intentionally leaky singleton and its
internal cache won't be purged.

BUG: 25122318

Change-Id: I272097e979fe44b83fd86822235350e12eda8f51
2015-12-08 18:49:18 -08:00