From 6f9966ea7c1910fd780cf7779cc59701c9b98a2b Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Fri, 11 Dec 2015 17:58:03 -0800 Subject: Introduce multiple language based font fallback. The motivation of this CL is enhance the font fallback score design to support multiple language font fallback. This CL contains following changes: - Break language based font score into two: script-based score and primary-language-based score. - The primary-language-based score is 0 if the script-based score is 0. If the script-based score is not 0 and the primary language is the as same as the requested one, the font gets an extra score of 1. - The language score gets a higher multiplier for languages higher in the locale list. Bug: 25122318 Bug: 26168983 Change-Id: Ib999997a88e6977e341f4c325e2a1b41a59db2d5 --- include/minikin/FontCollection.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/minikin/FontCollection.h b/include/minikin/FontCollection.h index cd14261..294692f 100644 --- a/include/minikin/FontCollection.h +++ b/include/minikin/FontCollection.h @@ -67,6 +67,16 @@ private: FontFamily* getFamilyForChar(uint32_t ch, uint32_t vs, uint32_t langListId, int variant) const; + uint32_t calcFamilyScore(uint32_t ch, uint32_t vs, int variant, uint32_t langListId, + FontFamily* fontFamily) const; + + uint32_t calcCoverageScore(uint32_t ch, uint32_t vs, FontFamily* fontFamily) const; + + static uint32_t calcLanguageMatchingScore(uint32_t userLangListId, + const FontFamily& fontFamily); + + static uint32_t calcVariantMatchingScore(int variant, const FontFamily& fontFamily); + // static for allocating unique id's static uint32_t sNextId; -- cgit v1.2.3