1# Copyright (C) 2013 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
15NOTO_DIR := $(call my-dir)
16
17# Use full Noto Sans Japanese font on non-smaller footprints
18ifneq ($(SMALLER_FONT_FOOTPRINT),true)
19FONT_NOTOSANS_JP_FULL := true
20endif
21
22# We have to use BUILD_PREBUILT instead of PRODUCT_COPY_FILES,
23# to copy over the NOTICE file.
24#############################################################################
25# $(1): The source file name in LOCAL_PATH.
26#       It also serves as the module name and the dest file name.
27#############################################################################
28define build-one-font-module
29$(eval include $(CLEAR_VARS))\
30$(eval LOCAL_MODULE := $(1))\
31$(eval LOCAL_SRC_FILES := $(1))\
32$(eval LOCAL_MODULE_CLASS := ETC)\
33$(eval LOCAL_MODULE_TAGS := optional)\
34$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\
35$(eval include $(BUILD_PREBUILT))
36endef
37
38
39#############################################################################
40# First "build" the Noto CJK fonts, which have their own directory and
41# license. These are not included in SMALLER_FONT_FOOTPRINT builds.
42#############################################################################
43ifneq ($(SMALLER_FONT_FOOTPRINT),true)
44LOCAL_PATH := $(NOTO_DIR)/cjk
45
46font_src_files := \
47    NotoSansKR-Regular.otf \
48    NotoSansSC-Regular.otf \
49    NotoSansTC-Regular.otf
50
51$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
52font_src_files :=
53
54#############################################################################
55# Include NotoSansJP, or a subset.
56#############################################################################
57
58ifeq ($(FONT_NOTOSANS_JP_FULL),true)
59noto_sans_jp_src := NotoSansJP-Regular.otf
60else
61noto_sans_jp_src := NotoSansJP-Regular-Subsetted.otf
62endif # FONT_NOTOSANS_JP_FULL
63
64include $(CLEAR_VARS)
65LOCAL_MODULE := NotoSansJP-Regular.otf
66LOCAL_SRC_FILES := $(noto_sans_jp_src)
67LOCAL_MODULE_CLASS := ETC
68LOCAL_MODULE_TAGS := optional
69LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
70include $(BUILD_PREBUILT)
71
72noto_sans_jp_src :=
73endif # !SMALLER_FONT_FOOTPRINT
74
75
76#############################################################################
77# Now "build" the rest of the fonts, which live in a separate subdirectory.
78#############################################################################
79LOCAL_PATH := $(NOTO_DIR)/other
80NOTO_DIR :=
81
82#############################################################################
83# The following fonts are included in all builds.
84#############################################################################
85font_src_files := \
86    NotoSerif-Regular.ttf \
87    NotoSerif-Bold.ttf \
88    NotoSerif-Italic.ttf \
89    NotoSerif-BoldItalic.ttf
90
91#############################################################################
92# The following fonts are excluded from SMALLER_FONT_FOOTPRINT builds.
93#############################################################################
94ifneq ($(SMALLER_FONT_FOOTPRINT),true)
95font_src_files += \
96    NotoColorEmoji.ttf \
97    NotoSansBalinese-Regular.ttf \
98    NotoSansBamum-Regular.ttf \
99    NotoSansBatak-Regular.ttf \
100    NotoSansBengali-Regular.ttf \
101    NotoSansBengali-Bold.ttf \
102    NotoSansBengaliUI-Regular.ttf \
103    NotoSansBengaliUI-Bold.ttf \
104    NotoSansBuginese-Regular.ttf \
105    NotoSansBuhid-Regular.ttf \
106    NotoSansCanadianAboriginal-Regular.ttf \
107    NotoSansCham-Regular.ttf \
108    NotoSansCham-Bold.ttf \
109    NotoSansCherokee-Regular.ttf \
110    NotoSansCoptic-Regular.ttf \
111    NotoSansDevanagari-Regular.ttf \
112    NotoSansDevanagari-Bold.ttf \
113    NotoSansDevanagariUI-Regular.ttf \
114    NotoSansDevanagariUI-Bold.ttf \
115    NotoSansEthiopic-Regular.ttf \
116    NotoSansEthiopic-Bold.ttf \
117    NotoSansGlagolitic-Regular.ttf \
118    NotoSansGujarati-Regular.ttf \
119    NotoSansGujarati-Bold.ttf \
120    NotoSansGujaratiUI-Regular.ttf \
121    NotoSansGujaratiUI-Bold.ttf \
122    NotoSansGurmukhi-Regular.ttf \
123    NotoSansGurmukhi-Bold.ttf \
124    NotoSansGurmukhiUI-Regular.ttf \
125    NotoSansGurmukhiUI-Bold.ttf \
126    NotoSansHanunoo-Regular.ttf \
127    NotoSansJavanese-Regular.ttf \
128    NotoSansKannada-Regular.ttf \
129    NotoSansKannada-Bold.ttf \
130    NotoSansKannadaUI-Regular.ttf \
131    NotoSansKannadaUI-Bold.ttf \
132    NotoSansKayahLi-Regular.ttf \
133    NotoSansKhmer-Regular.ttf \
134    NotoSansKhmer-Bold.ttf \
135    NotoSansKhmerUI-Regular.ttf \
136    NotoSansKhmerUI-Bold.ttf \
137    NotoSansLao-Regular.ttf \
138    NotoSansLao-Bold.ttf \
139    NotoSansLaoUI-Regular.ttf \
140    NotoSansLaoUI-Bold.ttf \
141    NotoSansLepcha-Regular.ttf \
142    NotoSansLimbu-Regular.ttf \
143    NotoSansLisu-Regular.ttf \
144    NotoSansMalayalam-Regular.ttf \
145    NotoSansMalayalam-Bold.ttf \
146    NotoSansMalayalamUI-Regular.ttf \
147    NotoSansMalayalamUI-Bold.ttf \
148    NotoSansMandaic-Regular.ttf \
149    NotoSansMeeteiMayek-Regular.ttf \
150    NotoSansMongolian-Regular.ttf \
151    NotoSansMyanmar-Regular.ttf \
152    NotoSansMyanmar-Bold.ttf \
153    NotoSansMyanmarUI-Regular.ttf \
154    NotoSansMyanmarUI-Bold.ttf \
155    NotoSansNewTaiLue-Regular.ttf \
156    NotoSansNKo-Regular.ttf \
157    NotoSansOlChiki-Regular.ttf \
158    NotoSansOriya-Regular.ttf \
159    NotoSansOriya-Bold.ttf \
160    NotoSansOriyaUI-Regular.ttf \
161    NotoSansOriyaUI-Bold.ttf \
162    NotoSansRejang-Regular.ttf \
163    NotoSansSaurashtra-Regular.ttf \
164    NotoSansSinhala-Regular.ttf \
165    NotoSansSinhala-Bold.ttf \
166    NotoSansSundanese-Regular.ttf \
167    NotoSansSylotiNagri-Regular.ttf \
168    NotoSansSyriacEstrangela-Regular.ttf \
169    NotoSansTagbanwa-Regular.ttf \
170    NotoSansTaiLe-Regular.ttf \
171    NotoSansTaiTham-Regular.ttf \
172    NotoSansTaiViet-Regular.ttf \
173    NotoSansTamil-Regular.ttf \
174    NotoSansTamil-Bold.ttf \
175    NotoSansTamilUI-Regular.ttf \
176    NotoSansTamilUI-Bold.ttf \
177    NotoSansTelugu-Regular.ttf \
178    NotoSansTelugu-Bold.ttf \
179    NotoSansTeluguUI-Regular.ttf \
180    NotoSansTeluguUI-Bold.ttf \
181    NotoSansThaana-Regular.ttf \
182    NotoSansThaana-Bold.ttf \
183    NotoSansThai-Regular.ttf \
184    NotoSansThai-Bold.ttf \
185    NotoSansThaiUI-Regular.ttf \
186    NotoSansThaiUI-Bold.ttf \
187    NotoSansTibetan-Regular.ttf \
188    NotoSansTifinagh-Regular.ttf \
189    NotoSansVai-Regular.ttf \
190    NotoSansYi-Regular.ttf
191endif # !SMALLER_FONT_FOOTPRINT
192
193#############################################################################
194# The following fonts are excluded from MINIMAL_FONT_FOOTPRINT builds.
195#############################################################################
196ifneq ($(MINIMAL_FONT_FOOTPRINT),true)
197font_src_files += \
198    NotoNaskhArabic-Regular.ttf \
199    NotoNaskhArabic-Bold.ttf \
200    NotoNaskhArabicUI-Regular.ttf \
201    NotoNaskhArabicUI-Bold.ttf \
202    NotoSansArmenian-Regular.ttf \
203    NotoSansArmenian-Bold.ttf \
204    NotoSansGeorgian-Regular.ttf \
205    NotoSansGeorgian-Bold.ttf \
206    NotoSansHebrew-Regular.ttf \
207    NotoSansHebrew-Bold.ttf \
208    NotoSansSymbols-Regular-Subsetted.ttf
209endif # !MINIMAL_FONT_FOOTPRINT
210
211$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
212build-one-font-module :=
213font_src_files :=
214