Hi all, I went ahead and updated the Makefile posted earlier in this thread, so that the generated fonts work for groff 1.22.4 and 1.23.0 without producing errors.
To use the Makefile place it in a directory you feel comfortable including in GROFF_FONT_PATH and run: % make download % make fonts aliases # Must be a separate command for now This will download the Computer Modern Unicode pfb source files, generate the groff font files and create font aliases for easier use. A font alias in this case is the same groff font file with a different value for the name directive and filename. Please find attached cmu.ms which showcases the available Computer Modern Unicode fonts and font aliases produced by the Makefile. When using the generated Computer Modern Unicode fonts with pdfroff, grops complains about invalid input characters in the pfb files, e.g.: % pdfroff -t -ms -mcmu doc/ms.ms > doc/ms.pdf grops:$GROFF_FONT_PATH/devps/../cm-unicode-0.7.0/cmunbi.pfb (doc/ms.ms):3047: invalid input character code 3 What could be the cause for that? Does someone know of afix or workaround? What follows are some thoughts on adding support for font aliases to groff. With groff 1.22.4 doing less validation of font files it was possible to simply create symlink to a font file and that symlink would serve as a font alias. Since groff 1.23.0 does more validation of the font files than groff 1.22.4 each font alias needs to be a separate file on disk, although only the filename and value for the name directive differ. Is it possible and feasible to change the format of the name directive so that it allows for several names/aliases? This would allow a single font file to be used for several font aliases. Imagine a font file cmunrm containing the following name directive: name cmunrm CMUSerifR CMUSerifRoman and CMUSerifR and CMUSerifRoman being symlinks to cmunrm. This would make it easy to add a new font alias to a font and show the relation of fonts and font aliases on the file system too. So far I've only looked into supporting multiple names and aliases during font file parsing in function font::load from src/libs/libgroff/font.cpp:779 but know too little about groff's font loading mechanism in general. Any pointers are greatly appreciated. If folks think that this might be a useful change I'd be happy to learn what other code parts might need changing and possible have a first go at it. What are your thoughts? Best Alexis
# 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)/$< > 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 $@
cmu.ms
Description: Troff MS-macros document