From b58a10a265f5d3e6b379587c7a3334542bb542e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 8 Apr 2021 16:00:18 +0200 Subject: [PATCH] build: Simplify and cleanup TTF font creation rules. --- build/makefile_base.mak | 66 ++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 0f23dc89..888873ec 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -777,16 +777,9 @@ GOAL_TARGETS += fonts FONTFORGE = fontforge -quiet FONTSCRIPT = $(FONTS)/scripts/generatefont.pe -FONTLINKPATH = ../../../../fonts LIBERATION_SRCDIR = $(FONTS)/liberation-fonts/src -SOURCE_HAN_SANS_SRCDIR =$(FONTS)/source-han-sans - -LIBERATION_SANS_REGULAR_SFD = LiberationSans-Regular.sfd -LIBERATION_SANS_BOLD_SFD = LiberationSans-Bold.sfd -LIBERATION_SERIF_REGULAR_SFD = LiberationSerif-Regular.sfd -LIBERATION_MONO_REGULAR_SFD = LiberationMono-Regular.sfd -LIBERATION_MONO_BOLD_SFD = LiberationMono-Bold.sfd +SOURCE_HAN_SANS_SRCDIR = $(FONTS)/source-han-sans SOURCE_HAN_SANS_REGULAR_CIDFONTINFO = $(SOURCE_HAN_SANS_SRCDIR)/cidfontinfo.OTC.SC SOURCE_HAN_SANS_REGULAR_CIDFONT = $(SOURCE_HAN_SANS_SRCDIR)/cidfont.ps.OTC.SC @@ -795,40 +788,28 @@ SOURCE_HAN_SANS_REGULAR_SEQUENCES = $(SOURCE_HAN_SANS_SRCDIR)/SourceHanSans_CN_s SOURCE_HAN_SANS_REGULAR_UNISOURCE = $(SOURCE_HAN_SANS_SRCDIR)/UniSourceHanSansCN-UTF32-H YAHEI_MENUNAMEDB = $(FONTS)/patches/YaHei-FontMenuNameDB -LIBERATION_SANS_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SANS_REGULAR_SFD:.sfd=.ttf)) -LIBERATION_SANS_BOLD_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SANS_BOLD_SFD:.sfd=.ttf)) -LIBERATION_SERIF_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_SERIF_REGULAR_SFD:.sfd=.ttf)) -LIBERATION_MONO_REGULAR_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_MONO_REGULAR_SFD:.sfd=.ttf)) -LIBERATION_MONO_BOLD_TTF = $(addprefix $(FONTS_OBJ)/, $(LIBERATION_MONO_BOLD_SFD:.sfd=.ttf)) SOURCE_HAN_SANS_REGULAR_OTF = $(FONTS_OBJ)/SourceHanSansSCRegular.otf -LIBERATION_SFDS = $(LIBERATION_SANS_REGULAR_SFD) $(LIBERATION_SANS_BOLD_SFD) $(LIBERATION_SERIF_REGULAR_SFD) $(LIBERATION_MONO_REGULAR_SFD) \ - $(LIBERATION_MONO_BOLD_SFD) -FONT_TTFS = $(LIBERATION_SANS_REGULAR_TTF) $(LIBERATION_SANS_BOLD_TTF) \ - $(LIBERATION_SERIF_REGULAR_TTF) $(LIBERATION_MONO_REGULAR_TTF) \ - $(LIBERATION_MONO_BOLD_TTF) -FONTS_SRC = $(FONT_TTFS:.ttf=.sfd) - #The use of "Arial" here is for compatibility with programs that require that exact string. This font is not Arial. -$(LIBERATION_SANS_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT) - $(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "Arial" "Arial" "Arial" - +LiberationSans-Regular_NAMES := "Arial" "Arial" "Arial" #The use of "Arial" here is for compatibility with programs that require that exact string. This font is not Arial. -$(LIBERATION_SANS_BOLD_TTF): $(FONTS_SRC) $(FONTSCRIPT) - $(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "Arial-Bold" "Arial" "Arial Bold" - +LiberationSans-Bold_NAMES := "Arial-Bold" "Arial" "Arial Bold" #The use of "Times New Roman" here is for compatibility with programs that require that exact string. This font is not Times New Roman. -$(LIBERATION_SERIF_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT) - $(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "TimesNewRoman" "Times New Roman" "Times New Roman" - +LiberationSerif-Regular_NAMES := "TimesNewRoman" "Times New Roman" "Times New Roman" #The use of "Courier New" here is for compatibility with programs that require that exact string. This font is not Courier New. -$(LIBERATION_MONO_REGULAR_TTF): $(FONTS_SRC) $(FONTSCRIPT) - patch $(@:.ttf=.sfd) $(FONTS)/patches/$(LIBERATION_MONO_REGULAR_SFD:.sfd=.patch) - $(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "CourierNew" "Courier New" "Courier New" - +LiberationMono-Regular_NAMES := "CourierNew" "Courier New" "Courier New" +LiberationMono-Regular_PATCH := $(FONTS)/patches/LiberationMono-Regular.patch #The use of "Courier New" here is for compatibility with programs that require that exact string. This font is not Courier New. -$(LIBERATION_MONO_BOLD_TTF): $(FONTS_SRC) $(FONTSCRIPT) - $(FONTFORGE) -script $(FONTSCRIPT) $(@:.ttf=.sfd) "CourierNewPS-BoldMT" "Courier New" "Courier New Bold" +LiberationMono-Bold_NAMES := "CourierNewPS-BoldMT" "Courier New" "Courier New Bold" + +$(FONTS_OBJ): + mkdir -p $@ + +$(FONTS_OBJ)/%.ttf: $(FONTS_OBJ)/%.sfd $(FONTSCRIPT) | $(FONTS_OBJ) + $(FONTFORGE) -script $(FONTSCRIPT) $< $($(*)_NAMES) + +$(FONTS_OBJ)/%.sfd: $(LIBERATION_SRCDIR)/%.sfd | $(FONTS_OBJ) + patch $< -o $@ $(firstword $($(*)_PATCH) /dev/null) #The use of "YaHei" for compatibility with programs that require that exact string. This font is not Microsoft YaHei. $(SOURCE_HAN_SANS_REGULAR_OTF): $(SOURCE_HAN_SANS_REGULAR_CIDFONTINFO) $(SOURCE_HAN_SANS_REGULAR_CIDFONT) \ @@ -839,15 +820,12 @@ $(SOURCE_HAN_SANS_REGULAR_OTF): $(SOURCE_HAN_SANS_REGULAR_CIDFONTINFO) $(SOURCE_ tx -cff +S -no_futile $(SOURCE_HAN_SANS_REGULAR_CIDFONT) $(FONTS_OBJ)/CFF.OTC.SC sfntedit -a CFF=$(FONTS_OBJ)/CFF.OTC.SC $(SOURCE_HAN_SANS_REGULAR_OTF) -$(FONTS_OBJ): - mkdir -p $@ - -$(FONTS_SRC): $(FONTS_OBJ) - cp -n $(addprefix $(LIBERATION_SRCDIR)/, $(LIBERATION_SFDS)) $< - -fonts: $(LIBERATION_SANS_REGULAR_TTF) $(LIBERATION_SANS_BOLD_TTF) \ - $(LIBERATION_SERIF_REGULAR_TTF) $(LIBERATION_MONO_REGULAR_TTF) \ - $(LIBERATION_MONO_BOLD_TTF) $(SOURCE_HAN_SANS_REGULAR_OTF) | $(FONTS_SRC) +fonts: $(FONTS_OBJ)/LiberationSans-Regular.ttf +fonts: $(FONTS_OBJ)/LiberationSans-Bold.ttf +fonts: $(FONTS_OBJ)/LiberationSerif-Regular.ttf +fonts: $(FONTS_OBJ)/LiberationMono-Regular.ttf +fonts: $(FONTS_OBJ)/LiberationMono-Bold.ttf +fonts: $(SOURCE_HAN_SANS_REGULAR_OTF) ## ## Targets