# Generate Computer Modern Unicode font files for use with groff # https://cm-unicode.sourceforge.io/ VERSION := 0.7.0 HASH := f7c9209524dfe1dd40e680139645d07b2c34b187a4121ec444909d6429e2c76e URL := https://sourceforge.net/projects/cm-unicode/files/cm-unicode/$(VERSION) FONT_ARCHIVE := cm-unicode-$(VERSION)-pfb.tar.xz CURL := curl CURL_FLAGS := --disable --location --progress-bar AWK := gawk ENV := /usr/bin/env SHASUM := shasum AFMTODIT := afmtodit GROFF ?= $(shell which groff) GROFF_FLAGS := DEVPS_DIR := $(dir $(GROFF))../share/groff/current/font/devps include $(DEVPS_DIR)/generate/Makefile srcdir := $(DEVPS_DIR)/generate afmdir := . cm-unicode-$(VERSION): download download: $(FONT_ARCHIVE) $(FONT_ARCHIVE): @# Download sources $(CURL) $(CURL_FLAGS) --output $@ $(URL)/$@/download @# Verify download echo "$(HASH) $(FONT_ARCHIVE)" | $(SHASUM) -c @# Unpack sources tar Jxf $@ FONTS = $(basename $(notdir $(wildcard cm-unicode-$(VERSION)/*.pfb))) fonts: $(FONTS) FONT_STYLES := R I B BI Roman Italic Bold BoldItalic CMUSerif := CMUClassicalSerifItalic CMUSerifClassicalItalic $(addprefix CMUSerif, $(FONT_STYLES) RomanSlanted BoldSlanted BoldNonextended UprightItalic) CMUSerifR CMUSerifRoman: cmunrm CMUSerifI CMUSerifItalic: cmunti CMUSerifB CMUSerifBold: cmunbx CMUSerifBI CMUSerifBoldItalic: cmunbi CMUSerifRomanSlanted: cmunsl CMUSerifBoldSlanted: cmunbl CMUSerifBoldNonextended: cmunrb CMUSerifUprightItalic: cmunui CMUSerifClassicalItalic CMUClassicalSerifItalic: cmunci CMUSansSerif := CMUSansSerif $(addprefix CMUSansSerif, $(FONT_STYLES) RomanSlanted DemiCondensed Oblique BoldOblique) CMUSansSerifR CMUSansSerifRoman CMUSansSerif: cmunss CMUSansSerifI CMUSansSerifItalic CMUSansSerifOblique: cmunsi CMUSansSerifB CMUSansSerifBold: cmunsx CMUSansSerifBI CMUSansSerifBoldItalic CMUSansSerifBoldOblique: cmunso CMUSansSerifRomanSlanted: cmunsl CMUSansSerifDemiCondensed: cmunssdc CMUBright := $(addprefix CMUBright, $(FONT_STYLES) Oblique BoldOblique SemiBold SemiBoldOblique) CMUBrightR CMUBrightRoman: cmunbmr CMUBrightI CMUBrightItalic CMUBrightOblique: cmunbmo CMUBrightB CMUBrightBold: cmunbbx CMUBrightBI CMUBrightBoldItalic CMUBrightBoldOblique: cmunbxo CMUBrightSemiBold: cmunbsr CMUBrightSemiBoldOblique: cmunbso CMUTypewriter := $(addprefix CMUTypewriter, $(FONT_STYLES) Regular Oblique Light LightOblique Variable VariableItalic) CMUTypewriterR CMUTypewriterRoman CMUTypewriterRegular: cmuntt CMUTypewriterI CMUTypewriterItalic: cmunit CMUTypewriterB CMUTypewriterBold: cmuntb CMUTypewriterBI CMUTypewriterBoldItalic: cmuntx CMUTypewriterOblique: cmunst CMUTypewriterLight: cmunbtl CMUTypewriterLightOblique: cmunbto CMUTypewriterVariable: cmunvt CMUTypewriterVariableItalic: cmunvi CMUConcrete := $(addprefix CMUConcrete, $(FONT_STYLES)) CMUConcreteR CMUConcreteRoman: cmunorm CMUConcreteI CMUConcreteItalic: cmunoti CMUConcreteB CMUConcreteBold: cmunobx CMUConcreteBI CMUConcreteBoldItalic: cmunobi ALIASES := $(CMUSerif) $(CMUSansSerif) $(CMUBright) $(CMUTypewriter) $(CMUConcrete) aliases: $(ALIASES) $(ALIASES): | devps devpdf sed -e '/^name/s/$ cm-unicode-$(VERSION)/$@ ln -sf ../cm-unicode-$(VERSION)/$@ devps/$@ ln -sf ../cm-unicode-$(VERSION)/$@ devpdf/$@ $(FONTS): | devps devpdf @# Generate groff font files and symlink to them in the respective device directories cd cm-unicode-$(VERSION); \ $(AFMTODIT) -s $(EFLAG) $(RFLAG) $@.afm $(TEXTMAP) $@; \ ln -sf ../cm-unicode-$(VERSION)/$@ ../devpdf; ln -sf ../cm-unicode-$(VERSION)/$@ ../devps @# Generate download files for generated groff fonts $(AWK) \ -vdir=../cm-unicode-$(VERSION)/ \ '/^name/{pf="$@.pfb"} /^internalname/{i=$$2} END{print i "\t" dir pf}' devps/$@ \ | tee -a devps/download \ | sed -e 's/^/\t/' >> devpdf/download devps devpdf: mkdir -p $@