summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-07-06 11:17:26 -0700
committerChet Haase <chet@google.com>2011-07-15 12:06:35 -0700
commitc8f060c93854883d5d7a825b11b18c7f4e76e2b0 (patch)
tree8fd2e9ce1667660cc8f22b532e7cb69752e7c64c /data
parent649a1418d96e80ed384e7e30732d4e2aa5928585 (diff)
downloadframeworks_base-c8f060c93854883d5d7a825b11b18c7f4e76e2b0.zip
frameworks_base-c8f060c93854883d5d7a825b11b18c7f4e76e2b0.tar.gz
frameworks_base-c8f060c93854883d5d7a825b11b18c7f4e76e2b0.tar.bz2
Read font info from system config files
This change adds new files in /system/etc: system_fonts.xml and fallback_fonts.xml. The change also allows a third file to be added by vendors in /vendor/etc/fallback_fonts.xml. These files, loaded at boot time, mimic the logic that used to be in code, but which is now configurable through editing these files, making the system more flexible and easy to work with for us and vendors as future fonts are added to the system. Change-Id: I209f1ef08a5279b376b89a880241906387efd576
Diffstat (limited to 'data')
-rw-r--r--data/fonts/fallback_fonts.xml47
-rw-r--r--data/fonts/fonts.mk4
-rw-r--r--data/fonts/system_fonts.xml68
-rw-r--r--data/fonts/vendor_fonts.xml51
4 files changed, 169 insertions, 1 deletions
diff --git a/data/fonts/fallback_fonts.xml b/data/fonts/fallback_fonts.xml
new file mode 100644
index 0000000..c0d9153
--- /dev/null
+++ b/data/fonts/fallback_fonts.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Fallback Fonts
+
+ This file specifies the fonts, and the priority order, that will be searched for any
+ glyphs not handled by the default fonts specified in /system/etc/system_fonts.xml.
+ Each entry consists of a family tag and a list of files (file names) which support that
+ family. The fonts for each family are listed in the order of the styles that they
+ handle (the order is: regular, bold, italic, and bold-italic). The order in which the
+ families are listed in this file represents the order in which these fallback fonts
+ will be searched for glyphs that are not supported by the default system fonts (which are
+ found in /system/etc/system_fonts.xml).
+
+ Note that there is not nameset for fallback fonts, unlike the fonts specified in
+ system_fonts.xml. The ability to support specific names in fallback fonts may be supported
+ in the future. For now, the lack of files entries here is an indicator to the system that
+ these are fallback fonts, instead of default named system fonts.
+
+ There is another optional file in /vendor/etc/fallback_fonts.xml. That file can be used to
+ provide references to other font families that should be used in addition to the default
+ fallback fonts. That file can also specify the order in which the fallback fonts should be
+ searched, to ensure that a vendor-provided font will be used before another fallback font
+ which happens to handle the same glyph.
+-->
+<familyset>
+ <family>
+ <fileset>
+ <file>DroidSansArabic.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansHebrew-Regular.ttf</file>
+ <file>DroidSansHebrew-Bold.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansThai.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>DroidSansFallback.ttf</file>
+ </fileset>
+ </family>
+</familyset>
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index d222c0b..57a1bab 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -30,4 +30,6 @@ PRODUCT_COPY_FILES := \
frameworks/base/data/fonts/DroidSansFallback.ttf:system/fonts/DroidSansFallback.ttf \
frameworks/base/data/fonts/AndroidClock.ttf:system/fonts/AndroidClock.ttf \
frameworks/base/data/fonts/AndroidClock_Highlight.ttf:system/fonts/AndroidClock_Highlight.ttf \
- frameworks/base/data/fonts/AndroidClock_Solid.ttf:system/fonts/AndroidClock_Solid.ttf
+ frameworks/base/data/fonts/AndroidClock_Solid.ttf:system/fonts/AndroidClock_Solid.ttf \
+ frameworks/base/data/fonts/system_fonts.xml:system/etc/system_fonts.xml \
+ frameworks/base/data/fonts/fallback_fonts.xml:system/etc/fallback_fonts.xml
diff --git a/data/fonts/system_fonts.xml b/data/fonts/system_fonts.xml
new file mode 100644
index 0000000..8d8d020
--- /dev/null
+++ b/data/fonts/system_fonts.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ System Fonts
+
+ This file lists the font families that will be used by default for all supported glyphs.
+ Each entry consists of a family, various names that are supported by that family, and
+ up to four font files. The font files are listed in the order of the styles which they
+ support: regular, bold, italic and bold-italic. If less than four styles are listed, then
+ the styles with no associated font file will be supported by the other font files listed.
+
+ The first family is also the default font, which handles font request that have not specified
+ specific font names.
+
+ Any glyph that is not handled by the system fonts will cause a search of the fallback fonts.
+ The default fallback fonts are specified in the file /system/etc/fallback_fonts.xml, and there
+ is an optional file which may be supplied by vendors to specify other fallback fonts to use
+ in /vendor/etc/fallback_fonts.xml.
+-->
+<familyset>
+
+ <family>
+ <nameset>
+ <name>sans-serif</name>
+ <name>arial</name>
+ <name>helvetica</name>
+ <name>tahoma</name>
+ <name>verdana</name>
+ </nameset>
+ <fileset>
+ <file>DroidSans.ttf</file>
+ <file>DroidSans-Bold.ttf</file>
+ </fileset>
+ </family>
+
+ <family>
+ <nameset>
+ <name>serif</name>
+ <name>times</name>
+ <name>times new roman</name>
+ <name>palatino</name>
+ <name>georgia</name>
+ <name>baskerville</name>
+ <name>goudy</name>
+ <name>fantasy</name>
+ <name>cursive</name>
+ <name>ITC Stone Serif</name>
+ </nameset>
+ <fileset>
+ <file>DroidSerif-Regular.ttf</file>
+ <file>DroidSerif-Bold.ttf</file>
+ <file>DroidSerif-Italic.ttf</file>
+ <file>DroidSerif-BoldItalic.ttf</file>
+ </fileset>
+ </family>
+
+ <family>
+ <nameset>
+ <name>monospace</name>
+ <name>courier</name>
+ <name>courier new</name>
+ <name>monaco</name>
+ </nameset>
+ <fileset>
+ <file>DroidSansMono.ttf</file>
+ </fileset>
+ </family>
+
+</familyset>
diff --git a/data/fonts/vendor_fonts.xml b/data/fonts/vendor_fonts.xml
new file mode 100644
index 0000000..fe51fd2
--- /dev/null
+++ b/data/fonts/vendor_fonts.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Vendor-provided fallback fonts
+
+ This file can be edited to add references to fonts that are not installed or referenced in the
+ default system. The file should then be placed in /vendor/etc/fallback_fonts.xml.
+
+ For example, vendors might want to build configurations for locales that are
+ better served by fonts which either handle glyphs not supported in the default fonts or which
+ handle these glyphs differently than the default fallback fonts.
+ Each entry in this list is a "family", which consists of a list of "files"
+ (the filenames for that family). The files objects are
+ provided in the order of the styles supported for that family: regular, bold, italic, and
+ bold-italic. Only providing one font means that all styles will be rendered with that font.
+ Providing two means that these two fonts will render regular and bold fonts (italics will
+ be mapped to these two fonts).
+
+ There is also an optional "order" attribute on the Family tag. This specifies the index at
+ which that family of fonts should be inserted in the fallback font list, where the
+ default fallback fonts on the system (in /system/etc/fallback_fonts.xml) start at index 0.
+ If no 'order' attribute is supplied, that family will be inserted either at the end of the
+ current fallback list (if no order was supplied for any previous family in this file) or
+ after the previous family (if there was an order specified previously). Typically, vendors
+ may want to supply an order for the first family that puts this set of fonts at the appropriate
+ place in the overall fallback fonts. The order of this list determines which fallback font
+ will be used to support any glyphs that are not handled by the default system fonts.
+
+ The sample configuration below is an example of how one might provide two families of fonts
+ that get inserted at the first and second (0 and 1) position in the overall fallback fonts.
+
+ See /system/etc/system_fonts.xml and /system/etc/fallback_fonts.xml for more information
+ and to understand the order in which the default system fonts are loaded and structured for
+ lookup.
+-->
+
+<!-- Sample fallback font additions to the default fallback list. These fonts will be added
+ to the top two positions of the fallback list, since the first has an order of 0. -->
+<!--
+<familyset>
+ <family order="0">
+ <fileset>
+ <file>MyFont.ttf</file>
+ </fileset>
+ </family>
+ <family>
+ <fileset>
+ <file>MyOtherFont.ttf</file>
+ </fileset>
+ </family>
+</familyset>
+--> \ No newline at end of file