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 18 LOCAL_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 ...)) 24 define 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 31 ALL_MODULES.$(1).INSTALLED := \ 32 $(ALL_MODULES.$(1).INSTALLED) $(PRODUCT_OUT)/system/fonts/$(1) 33 endef 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: 43 ifeq ($(SMALLER_FONT_FOOTPRINT),true) 44 droidsans_fallback_src := DroidSansFallback.ttf 45 extra_font_files := DroidSans.ttf DroidSans-Bold.ttf 46 else 47 include $(CLEAR_VARS) 48 LOCAL_MODULE := DroidSansEthiopic-Regular.ttf 49 LOCAL_SRC_FILES := $(LOCAL_MODULE) 50 LOCAL_MODULE_CLASS := ETC 51 LOCAL_MODULE_TAGS := optional 52 LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 53 include $(BUILD_PREBUILT) 54 55 include $(CLEAR_VARS) 56 LOCAL_MODULE := MTLmr3m.ttf 57 LOCAL_SRC_FILES := $(LOCAL_MODULE) 58 LOCAL_MODULE_CLASS := ETC 59 LOCAL_MODULE_TAGS := optional 60 LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 61 include $(BUILD_PREBUILT) 62 63 droidsans_fallback_src := DroidSansFallbackFull.ttf 64 extra_font_files := \ 65 DroidSans.ttf \ 66 DroidSans-Bold.ttf \ 67 DroidSansEthiopic-Regular.ttf \ 68 MTLmr3m.ttf 69 endif # SMALLER_FONT_FOOTPRINT 70 71 ################################ 72 include $(CLEAR_VARS) 73 LOCAL_MODULE := DroidSansFallback.ttf 74 LOCAL_SRC_FILES := $(droidsans_fallback_src) 75 LOCAL_MODULE_CLASS := ETC 76 LOCAL_MODULE_TAGS := optional 77 LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts 78 LOCAL_REQUIRED_MODULES := $(extra_font_files) 79 include $(BUILD_PREBUILT) 80 81 font_symlink_src := 82 font_symlink := 83 droidsans_fallback_src := 84 extra_font_files := 85 ################################ 86 # Build the rest font files as prebuilt. 87 88 # $(1): The source file name in LOCAL_PATH. 89 # It also serves as the module name and the dest file name. 90 define build-one-font-module 91 $(eval include $(CLEAR_VARS))\ 92 $(eval LOCAL_MODULE := $(1))\ 93 $(eval LOCAL_SRC_FILES := $(1))\ 94 $(eval LOCAL_MODULE_CLASS := ETC)\ 95 $(eval LOCAL_MODULE_TAGS := optional)\ 96 $(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\ 97 $(eval include $(BUILD_PREBUILT)) 98 endef 99 100 font_src_files := \ 101 Roboto-Regular.ttf \ 102 Roboto-Bold.ttf \ 103 Roboto-Italic.ttf \ 104 Roboto-BoldItalic.ttf \ 105 DroidSerif-Regular.ttf \ 106 DroidSerif-Bold.ttf \ 107 DroidSerif-Italic.ttf \ 108 DroidSerif-BoldItalic.ttf \ 109 DroidSansMono.ttf \ 110 Clockopia.ttf \ 111 AndroidClock.ttf \ 112 AndroidClock_Highlight.ttf \ 113 AndroidClock_Solid.ttf 114 115 ifeq ($(MINIMAL_FONT_FOOTPRINT),true) 116 117 $(eval $(call create-font-symlink,Roboto-Light.ttf,Roboto-Regular.ttf)) 118 $(eval $(call create-font-symlink,Roboto-LightItalic.ttf,Roboto-Italic.ttf)) 119 $(eval $(call create-font-symlink,Roboto-Thin.ttf,Roboto-Regular.ttf)) 120 $(eval $(call create-font-symlink,Roboto-ThinItalic.ttf,Roboto-Italic.ttf)) 121 $(eval $(call create-font-symlink,RobotoCondensed-Regular.ttf,Roboto-Regular.ttf)) 122 $(eval $(call create-font-symlink,RobotoCondensed-Bold.ttf,Roboto-Bold.ttf)) 123 $(eval $(call create-font-symlink,RobotoCondensed-Italic.ttf,Roboto-Italic.ttf)) 124 $(eval $(call create-font-symlink,RobotoCondensed-BoldItalic.ttf,Roboto-BoldItalic.ttf)) 125 126 else # !MINIMAL_FONT 127 font_src_files += \ 128 Roboto-Light.ttf \ 129 Roboto-LightItalic.ttf \ 130 Roboto-Thin.ttf \ 131 Roboto-ThinItalic.ttf \ 132 RobotoCondensed-Regular.ttf \ 133 RobotoCondensed-Bold.ttf \ 134 RobotoCondensed-Italic.ttf \ 135 RobotoCondensed-BoldItalic.ttf \ 136 DroidNaskh-Regular.ttf \ 137 DroidNaskhUI-Regular.ttf \ 138 DroidSansHebrew-Regular.ttf \ 139 DroidSansHebrew-Bold.ttf \ 140 DroidSansArmenian.ttf \ 141 DroidSansGeorgian.ttf \ 142 AndroidEmoji.ttf 143 144 endif # !MINIMAL_FONT 145 146 $(foreach f, $(font_src_files), $(call build-one-font-module, $(f))) 147 148 build-one-font-module := 149 font_src_files := 150