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 | |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 20 | ########################################## |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 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 | ########################################## |
Roozbeh Pournader | 5225620 | 2015-06-11 10:26:13 -0700 | [diff] [blame] | 36 | # The following fonts are just symlinks, for backward compatibility. |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 37 | ########################################## |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 38 | $(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf)) |
| 39 | $(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf)) |
Victoria Lease | a08f0f8 | 2014-05-12 16:05:52 -0700 | [diff] [blame] | 40 | $(eval $(call create-font-symlink,DroidSerif-Regular.ttf,NotoSerif-Regular.ttf)) |
| 41 | $(eval $(call create-font-symlink,DroidSerif-Bold.ttf,NotoSerif-Bold.ttf)) |
| 42 | $(eval $(call create-font-symlink,DroidSerif-Italic.ttf,NotoSerif-Italic.ttf)) |
| 43 | $(eval $(call create-font-symlink,DroidSerif-BoldItalic.ttf,NotoSerif-BoldItalic.ttf)) |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 44 | |
Victoria Lease | f99c12c | 2014-06-13 07:56:58 -0700 | [diff] [blame] | 45 | extra_font_files := \ |
| 46 | DroidSans.ttf \ |
| 47 | DroidSans-Bold.ttf |
| 48 | |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 49 | ################################ |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 50 | # Use DroidSansMono to hang extra_font_files on |
| 51 | include $(CLEAR_VARS) |
| 52 | LOCAL_MODULE := DroidSansMono.ttf |
| 53 | LOCAL_SRC_FILES := $(LOCAL_MODULE) |
| 54 | LOCAL_MODULE_CLASS := ETC |
| 55 | LOCAL_MODULE_TAGS := optional |
| 56 | LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts |
| 57 | LOCAL_REQUIRED_MODULES := $(extra_font_files) |
| 58 | include $(BUILD_PREBUILT) |
| 59 | extra_font_files := |
| 60 | |
| 61 | ################################ |
Roozbeh Pournader | bbf0c88 | 2015-08-18 12:17:13 -0700 | [diff] [blame] | 62 | # Include the DroidSansFallback subset on SMALLER_FONT_FOOTPRINT build |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 63 | ifeq ($(SMALLER_FONT_FOOTPRINT),true) |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 64 | |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 65 | include $(CLEAR_VARS) |
| 66 | LOCAL_MODULE := DroidSansFallback.ttf |
Roozbeh Pournader | bbf0c88 | 2015-08-18 12:17:13 -0700 | [diff] [blame] | 67 | LOCAL_SRC_FILES := $(LOCAL_MODULE) |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 68 | LOCAL_MODULE_CLASS := ETC |
| 69 | LOCAL_MODULE_TAGS := optional |
| 70 | LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts |
Ying Wang | 8e35981 | 2011-10-06 11:14:13 -0700 | [diff] [blame] | 71 | include $(BUILD_PREBUILT) |
Ying Wang | 46b20e7 | 2011-09-29 18:07:41 -0700 | [diff] [blame] | 72 | droidsans_fallback_src := |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 73 | |
Roozbeh Pournader | bbf0c88 | 2015-08-18 12:17:13 -0700 | [diff] [blame] | 74 | endif # SMALLER_FONT_FOOTPRINT |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 75 | |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 76 | ################################ |
Roozbeh Pournader | 32a65c7 | 2014-07-24 14:36:04 -0700 | [diff] [blame] | 77 | # Build the rest of font files as prebuilt. |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 78 | |
| 79 | # $(1): The source file name in LOCAL_PATH. |
| 80 | # It also serves as the module name and the dest file name. |
| 81 | define build-one-font-module |
| 82 | $(eval include $(CLEAR_VARS))\ |
| 83 | $(eval LOCAL_MODULE := $(1))\ |
| 84 | $(eval LOCAL_SRC_FILES := $(1))\ |
| 85 | $(eval LOCAL_MODULE_CLASS := ETC)\ |
| 86 | $(eval LOCAL_MODULE_TAGS := optional)\ |
| 87 | $(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\ |
| 88 | $(eval include $(BUILD_PREBUILT)) |
| 89 | endef |
| 90 | |
| 91 | font_src_files := \ |
Ben Wagner | cee5f20 | 2016-02-04 14:56:09 -0500 | [diff] [blame] | 92 | AndroidClock.ttf |
Keun young Park | 0876101 | 2012-06-05 15:20:17 -0700 | [diff] [blame] | 93 | |
Ying Wang | 193ec66 | 2012-02-13 18:55:41 -0800 | [diff] [blame] | 94 | $(foreach f, $(font_src_files), $(call build-one-font-module, $(f))) |
| 95 | |
| 96 | build-one-font-module := |
| 97 | font_src_files := |
Roozbeh Pournader | 0e969e2 | 2016-03-09 23:08:45 -0800 | [diff] [blame] | 98 | |
| 99 | |
| 100 | # Run sanity tests on fonts on checkbuild |
| 101 | checkbuild: fontchain_lint |
| 102 | |
| 103 | FONTCHAIN_LINTER := frameworks/base/tools/fonts/fontchain_lint.py |
Roozbeh Pournader | 27ec3ac | 2016-03-31 13:05:32 -0700 | [diff] [blame] | 104 | ifeq ($(SMALLER_FONT_FOOTPRINT),true) |
| 105 | CHECK_EMOJI := false |
| 106 | else |
| 107 | CHECK_EMOJI := true |
| 108 | endif |
Roozbeh Pournader | 0e969e2 | 2016-03-09 23:08:45 -0800 | [diff] [blame] | 109 | |
| 110 | .PHONY: fontchain_lint |
Ying Wang | d5b46b1 | 2016-04-05 10:26:14 -0700 | [diff] [blame] | 111 | fontchain_lint: $(FONTCHAIN_LINTER) $(TARGET_OUT)/etc/fonts.xml $(PRODUCT_OUT)/system.img |
Roozbeh Pournader | 0e969e2 | 2016-03-09 23:08:45 -0800 | [diff] [blame] | 112 | PYTHONPATH=$$PYTHONPATH:external/fonttools/Lib \ |
Roozbeh Pournader | 27ec3ac | 2016-03-31 13:05:32 -0700 | [diff] [blame] | 113 | python $(FONTCHAIN_LINTER) $(TARGET_OUT) $(CHECK_EMOJI) external/unicode |