Home | History | Annotate | Download | only in roboto-fonts
      1 # Copyright (C) 2015 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 MINIMAL_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 # Build the rest of font files as prebuilt.
     36 # $(1): The source file name in LOCAL_PATH.
     37 #       It also serves as the module name and the dest file name.
     38 define build-one-font-module
     39 $(eval include $(CLEAR_VARS))\
     40 $(eval LOCAL_MODULE := $(1))\
     41 $(eval LOCAL_SRC_FILES := $(1))\
     42 $(eval LOCAL_MODULE_CLASS := ETC)\
     43 $(eval LOCAL_MODULE_TAGS := optional)\
     44 $(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\
     45 $(eval include $(BUILD_PREBUILT))
     46 endef
     47 
     48 font_src_files := \
     49     Roboto-Regular.ttf \
     50     Roboto-Bold.ttf \
     51     Roboto-Italic.ttf \
     52     Roboto-BoldItalic.ttf
     53 
     54 ifeq ($(MINIMAL_FONT_FOOTPRINT),true)
     55 
     56 $(eval $(call create-font-symlink,Roboto-Black.ttf,Roboto-Bold.ttf))
     57 $(eval $(call create-font-symlink,Roboto-BlackItalic.ttf,Roboto-BoldItalic.ttf))
     58 $(eval $(call create-font-symlink,Roboto-Light.ttf,Roboto-Regular.ttf))
     59 $(eval $(call create-font-symlink,Roboto-LightItalic.ttf,Roboto-Italic.ttf))
     60 $(eval $(call create-font-symlink,Roboto-Medium.ttf,Roboto-Regular.ttf))
     61 $(eval $(call create-font-symlink,Roboto-MediumItalic.ttf,Roboto-Italic.ttf))
     62 $(eval $(call create-font-symlink,Roboto-Thin.ttf,Roboto-Regular.ttf))
     63 $(eval $(call create-font-symlink,Roboto-ThinItalic.ttf,Roboto-Italic.ttf))
     64 $(eval $(call create-font-symlink,RobotoCondensed-Regular.ttf,Roboto-Regular.ttf))
     65 $(eval $(call create-font-symlink,RobotoCondensed-Bold.ttf,Roboto-Bold.ttf))
     66 $(eval $(call create-font-symlink,RobotoCondensed-Italic.ttf,Roboto-Italic.ttf))
     67 $(eval $(call create-font-symlink,RobotoCondensed-BoldItalic.ttf,Roboto-BoldItalic.ttf))
     68 
     69 else # !MINIMAL_FONT
     70 font_src_files += \
     71     Roboto-Black.ttf \
     72     Roboto-BlackItalic.ttf \
     73     Roboto-Light.ttf \
     74     Roboto-LightItalic.ttf \
     75     Roboto-Medium.ttf \
     76     Roboto-MediumItalic.ttf \
     77     Roboto-Thin.ttf \
     78     Roboto-ThinItalic.ttf \
     79     RobotoCondensed-Regular.ttf \
     80     RobotoCondensed-Bold.ttf \
     81     RobotoCondensed-Italic.ttf \
     82     RobotoCondensed-BoldItalic.ttf \
     83     RobotoCondensed-Light.ttf \
     84     RobotoCondensed-LightItalic.ttf
     85 
     86 endif # !MINIMAL_FONT
     87 
     88 $(foreach f, $(font_src_files), $(call build-one-font-module, $(f)))
     89 
     90 build-one-font-module :=
     91 font_src_files :=
     92