blob: 3181017a2e5ab1694a677ad3d921ff34c1ac278c [file] [log] [blame]
Ying Wang46b20e72011-09-29 18:07:41 -07001# 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
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070020# Use full Noto Sans Japanese font on non-smaller footprints
Roozbeh Pournader52256202015-06-11 10:26:13 -070021ifneq ($(SMALLER_FONT_FOOTPRINT),true)
Roozbeh Pournader49455ab2015-05-12 16:00:55 -070022FONT_NOTOSANS_JP_FULL := true
23endif
24
Ying Wang8e359812011-10-06 11:14:13 -070025##########################################
Keun young Park08761012012-06-05 15:20:17 -070026# create symlink for given font
27# $(1): new font $(2): link target
28# should be used with eval: $(eval $(call ...))
29define create-font-symlink
30$(PRODUCT_OUT)/system/fonts/$(1) : $(PRODUCT_OUT)/system/fonts/$(2)
31 @echo "Symlink: $$@ -> $$<"
32 @mkdir -p $$(dir $$@)
33 @rm -rf $$@
34 $(hide) ln -sf $$(notdir $$<) $$@
35# this magic makes LOCAL_REQUIRED_MODULES work
36ALL_MODULES.$(1).INSTALLED := \
37 $(ALL_MODULES.$(1).INSTALLED) $(PRODUCT_OUT)/system/fonts/$(1)
38endef
39
40##########################################
Roozbeh Pournader52256202015-06-11 10:26:13 -070041# The following fonts are just symlinks, for backward compatibility.
Ying Wang8e359812011-10-06 11:14:13 -070042##########################################
Keun young Park08761012012-06-05 15:20:17 -070043$(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf))
44$(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf))
Victoria Leasea08f0f82014-05-12 16:05:52 -070045$(eval $(call create-font-symlink,DroidSerif-Regular.ttf,NotoSerif-Regular.ttf))
46$(eval $(call create-font-symlink,DroidSerif-Bold.ttf,NotoSerif-Bold.ttf))
47$(eval $(call create-font-symlink,DroidSerif-Italic.ttf,NotoSerif-Italic.ttf))
48$(eval $(call create-font-symlink,DroidSerif-BoldItalic.ttf,NotoSerif-BoldItalic.ttf))
Ying Wang8e359812011-10-06 11:14:13 -070049
Victoria Leasef99c12c2014-06-13 07:56:58 -070050extra_font_files := \
51 DroidSans.ttf \
52 DroidSans-Bold.ttf
53
Ying Wang8e359812011-10-06 11:14:13 -070054################################
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070055# Do not include Motoya on space-constrained devices
56ifneq ($(SMALLER_FONT_FOOTPRINT),true)
Roozbeh Pournader52256202015-06-11 10:26:13 -070057# Do not include Motoya if we are including Noto Sans Japanese
Roozbeh Pournader5f49c282015-04-29 15:38:07 -070058ifneq ($(FONT_NOTOSANS_JP_FULL),true)
Victoria Leasef99c12c2014-06-13 07:56:58 -070059
Ying Wang8e359812011-10-06 11:14:13 -070060include $(CLEAR_VARS)
Russell Brenner1c097a92012-03-28 09:45:27 -070061LOCAL_MODULE := MTLmr3m.ttf
62LOCAL_SRC_FILES := $(LOCAL_MODULE)
63LOCAL_MODULE_CLASS := ETC
64LOCAL_MODULE_TAGS := optional
65LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
66include $(BUILD_PREBUILT)
Victoria Leasef99c12c2014-06-13 07:56:58 -070067extra_font_files += MTLmr3m.ttf
Russell Brenner1c097a92012-03-28 09:45:27 -070068
Roozbeh Pournader5f49c282015-04-29 15:38:07 -070069endif # !FONT_NOTOSANS_JP_FULL
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070070endif # !SMALLER_FONT_FOOTPRINT
Ying Wang46b20e72011-09-29 18:07:41 -070071
Ying Wang193ec662012-02-13 18:55:41 -080072################################
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070073# Use DroidSansMono to hang extra_font_files on
74include $(CLEAR_VARS)
75LOCAL_MODULE := DroidSansMono.ttf
76LOCAL_SRC_FILES := $(LOCAL_MODULE)
77LOCAL_MODULE_CLASS := ETC
78LOCAL_MODULE_TAGS := optional
79LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
80LOCAL_REQUIRED_MODULES := $(extra_font_files)
81include $(BUILD_PREBUILT)
82extra_font_files :=
83
84################################
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070085# Include the DroidSansFallback subset on SMALLER_FONT_FOOTPRINT build
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070086ifeq ($(SMALLER_FONT_FOOTPRINT),true)
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070087
Ying Wang46b20e72011-09-29 18:07:41 -070088include $(CLEAR_VARS)
89LOCAL_MODULE := DroidSansFallback.ttf
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070090LOCAL_SRC_FILES := $(LOCAL_MODULE)
Ying Wang46b20e72011-09-29 18:07:41 -070091LOCAL_MODULE_CLASS := ETC
92LOCAL_MODULE_TAGS := optional
93LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
Ying Wang8e359812011-10-06 11:14:13 -070094include $(BUILD_PREBUILT)
Ying Wang46b20e72011-09-29 18:07:41 -070095droidsans_fallback_src :=
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070096
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070097endif # SMALLER_FONT_FOOTPRINT
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070098
Ying Wang193ec662012-02-13 18:55:41 -080099################################
Roozbeh Pournader32a65c72014-07-24 14:36:04 -0700100# Build the rest of font files as prebuilt.
Ying Wang193ec662012-02-13 18:55:41 -0800101
102# $(1): The source file name in LOCAL_PATH.
103# It also serves as the module name and the dest file name.
104define build-one-font-module
105$(eval include $(CLEAR_VARS))\
106$(eval LOCAL_MODULE := $(1))\
107$(eval LOCAL_SRC_FILES := $(1))\
108$(eval LOCAL_MODULE_CLASS := ETC)\
109$(eval LOCAL_MODULE_TAGS := optional)\
110$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\
111$(eval include $(BUILD_PREBUILT))
112endef
113
114font_src_files := \
Keun young Park08761012012-06-05 15:20:17 -0700115 Clockopia.ttf \
116 AndroidClock.ttf \
117 AndroidClock_Highlight.ttf \
118 AndroidClock_Solid.ttf
119
Ying Wang193ec662012-02-13 18:55:41 -0800120$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
121
122build-one-font-module :=
123font_src_files :=