Skip to content

Commit dedf1b2

Browse files
Russell BrennerAndroid (Google) Code Review
authored andcommitted
Merge "Add Japanese to fallback fonts"
2 parents 60e2487 + 1c097a9 commit dedf1b2

File tree

4 files changed

+128
-6
lines changed

4 files changed

+128
-6
lines changed

data/fonts/Android.mk

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
5454
# On space-constrained devices, we include a subset of fonts:
5555
ifeq ($(SMALLER_FONT_FOOTPRINT),true)
5656
droidsans_fallback_src := DroidSansFallback.ttf
57-
extra_droidsans_fonts := DroidSans.ttf DroidSans-Bold.ttf
57+
extra_font_files := DroidSans.ttf DroidSans-Bold.ttf
5858
else
5959
include $(CLEAR_VARS)
6060
LOCAL_MODULE := DroidSansEthiopic-Regular.ttf
@@ -64,8 +64,29 @@ LOCAL_MODULE_TAGS := optional
6464
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
6565
include $(BUILD_PREBUILT)
6666

67+
include $(CLEAR_VARS)
68+
LOCAL_MODULE := MTLmr3m.ttf
69+
LOCAL_SRC_FILES := $(LOCAL_MODULE)
70+
LOCAL_MODULE_CLASS := ETC
71+
LOCAL_MODULE_TAGS := optional
72+
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
73+
include $(BUILD_PREBUILT)
74+
75+
include $(CLEAR_VARS)
76+
LOCAL_MODULE := fallback_fonts-ja.xml
77+
LOCAL_SRC_FILES := $(LOCAL_MODULE)
78+
LOCAL_MODULE_CLASS := ETC
79+
LOCAL_MODULE_TAGS := optional
80+
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
81+
include $(BUILD_PREBUILT)
82+
6783
droidsans_fallback_src := DroidSansFallbackFull.ttf
68-
extra_droidsans_fonts := DroidSans.ttf DroidSans-Bold.ttf DroidSansEthiopic-Regular.ttf
84+
extra_font_files := \
85+
DroidSans.ttf \
86+
DroidSans-Bold.ttf \
87+
DroidSansEthiopic-Regular.ttf \
88+
MTLmr3m.ttf \
89+
fallback_fonts-ja.xml
6990
endif # SMALLER_FONT_FOOTPRINT
7091

7192
################################
@@ -75,13 +96,13 @@ LOCAL_SRC_FILES := $(droidsans_fallback_src)
7596
LOCAL_MODULE_CLASS := ETC
7697
LOCAL_MODULE_TAGS := optional
7798
LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
78-
LOCAL_REQUIRED_MODULES := $(extra_droidsans_fonts)
99+
LOCAL_REQUIRED_MODULES := $(extra_font_files)
79100
include $(BUILD_PREBUILT)
80101

81102
font_symlink_src :=
82103
font_symlink :=
83104
droidsans_fallback_src :=
84-
extra_droidsans_fonts :=
105+
extra_font_files :=
85106

86107
################################
87108
# Build the rest font files as prebuilt.

data/fonts/fallback_fonts-ja.xml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Fallback Fonts
4+
5+
This file specifies the fonts, and the priority order, that will be searched for any
6+
glyphs not handled by the default fonts specified in /system/etc/system_fonts.xml.
7+
Each entry consists of a family tag and a list of files (file names) which support that
8+
family. The fonts for each family are listed in the order of the styles that they
9+
handle (the order is: regular, bold, italic, and bold-italic). The order in which the
10+
families are listed in this file represents the order in which these fallback fonts
11+
will be searched for glyphs that are not supported by the default system fonts (which are
12+
found in /system/etc/system_fonts.xml).
13+
14+
Note that there is not nameset for fallback fonts, unlike the fonts specified in
15+
system_fonts.xml. The ability to support specific names in fallback fonts may be supported
16+
in the future. For now, the lack of files entries here is an indicator to the system that
17+
these are fallback fonts, instead of default named system fonts.
18+
19+
There is another optional file in /vendor/etc/fallback_fonts.xml. That file can be used to
20+
provide references to other font families that should be used in addition to the default
21+
fallback fonts. That file can also specify the order in which the fallback fonts should be
22+
searched, to ensure that a vendor-provided font will be used before another fallback font
23+
which happens to handle the same glyph.
24+
25+
Han languages (Chinese, Japanese, and Korean) share a common range of unicode characters;
26+
their ordering in the fallback or vendor files gives priority to the first in the list.
27+
Locale-specific ordering can be configured by adding language and region codes to the end
28+
of the filename (e.g. /system/etc/fallback_fonts-ja.xml). When no region code is used,
29+
as with this example, all regions are matched. Use separate files for each supported locale.
30+
The standard fallback file (fallback_fonts.xml) is used when a locale does not have its own
31+
file. All fallback files must contain the same complete set of fonts; only their ordering
32+
can differ.
33+
-->
34+
<familyset>
35+
<family>
36+
<fileset>
37+
<file>DroidSansArabic.ttf</file>
38+
</fileset>
39+
</family>
40+
<family>
41+
<fileset>
42+
<file>DroidSansEthiopic-Regular.ttf</file>
43+
</fileset>
44+
</family>
45+
<family>
46+
<fileset>
47+
<file>DroidSansHebrew-Regular.ttf</file>
48+
<file>DroidSansHebrew-Bold.ttf</file>
49+
</fileset>
50+
</family>
51+
<family>
52+
<fileset>
53+
<file>DroidSansThai.ttf</file>
54+
</fileset>
55+
</family>
56+
<family>
57+
<fileset>
58+
<file>DroidSansArmenian.ttf</file>
59+
</fileset>
60+
</family>
61+
<family>
62+
<fileset>
63+
<file>DroidSansGeorgian.ttf</file>
64+
</fileset>
65+
</family>
66+
<family>
67+
<fileset>
68+
<file>Lohit-Devanagari.ttf</file>
69+
</fileset>
70+
</family>
71+
<family>
72+
<fileset>
73+
<file>Lohit-Bengali.ttf</file>
74+
</fileset>
75+
</family>
76+
<family>
77+
<fileset>
78+
<file>Lohit-Tamil.ttf</file>
79+
</fileset>
80+
</family>
81+
<family>
82+
<fileset>
83+
<file>AndroidEmoji.ttf</file>
84+
</fileset>
85+
</family>
86+
<family>
87+
<fileset>
88+
<file>MTLmr3m.ttf</file>
89+
</fileset>
90+
</family>
91+
<family>
92+
<fileset>
93+
<file>DroidSansFallback.ttf</file>
94+
</fileset>
95+
</family>
96+
</familyset>

data/fonts/fallback_fonts.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,9 @@
8888
<file>DroidSansFallback.ttf</file>
8989
</fileset>
9090
</family>
91+
<family>
92+
<fileset>
93+
<file>MTLmr3m.ttf</file>
94+
</fileset>
95+
</family>
9196
</familyset>

data/fonts/fonts.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# Warning: this is actually a product definition, to be inherited from
1616

1717
PRODUCT_COPY_FILES := \
18-
frameworks/base/data/fonts/system_fonts.xml:system/etc/system_fonts.xml \
19-
frameworks/base/data/fonts/fallback_fonts.xml:system/etc/fallback_fonts.xml
18+
frameworks/base/data/fonts/system_fonts.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/system_fonts.xml \
19+
frameworks/base/data/fonts/fallback_fonts.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/fallback_fonts.xml
2020

2121
PRODUCT_PACKAGES := \
2222
DroidSansFallback.ttf \

0 commit comments

Comments
 (0)