diff options
author | Raph Levien <raph@google.com> | 2014-08-25 13:47:16 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2014-08-26 19:37:45 -0700 |
commit | 117cbebe810613d4a6de034f02652cdbbfef4cde (patch) | |
tree | 163e0944d265b23001c9644c570a04f47ae3b030 /data/fonts | |
parent | 0db4f35e0bbc25ee25ebe2d57174893217248597 (diff) | |
download | frameworks_base-117cbebe810613d4a6de034f02652cdbbfef4cde.zip frameworks_base-117cbebe810613d4a6de034f02652cdbbfef4cde.tar.gz frameworks_base-117cbebe810613d4a6de034f02652cdbbfef4cde.tar.bz2 |
New weight-aware font config
Parse new fonts.xml config file, and resolve weight selection based on
the base weight of the font (as defined by a weight alias specified in
the config file) and the requested bold flag. This change improves the
appearance of bold spans for alternate weights of Roboto.
In addition, this patch enables weight selection for fallback fonts.
For example, if an additional font with a weight of 100 is added to the
Hebrew font family in the fallback list, then requesting
"sans-serif-thin" would select that font for Hebrew text.
Bug: 14538154
Change-Id: I99a04fad4f7bf01c75726e760d42735dd9003496
Diffstat (limited to 'data/fonts')
-rw-r--r-- | data/fonts/fallback_fonts.xml | 4 | ||||
-rw-r--r-- | data/fonts/fonts.xml | 24 |
2 files changed, 26 insertions, 2 deletions
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml index 0f0281b..c4a949f 100644 --- a/data/fonts/fallback_fonts.xml +++ b/data/fonts/fallback_fonts.xml @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <!-- + NOTE: this file is the legacy format, for compatibility with apps. The new, + more flexible format is fonts.xml. Please keep the two in sync until the legacy + format can be fully removed. + Fallback Fonts This file specifies the fonts, and the priority order, that will be searched for any diff --git a/data/fonts/fonts.xml b/data/fonts/fonts.xml index a4d4906..04bc67a 100644 --- a/data/fonts/fonts.xml +++ b/data/fonts/fonts.xml @@ -1,4 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + NOTE: this is the newer (L) version of the system font configuration, + supporting richer weight selection. Some apps will expect the older + version, so please keep system_fonts.xml and fallback_fonts.xml in sync + with any changes, even though framework will only read this file. + + All fonts withohut names are added to the default list. Fonts are chosen + based on a match: full BCP-47 language tag including script, then just + language, and finally order (the first font containing the glyph). + + Order of appearance is also the tiebreaker for weight matching. This is + the reason why the 900 weights of Roboto precede the 700 weights - we + prefer the former when an 800 weight is requested. Since bold spans + effectively add 300 to the weight, this ensures that 900 is the bold + paired with the 500 weight, ensuring adequate contrast. +--> <familyset version="22"> <!-- first font is default --> <family name="sans-serif"> @@ -10,15 +26,16 @@ <font weight="400" style="italic">Roboto-Italic.ttf</font> <font weight="500" style="normal">Roboto-Medium.ttf</font> <font weight="500" style="italic">Roboto-MediumItalic.ttf</font> - <font weight="700" style="normal">Roboto-Bold.ttf</font> - <font weight="700" style="italic">Roboto-BoldItalic.ttf</font> <font weight="900" style="normal">Roboto-Black.ttf</font> <font weight="900" style="italic">Roboto-BlackItalic.ttf</font> + <font weight="700" style="normal">Roboto-Bold.ttf</font> + <font weight="700" style="italic">Roboto-BoldItalic.ttf</font> </family> <!-- Note that aliases must come after the fonts they reference. --> <alias name="sans-serif-thin" to="sans-serif" weight="100" /> <alias name="sans-serif-light" to="sans-serif" weight="300" /> + <alias name="sans-serif-medium" to="sans-serif" weight="500" /> <alias name="sans-serif-black" to="sans-serif" weight="900" /> <alias name="arial" to="sans-serif" /> <alias name="helvetica" to="sans-serif" /> @@ -227,6 +244,9 @@ <family> <font weight="400" style="normal">NotoColorEmoji.ttf</font> </family> + <family> + <font weight="400" style="normal">DroidSansFallback.ttf</font> + </family> <family lang="ja"> <font weight="400" style="normal">MTLmr3m.ttf</font> </family> |