| 1 |
# |
| 2 |
# Spleen 2.2.0 |
| 3 |
# Copyright (c) 2018-2026, Frederic Cambus |
| 4 |
# https://www.cambus.net/ |
| 5 |
# |
| 6 |
# Created: 2019-01-29 |
| 7 |
# Last Updated: 2026-01-30 |
| 8 |
# |
| 9 |
# Spleen is released under the BSD 2-Clause license. |
| 10 |
# See LICENSE file for details. |
| 11 |
# |
| 12 |
# SPDX-License-Identifier: BSD-2-Clause |
| 13 |
# |
| 14 |
|
| 15 |
BDFTOPCF ?= bdftopcf |
| 16 |
BDF2PSF ?= bdf2psf |
| 17 |
BDF2SFD ?= bdf2sfd |
| 18 |
FONTFORGE ?= fontforge |
| 19 |
OXIPNG ?= oxipng |
| 20 |
FONTTOSFNT ?= fonttosfnt |
| 21 |
PYFTSUBSET ?= pyftsubset |
| 22 |
|
| 23 |
PBMTEXT ?= pbmtext |
| 24 |
PPMCHANGE ?= ppmchange |
| 25 |
PNMCAT ?= pnmcat |
| 26 |
PNMPASTE ?= pnmpaste |
| 27 |
PNMSCALE ?= pnmscale |
| 28 |
PNMTOPNG ?= pnmtopng |
| 29 |
|
| 30 |
PREFIX ?= /usr |
| 31 |
DATADIR ?= $(PREFIX)/share/bdf2psf |
| 32 |
|
| 33 |
EQUIVALENT = $(DATADIR)/standard.equivalents |
| 34 |
|
| 35 |
ASCII = $(DATADIR)/ascii.set |
| 36 |
LINUX = $(DATADIR)/linux.set |
| 37 |
USEFUL = $(DATADIR)/useful.set |
| 38 |
FONTSET = $(DATADIR)/fontsets/Uni1.512+:$(ASCII)+:$(LINUX)+:$(USEFUL) |
| 39 |
|
| 40 |
OPTIONS = $(EQUIVALENT) $(FONTSET) 512 |
| 41 |
|
| 42 |
SIZES = 5x8 6x12 8x16 12x24 16x32 32x64 |
| 43 |
OTFSIZES = 6x12 8x16 12x24 16x32 32x64 |
| 44 |
|
| 45 |
PCFS = $(SIZES:%=spleen-%.pcf) |
| 46 |
PSFS = $(SIZES:%=spleen-%.psfu) |
| 47 |
FONS = $(SIZES:%=spleen-%.fon) |
| 48 |
OTBS = $(SIZES:%=spleen-%.otb) |
| 49 |
|
| 50 |
SFDS = $(OTFSIZES:%=spleen-%.sfd) |
| 51 |
OTFS = $(OTFSIZES:%=spleen-%.otf) |
| 52 |
|
| 53 |
WOFFS = $(OTFSIZES:%=spleen-%.woff) |
| 54 |
WOFF2S = $(OTFSIZES:%=spleen-%.woff2) |
| 55 |
|
| 56 |
PNGS = $(SIZES:%=spleen-%.png) |
| 57 |
|
| 58 |
all: com pcf psf fon otb sfd otf woff woff2 |
| 59 |
|
| 60 |
com: |
| 61 |
$(MAKE) -C dos |
| 62 |
|
| 63 |
pcf: $(PCFS) |
| 64 |
psf: $(PSFS) |
| 65 |
fon: $(FONS) |
| 66 |
otb: $(OTBS) |
| 67 |
sfd: $(SFDS) |
| 68 |
otf: $(OTFS) |
| 69 |
woff: $(WOFFS) |
| 70 |
woff2: $(WOFF2S) |
| 71 |
|
| 72 |
.SUFFIXES: .bdf .pcf .psfu .fon .otb .sfd .otf .woff .woff2 .png |
| 73 |
|
| 74 |
.bdf.pcf: |
| 75 |
$(BDFTOPCF) -t -o $@ $< |
| 76 |
|
| 77 |
.bdf.psfu: |
| 78 |
$(BDF2PSF) --fb $< $(OPTIONS) $@ |
| 79 |
|
| 80 |
.bdf.fon: |
| 81 |
$(FONTFORGE) -lang ff -c 'Open("$<"); Generate("$@")' |
| 82 |
|
| 83 |
.bdf.otb: |
| 84 |
$(FONTTOSFNT) -b -c -o $@ $< |
| 85 |
|
| 86 |
.bdf.sfd: |
| 87 |
size=`echo "$@" | sed -e 's/^spleen-//' -e 's/\.sfd$$//'`; \ |
| 88 |
$(BDF2SFD) -f "Spleen $$size" -p "Spleen$$size" $< > $@; \ |
| 89 |
$(FONTFORGE) -lang ff -c 'Open("$@"); SelectAll(); RemoveOverlap(); Simplify(-1,1); Save("$@")' |
| 90 |
|
| 91 |
.sfd.otf: |
| 92 |
$(FONTFORGE) -lang ff -c 'Open("$<"); Generate("$@")' |
| 93 |
|
| 94 |
.otf.woff: |
| 95 |
$(PYFTSUBSET) $< \ |
| 96 |
--output-file=$@ \ |
| 97 |
--flavor=woff \ |
| 98 |
--layout-features='*' \ |
| 99 |
--glyphs='*' \ |
| 100 |
--drop-tables+=FFTM \ |
| 101 |
--with-zopfli |
| 102 |
|
| 103 |
.otf.woff2: |
| 104 |
$(PYFTSUBSET) $< \ |
| 105 |
--output-file=$@ \ |
| 106 |
--flavor=woff2 \ |
| 107 |
--layout-features='*' \ |
| 108 |
--glyphs='*' \ |
| 109 |
--drop-tables+=FFTM |
| 110 |
|
| 111 |
.bdf.png: |
| 112 |
awk 'BEGIN { for (c = 32; c < 127; c++) printf "%c", c }' | \ |
| 113 |
$(PBMTEXT) -font $< -nomargins | \ |
| 114 |
$(PPMCHANGE) black "#aaa" | \ |
| 115 |
$(PPMCHANGE) white black | \ |
| 116 |
$(PNMTOPNG) > $@ |
| 117 |
|
| 118 |
screenshots: $(PNGS) |
| 119 |
$(OXIPNG) -o max *.png |
| 120 |
|
| 121 |
specimen: |
| 122 |
printf "\n Spleen " | \ |
| 123 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 124 |
$(PPMCHANGE) white "#ff7f2a" | \ |
| 125 |
$(PPMCHANGE) black "#fff" > spleen.pnm |
| 126 |
|
| 127 |
printf "\n Aa Ee Gg \n Qq Rr Ss" | \ |
| 128 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 129 |
$(PPMCHANGE) white "#ff7f2a" > examples.pnm |
| 130 |
|
| 131 |
printf "\n The future " | \ |
| 132 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 133 |
$(PPMCHANGE) white "#ff7f2a" | \ |
| 134 |
$(PPMCHANGE) black "#fff" > future.pnm |
| 135 |
|
| 136 |
printf " abcdefghijklm \n nopqrstuvwxyz" | \ |
| 137 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 138 |
$(PPMCHANGE) white "#ff2a7f" > letters.pnm |
| 139 |
|
| 140 |
printf " 0123456789 " | \ |
| 141 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 142 |
$(PPMCHANGE) white "#ff2a7f" | \ |
| 143 |
$(PPMCHANGE) black "#fff" > digits.pnm |
| 144 |
|
| 145 |
$(PNMCAT) -tb spleen.pnm examples.pnm future.pnm letters.pnm digits.pnm > specimen.pnm |
| 146 |
|
| 147 |
printf "a" | \ |
| 148 |
$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \ |
| 149 |
$(PPMCHANGE) white "#ff7f2a" | \ |
| 150 |
$(PPMCHANGE) black "#fff" | \ |
| 151 |
$(PNMSCALE) 4 | \ |
| 152 |
$(PNMPASTE) - 364 100 specimen.pnm | \ |
| 153 |
$(PNMTOPNG) > specimen.png |
| 154 |
rm *.pnm |
| 155 |
$(OXIPNG) -o max *.png |
| 156 |
|
| 157 |
check: |
| 158 |
$(MAKE) -C tests check |
| 159 |
|
| 160 |
.PHONY: all com pcf psf fon otb sfd otf woff woff2 screenshots specimen clean |
| 161 |
|
| 162 |
clean: |
| 163 |
rm -f *.bak *.dfont *.fon *.gz *.sfd *.otb *.otf *.pcf *.psfu *.woff *.woff2 spleen*.png |