Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 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 | |
Roozbeh Pournader | 49455ab | 2015-05-12 16:00:55 -0700 | [diff] [blame] | 20 | # Use full Noto Sans Japanese font on extended footprint |
| 21 | ifeq ($(EXTENDED_FONT_FOOTPRINT),true) |
| 22 | FONT_NOTOSANS_JP_FULL := true |
| 23 | endif |
| 24 | |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 25 | ########################################## |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 26 | # create symlink for given font |
| 27 | # $(1): new font $(2): link target |
| 28 | # should be used with eval: $(eval $(call ...)) |
| 29 | define 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 |
| 36 | ALL_MODULES.$(1).INSTALLED := \ |
| 37 | $(ALL_MODULES.$(1).INSTALLED) $(PRODUCT_OUT)/system/fonts/$(1) |
| 38 | endef |
| 39 | |
| 40 | ########################################## |
Victoria Lease | a08f0f8 | 2014-05-12 16:05:52 -0700 | [diff] [blame] | 41 | # The following fonts are distributed as symlink only. |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 42 | ########################################## |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 43 | $(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf)) |
| 44 | $(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf)) |
Victoria Lease | a08f0f8 | 2014-05-12 16:05:52 -0700 | [diff] [blame] | 45 | $(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 Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 49 | |
Victoria Lease | f99c12c | 2014-06-13 07:56:58 -0700 | [diff] [blame] | 50 | extra_font_files := \ |
| 51 | DroidSans.ttf \ |
| 52 | DroidSans-Bold.ttf |
| 53 | |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 54 | ################################ |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 55 | # Do not include Motoya on space-constrained devices |
| 56 | ifneq ($(SMALLER_FONT_FOOTPRINT),true) |
Kris Giesing | 6180e5b | 2015-03-26 15:37:46 -0700 | [diff] [blame] | 57 | # Do not include Motoya if we are including full NotoSans |
Roozbeh Pournader | 5f49c28 | 2015-04-29 15:38:07 -0700 | [diff] [blame] | 58 | ifneq ($(FONT_NOTOSANS_JP_FULL),true) |
Victoria Lease | f99c12c | 2014-06-13 07:56:58 -0700 | [diff] [blame] | 59 | |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 60 | include $(CLEAR_VARS) |
Russell Brenner | 1c097a9 | 2012-03-28 09:45:27 -0700 | [diff] [blame] | 61 | LOCAL_MODULE := MTLmr3m.ttf |
| 62 | LOCAL_SRC_FILES := $(LOCAL_MODULE) |
| 63 | LOCAL_MODULE_CLASS := ETC |
| 64 | LOCAL_MODULE_TAGS := optional |
| 65 | LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts |
| 66 | include $(BUILD_PREBUILT) |
Victoria Lease | f99c12c | 2014-06-13 07:56:58 -0700 | [diff] [blame] | 67 | extra_font_files += MTLmr3m.ttf |
Russell Brenner | 1c097a9 | 2012-03-28 09:45:27 -0700 | [diff] [blame] | 68 | |
Roozbeh Pournader | 5f49c28 | 2015-04-29 15:38:07 -0700 | [diff] [blame] | 69 | endif # !FONT_NOTOSANS_JP_FULL |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 70 | endif # !SMALLER_FONT_FOOTPRINT |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 71 | |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 72 | ################################ |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 73 | # Use DroidSansMono to hang extra_font_files on |
| 74 | include $(CLEAR_VARS) |
| 75 | LOCAL_MODULE := DroidSansMono.ttf |
| 76 | LOCAL_SRC_FILES := $(LOCAL_MODULE) |
| 77 | LOCAL_MODULE_CLASS := ETC |
| 78 | LOCAL_MODULE_TAGS := optional |
| 79 | LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts |
| 80 | LOCAL_REQUIRED_MODULES := $(extra_font_files) |
| 81 | include $(BUILD_PREBUILT) |
| 82 | extra_font_files := |
| 83 | |
| 84 | ################################ |
| 85 | # Include DroidSansFallback only on non-EXTENDED_FONT_FOOTPRINT builds |
| 86 | ifneq ($(EXTENDED_FONT_FOOTPRINT),true) |
| 87 | |
| 88 | # Include a subset of DroidSansFallback on SMALLER_FONT_FOOTPRINT build |
| 89 | ifeq ($(SMALLER_FONT_FOOTPRINT),true) |
| 90 | droidsans_fallback_src := DroidSansFallback.ttf |
| 91 | else # !SMALLER_FONT_FOOTPRINT |
| 92 | droidsans_fallback_src := DroidSansFallbackFull.ttf |
| 93 | endif # SMALLER_FONT_FOOTPRINT |
| 94 | |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 95 | include $(CLEAR_VARS) |
| 96 | LOCAL_MODULE := DroidSansFallback.ttf |
| 97 | LOCAL_SRC_FILES := $(droidsans_fallback_src) |
| 98 | LOCAL_MODULE_CLASS := ETC |
| 99 | LOCAL_MODULE_TAGS := optional |
| 100 | LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 101 | include $(BUILD_PREBUILT) |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 102 | droidsans_fallback_src := |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 103 | |
| 104 | endif # !EXTENDED_FONT_FOOTPRINT |
| 105 | |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 106 | ################################ |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 107 | # Build the rest of font files as prebuilt. |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 108 | |
| 109 | # $(1): The source file name in LOCAL_PATH. |
| 110 | # It also serves as the module name and the dest file name. |
| 111 | define build-one-font-module |
| 112 | $(eval include $(CLEAR_VARS))\ |
| 113 | $(eval LOCAL_MODULE := $(1))\ |
| 114 | $(eval LOCAL_SRC_FILES := $(1))\ |
| 115 | $(eval LOCAL_MODULE_CLASS := ETC)\ |
| 116 | $(eval LOCAL_MODULE_TAGS := optional)\ |
| 117 | $(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\ |
| 118 | $(eval include $(BUILD_PREBUILT)) |
| 119 | endef |
| 120 | |
| 121 | font_src_files := \ |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 122 | Clockopia.ttf \ |
| 123 | AndroidClock.ttf \ |
| 124 | AndroidClock_Highlight.ttf \ |
| 125 | AndroidClock_Solid.ttf |
| 126 | |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 127 | $(foreach f, $(font_src_files), $(call build-one-font-module, $(f))) |
| 128 | |
| 129 | build-one-font-module := |
| 130 | font_src_files := |