From 98a4985b30df2fb8195b0ff29eb69dd5f49557a8 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 17 Aug 2014 23:49:06 +0100 Subject: generate internal font from glyph data on demand --- framebuffer/Makefile.target | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'framebuffer/Makefile.target') diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target index 9632b56d4..3ca778174 100644 --- a/framebuffer/Makefile.target +++ b/framebuffer/Makefile.target @@ -70,11 +70,6 @@ endif # built-in resource setup # ---------------------------------------------------------------------------- -# We make convert_image depend on fb_bitmap.h so that if we change -# that header, we get new images built just in case. -$(TOOLROOT)/convert_image: $(TOOLROOT)/created framebuffer/convert_image.c framebuffer/fbtk.h - $(VQ)echo " HOST CC: $@" - $(Q)$(HOST_CC) -o $@ framebuffer/convert_image.c -lpng FB_IMAGE_left_arrow := framebuffer/res/icons/back.png FB_IMAGE_right_arrow := framebuffer/res/icons/forward.png @@ -112,6 +107,14 @@ FB_IMAGE_throbber6 := framebuffer/res/throbber/throbber6.png FB_IMAGE_throbber7 := framebuffer/res/throbber/throbber7.png FB_IMAGE_throbber8 := framebuffer/res/throbber/throbber8.png +# Host tool to convert image bitmaps to source code. +# +# convert_image dependd on fb_bitmap.h so that if we change that +# header, we get new images built. +$(TOOLROOT)/convert_image: $(TOOLROOT)/created framebuffer/convert_image.c framebuffer/fbtk.h + $(VQ)echo " HOST CC: $@" + $(Q)$(HOST_CC) -o $@ framebuffer/convert_image.c -lpng + # 1: input file # 2: output file # 3: bitmap name @@ -126,7 +129,34 @@ endef S_IMAGES := -$(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V)),$(OBJROOT)/$(patsubst FB_IMAGE_%,%,$(V)).c,$(patsubst FB_IMAGE_%,%,$(V))))) +$(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V)),$(OBJROOT)/image-$(patsubst FB_IMAGE_%,%,$(V)).c,$(patsubst FB_IMAGE_%,%,$(V))))) + + +# Internal fonts to generate +FB_FONT_internal_core := framebuffer/res/fonts/glyph_data + +# Internal font conversion +$(TOOLROOT)/convert_font: $(TOOLROOT)/created framebuffer/convert_font.c + $(VQ)echo " HOST CC: $@" + $(Q)$(HOST_CC) -o $@ framebuffer/convert_font.c + +# 1: input file +# 2: output source code file +# 3: output header file +# 4: font name +define convert_font + +S_FONTS += $(2) + +$(2): $(1) $(TOOLROOT)/convert_font + $(VQ)echo " FONT: $(1) ($(4))" + $(Q)$(TOOLROOT)/convert_font -H $(3) $(1) $(2) + +endef + +S_FONTS := + +$(eval $(foreach V,$(filter FB_FONT_$(NETSURF_FB_FONTLIB)_%,$(.VARIABLES)),$(call convert_font,$($(V)),$(OBJROOT)/font-$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V)).c,$(OBJROOT)/font-$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V)).h,$(patsubst FB_FONT_$(NETSURF_FB_FONTLIB)_%,%,$(V))))) # ---------------------------------------------------------------------------- # Source file setup @@ -147,7 +177,7 @@ S_FRAMEBUFFER := $(addprefix framebuffer/,$(S_FRAMEBUFFER)) $(addprefix framebuf # This is the final source build list # Note this is deliberately *not* expanded here as common and image # are not yet available -SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES) +SOURCES = $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER) $(S_IMAGES) $(S_FONTS) EXETARGET := nsfb # ---------------------------------------------------------------------------- -- cgit v1.2.3