Android.mk revision 467ea516175f5dfa52c4b9900d24e6b0062721d1
1# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# We have to use BUILD_PREBUILT instead of PRODUCT_COPY_FIES,
16# because SMALLER_FONT_FOOTPRINT is only available in Android.mks.
17
18LOCAL_PATH := $(call my-dir)
19
20##########################################
21# We may only afford small font footprint.
22##########################################
23# Use only symlinks.
24# Symlink: DroidSans.ttf -> Roboto-Regular.ttf
25LOCAL_MODULE := DroidSans.ttf
26font_symlink_src := $(PRODUCT_OUT)/system/fonts/Roboto-Regular.ttf
27font_symlink := $(dir $(font_symlink_src))$(LOCAL_MODULE)
28$(font_symlink) : $(font_symlink_src)
29	@echo "Symlink: $@ -> $<"
30	@mkdir -p $(dir $@)
31	@rm -rf $@
32	$(hide) ln -sf $(notdir $<) $@
33
34# this magic makes LOCAL_REQUIRED_MODULES work
35ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
36    $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(font_symlink)
37
38################################
39# Symlink: DroidSans-Bold.ttf -> Roboto-Bold.ttf
40LOCAL_MODULE := DroidSans-Bold.ttf
41font_symlink_src := $(PRODUCT_OUT)/system/fonts/Roboto-Bold.ttf
42font_symlink := $(dir $(font_symlink_src))$(LOCAL_MODULE)
43$(font_symlink) : $(font_symlink_src)
44	@echo "Symlink: $@ -> $<"
45	@mkdir -p $(dir $@)
46	@rm -rf $@
47	$(hide) ln -sf $(notdir $<) $@
48
49# this magic makes LOCAL_REQUIRED_MODULES work
50ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
51    $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(font_symlink)
52
53################################
54# On space-constrained devices, we include a subset of fonts:
55ifeq ($(SMALLER_FONT_FOOTPRINT),true)
56droidsans_fallback_src := DroidSansFallback.ttf
57extra_font_files := DroidSans.ttf DroidSans-Bold.ttf
58else
59include $(CLEAR_VARS)
60LOCAL_MODULE := DroidSansEthiopic-Regular.ttf
61LOCAL_SRC_FILES := $(LOCAL_MODULE)
62LOCAL_MODULE_CLASS := ETC
63LOCAL_MODULE_TAGS := optional
64LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
65include $(BUILD_PREBUILT)
66
67include $(CLEAR_VARS)
68LOCAL_MODULE := DroidSansTamil-Regular.ttf
69LOCAL_SRC_FILES := $(LOCAL_MODULE)
70LOCAL_MODULE_CLASS := ETC
71LOCAL_MODULE_TAGS := optional
72LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
73include $(BUILD_PREBUILT)
74
75include $(CLEAR_VARS)
76LOCAL_MODULE := DroidSansTamil-Bold.ttf
77LOCAL_SRC_FILES := $(LOCAL_MODULE)
78LOCAL_MODULE_CLASS := ETC
79LOCAL_MODULE_TAGS := optional
80LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
81include $(BUILD_PREBUILT)
82
83include $(CLEAR_VARS)
84LOCAL_MODULE := MTLmr3m.ttf
85LOCAL_SRC_FILES := $(LOCAL_MODULE)
86LOCAL_MODULE_CLASS := ETC
87LOCAL_MODULE_TAGS := optional
88LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
89include $(BUILD_PREBUILT)
90
91include $(CLEAR_VARS)
92LOCAL_MODULE := fallback_fonts-ja.xml
93LOCAL_SRC_FILES := $(LOCAL_MODULE)
94LOCAL_MODULE_CLASS := ETC
95LOCAL_MODULE_TAGS := optional
96LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
97include $(BUILD_PREBUILT)
98
99droidsans_fallback_src := DroidSansFallbackFull.ttf
100extra_font_files := \
101	DroidSans.ttf \
102	DroidSans-Bold.ttf \
103	DroidSansEthiopic-Regular.ttf \
104	DroidSansTamil-Regular.ttf \
105	DroidSansTamil-Bold.ttf \
106	MTLmr3m.ttf \
107	fallback_fonts-ja.xml
108endif  # SMALLER_FONT_FOOTPRINT
109
110################################
111include $(CLEAR_VARS)
112LOCAL_MODULE := DroidSansFallback.ttf
113LOCAL_SRC_FILES := $(droidsans_fallback_src)
114LOCAL_MODULE_CLASS := ETC
115LOCAL_MODULE_TAGS := optional
116LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
117LOCAL_REQUIRED_MODULES := $(extra_font_files)
118include $(BUILD_PREBUILT)
119
120font_symlink_src :=
121font_symlink :=
122droidsans_fallback_src :=
123extra_font_files :=
124
125################################
126# Build the rest font files as prebuilt.
127
128# $(1): The source file name in LOCAL_PATH.
129#       It also serves as the module name and the dest file name.
130define build-one-font-module
131$(eval include $(CLEAR_VARS))\
132$(eval LOCAL_MODULE := $(1))\
133$(eval LOCAL_SRC_FILES := $(1))\
134$(eval LOCAL_MODULE_CLASS := ETC)\
135$(eval LOCAL_MODULE_TAGS := optional)\
136$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\
137$(eval include $(BUILD_PREBUILT))
138endef
139
140font_src_files := \
141    Roboto-Regular.ttf \
142    Roboto-Bold.ttf \
143    Roboto-Italic.ttf \
144    Roboto-BoldItalic.ttf \
145    Roboto-Light.ttf \
146    Roboto-LightItalic.ttf \
147    RobotoCondensed-Regular.ttf \
148    RobotoCondensed-Bold.ttf \
149    RobotoCondensed-Italic.ttf \
150    RobotoCondensed-BoldItalic.ttf \
151    DroidNaskh-Regular.ttf \
152    DroidNaskh-Regular-SystemUI.ttf \
153    DroidSansDevanagari-Regular.ttf \
154    DroidSansHebrew-Regular.ttf \
155    DroidSansHebrew-Bold.ttf \
156    DroidSansThai.ttf \
157    DroidSerif-Regular.ttf \
158    DroidSerif-Bold.ttf \
159    DroidSerif-Italic.ttf \
160    DroidSerif-BoldItalic.ttf \
161    DroidSansMono.ttf \
162    DroidSansArmenian.ttf \
163    DroidSansGeorgian.ttf \
164    AndroidEmoji.ttf \
165    Clockopia.ttf \
166    AndroidClock.ttf \
167    AndroidClock_Highlight.ttf \
168    AndroidClock_Solid.ttf \
169
170$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
171
172build-one-font-module :=
173font_src_files :=
174