blob: f4c5b53dd36be7503774f33791bef8968d2c5270 [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
Ying Wang8e359812011-10-06 11:14:13 -070020##########################################
Keun young Park08761012012-06-05 15:20:17 -070021# 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##########################################
Roozbeh Pournader52256202015-06-11 10:26:13 -070036# The following fonts are just symlinks, for backward compatibility.
Ying Wang8e359812011-10-06 11:14:13 -070037##########################################
Keun young Park08761012012-06-05 15:20:17 -070038$(eval $(call create-font-symlink,DroidSans.ttf,Roboto-Regular.ttf))
39$(eval $(call create-font-symlink,DroidSans-Bold.ttf,Roboto-Bold.ttf))
Victoria Leasea08f0f82014-05-12 16:05:52 -070040$(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 Wang8e359812011-10-06 11:14:13 -070044
Victoria Leasef99c12c2014-06-13 07:56:58 -070045extra_font_files := \
46 DroidSans.ttf \
47 DroidSans-Bold.ttf
48
Ying Wang8e359812011-10-06 11:14:13 -070049################################
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070050# Use DroidSansMono to hang extra_font_files on
51include $(CLEAR_VARS)
52LOCAL_MODULE := DroidSansMono.ttf
53LOCAL_SRC_FILES := $(LOCAL_MODULE)
54LOCAL_MODULE_CLASS := ETC
55LOCAL_MODULE_TAGS := optional
56LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
57LOCAL_REQUIRED_MODULES := $(extra_font_files)
58include $(BUILD_PREBUILT)
59extra_font_files :=
60
61################################
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070062# Include the DroidSansFallback subset on SMALLER_FONT_FOOTPRINT build
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070063ifeq ($(SMALLER_FONT_FOOTPRINT),true)
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070064
Ying Wang46b20e72011-09-29 18:07:41 -070065include $(CLEAR_VARS)
66LOCAL_MODULE := DroidSansFallback.ttf
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070067LOCAL_SRC_FILES := $(LOCAL_MODULE)
Ying Wang46b20e72011-09-29 18:07:41 -070068LOCAL_MODULE_CLASS := ETC
69LOCAL_MODULE_TAGS := optional
70LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
Ying Wang8e359812011-10-06 11:14:13 -070071include $(BUILD_PREBUILT)
Ying Wang46b20e72011-09-29 18:07:41 -070072droidsans_fallback_src :=
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070073
Roozbeh Pournaderbbf0c882015-08-18 12:17:13 -070074endif # SMALLER_FONT_FOOTPRINT
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070075
Ying Wang193ec662012-02-13 18:55:41 -080076################################
Roozbeh Pournader32a65c72014-07-24 14:36:04 -070077# Build the rest of font files as prebuilt.
Ying Wang193ec662012-02-13 18:55:41 -080078
79# $(1): The source file name in LOCAL_PATH.
80# It also serves as the module name and the dest file name.
81define 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))
89endef
90
91font_src_files := \
Ben Wagnercee5f202016-02-04 14:56:09 -050092 AndroidClock.ttf
Keun young Park08761012012-06-05 15:20:17 -070093
Ying Wang193ec662012-02-13 18:55:41 -080094$(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
95
96build-one-font-module :=
97font_src_files :=
Roozbeh Pournader0e969e22016-03-09 23:08:45 -080098
99
100# Run sanity tests on fonts on checkbuild
101checkbuild: fontchain_lint
102
103FONTCHAIN_LINTER := frameworks/base/tools/fonts/fontchain_lint.py
Roozbeh Pournader27ec3ac2016-03-31 13:05:32 -0700104ifeq ($(SMALLER_FONT_FOOTPRINT),true)
105CHECK_EMOJI := false
106else
107CHECK_EMOJI := true
108endif
Roozbeh Pournader0e969e22016-03-09 23:08:45 -0800109
110.PHONY: fontchain_lint
Ying Wangd5b46b12016-04-05 10:26:14 -0700111fontchain_lint: $(FONTCHAIN_LINTER) $(TARGET_OUT)/etc/fonts.xml $(PRODUCT_OUT)/system.img
Roozbeh Pournader0e969e22016-03-09 23:08:45 -0800112 PYTHONPATH=$$PYTHONPATH:external/fonttools/Lib \
Roozbeh Pournader27ec3ac2016-03-31 13:05:32 -0700113 python $(FONTCHAIN_LINTER) $(TARGET_OUT) $(CHECK_EMOJI) external/unicode