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# create symlink for given font 22# $(1): new font $(2): link target 23# should be used with eval: $(eval $(call ...)) 24define create-font-symlink 25$(PRODUCT_OUT)/system/fonts/$(1) : $(PRODUCT_OUT)/system/fonts/$(2) 26 @echo "Symlink: $$@ -> $$<" 27 @mkdir -p $$(dir $$@) 28 @rm -rf $$@ 29 $(hide) ln -sf $$(notdir $$<) $$@ 30# this magic makes LOCAL_REQUIRED_MODULES work 31ALL_MODULES.$(1).INSTALLED := \ 32 $(ALL_MODULES.$(1).INSTALLED) $(PRODUCT_OUT)/system/fonts/$(1) 33endef 34 35########################################## 36# We may only afford small font footprint. 37########################################## 38$(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf)) 39$(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf)) 40 41################################ 42# On space-constrained devices, we include a subset of fonts: 43ifeq ($(SMALLER_FONT_FOOTPRINT),true) 44droidsans_fallback_src := DroidSansFallback.ttf 45extra_font_files := DroidSans.ttf DroidSans-Bold.ttf 46else 47include $(CLEAR_VARS) 48LOCAL_MODULE := DroidSansEthiopic-Regular.ttf 49LOCAL_SRC_FILES := $(LOCAL_MODULE) 50LOCAL_MODULE_CLASS := ETC 51LOCAL_MODULE_TAGS := optional 52LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 53include $(BUILD_PREBUILT) 54 55include $(CLEAR_VARS) 56LOCAL_MODULE := DroidSansTamil-Regular.ttf 57LOCAL_SRC_FILES := $(LOCAL_MODULE) 58LOCAL_MODULE_CLASS := ETC 59LOCAL_MODULE_TAGS := optional 60LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 61include $(BUILD_PREBUILT) 62 63include $(CLEAR_VARS) 64LOCAL_MODULE := DroidSansTamil-Bold.ttf 65LOCAL_SRC_FILES := $(LOCAL_MODULE) 66LOCAL_MODULE_CLASS := ETC 67LOCAL_MODULE_TAGS := optional 68LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 69include $(BUILD_PREBUILT) 70 71include $(CLEAR_VARS) 72LOCAL_MODULE := MTLmr3m.ttf 73LOCAL_SRC_FILES := $(LOCAL_MODULE) 74LOCAL_MODULE_CLASS := ETC 75LOCAL_MODULE_TAGS := optional 76LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 77include $(BUILD_PREBUILT) 78 79include $(CLEAR_VARS) 80LOCAL_MODULE := fallback_fonts-ja.xml 81LOCAL_SRC_FILES := $(LOCAL_MODULE) 82LOCAL_MODULE_CLASS := ETC 83LOCAL_MODULE_TAGS := optional 84LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) 85include $(BUILD_PREBUILT) 86 87droidsans_fallback_src := DroidSansFallbackFull.ttf 88extra_font_files := \ 89 DroidSans.ttf \ 90 DroidSans-Bold.ttf \ 91 DroidSansEthiopic-Regular.ttf \ 92 DroidSansTamil-Regular.ttf \ 93 DroidSansTamil-Bold.ttf \ 94 MTLmr3m.ttf \ 95 fallback_fonts-ja.xml 96endif # SMALLER_FONT_FOOTPRINT 97 98################################ 99include $(CLEAR_VARS) 100LOCAL_MODULE := DroidSansFallback.ttf 101LOCAL_SRC_FILES := $(droidsans_fallback_src) 102LOCAL_MODULE_CLASS := ETC 103LOCAL_MODULE_TAGS := optional 104LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 105LOCAL_REQUIRED_MODULES := $(extra_font_files) 106include $(BUILD_PREBUILT) 107 108font_symlink_src := 109font_symlink := 110droidsans_fallback_src := 111extra_font_files := 112################################ 113# Build the rest font files as prebuilt. 114 115# $(1): The source file name in LOCAL_PATH. 116# It also serves as the module name and the dest file name. 117define build-one-font-module 118$(eval include $(CLEAR_VARS))\ 119$(eval LOCAL_MODULE := $(1))\ 120$(eval LOCAL_SRC_FILES := $(1))\ 121$(eval LOCAL_MODULE_CLASS := ETC)\ 122$(eval LOCAL_MODULE_TAGS := optional)\ 123$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\ 124$(eval include $(BUILD_PREBUILT)) 125endef 126 127font_src_files := \ 128 Roboto-Regular.ttf \ 129 Roboto-Bold.ttf \ 130 Roboto-Italic.ttf \ 131 Roboto-BoldItalic.ttf \ 132 DroidSerif-Regular.ttf \ 133 DroidSerif-Bold.ttf \ 134 DroidSerif-Italic.ttf \ 135 DroidSerif-BoldItalic.ttf \ 136 DroidSansMono.ttf \ 137 Clockopia.ttf \ 138 AndroidClock.ttf \ 139 AndroidClock_Highlight.ttf \ 140 AndroidClock_Solid.ttf 141 142ifeq ($(MINIMAL_FONT_FOOTPRINT),true) 143 144$(eval $(call create-font-symlink,Roboto-Light.ttf,Roboto-Regular.ttf)) 145$(eval $(call create-font-symlink,Roboto-LightItalic.ttf,Roboto-Italic.ttf)) 146$(eval $(call create-font-symlink,RobotoCondensed-Regular.ttf,Roboto-Regular.ttf)) 147$(eval $(call create-font-symlink,RobotoCondensed-Bold.ttf,Roboto-Bold.ttf)) 148$(eval $(call create-font-symlink,RobotoCondensed-Italic.ttf,Roboto-Italic.ttf)) 149$(eval $(call create-font-symlink,RobotoCondensed-BoldItalic.ttf,Roboto-BoldItalic.ttf)) 150 151else # !MINIMAL_FONT 152font_src_files += \ 153 Roboto-Light.ttf \ 154 Roboto-LightItalic.ttf \ 155 RobotoCondensed-Regular.ttf \ 156 RobotoCondensed-Bold.ttf \ 157 RobotoCondensed-Italic.ttf \ 158 RobotoCondensed-BoldItalic.ttf \ 159 DroidNaskh-Regular.ttf \ 160 DroidNaskh-Regular-SystemUI.ttf \ 161 DroidSansDevanagari-Regular.ttf \ 162 DroidSansHebrew-Regular.ttf \ 163 DroidSansHebrew-Bold.ttf \ 164 DroidSansThai.ttf \ 165 DroidSansArmenian.ttf \ 166 DroidSansGeorgian.ttf \ 167 AndroidEmoji.ttf 168 169endif # !MINIMAL_FONT 170 171$(foreach f, $(font_src_files), $(call build-one-font-module, $(f))) 172 173build-one-font-module := 174font_src_files := 175