spleen

Monospaced bitmap fonts for consoles, terminals, and code editors
Log | Files | Refs | README | LICENSE

Makefile (3023B)


      1 #
      2 # Spleen 1.9.1
      3 # Copyright (c) 2018-2021, Frederic Cambus
      4 # https://www.cambus.net/
      5 #
      6 # Created:      2019-01-29
      7 # Last Updated: 2021-06-11
      8 #
      9 # Spleen is released under the BSD 2-Clause license.
     10 # See LICENSE file for details.
     11 #
     12 
     13 BDFTOPCF ?=	bdftopcf
     14 BDF2PSF ?=	bdf2psf
     15 BDF2SFD ?=	bdf2sfd
     16 FONTFORGE ?=	fontforge
     17 OPTIPNG ?=	optipng
     18 FONTTOSFNT ?=	fonttosfnt
     19 
     20 PBMTEXT ?=	pbmtext
     21 PPMCHANGE ?=	ppmchange
     22 PNMCAT ?=	pnmcat
     23 PNMPASTE ?=	pnmpaste
     24 PNMSCALE ?=	pnmscale
     25 PNMTOPNG ?=	pnmtopng
     26 
     27 PREFIX ?=	/usr
     28 DATADIR ?=	$(PREFIX)/share/bdf2psf
     29 
     30 EQUIVALENT =	$(DATADIR)/standard.equivalents
     31 
     32 ASCII =		$(DATADIR)/ascii.set
     33 LINUX =		$(DATADIR)/linux.set
     34 USEFUL =	$(DATADIR)/useful.set
     35 FONTSET =	$(DATADIR)/fontsets/Uni1.512+:$(ASCII)+:$(LINUX)+:$(USEFUL)
     36 
     37 OPTIONS =	$(EQUIVALENT) $(FONTSET) 512
     38 
     39 SIZES =		5x8 6x12 8x16 12x24 16x32 32x64
     40 OTFSIZES =	6x12 8x16 12x24 16x32 32x64
     41 
     42 TARGET =	all
     43 
     44 all:	pcf psf sfd otf
     45 
     46 pcf:
     47 .for size in $(SIZES)
     48 	$(BDFTOPCF) -t -o spleen-${size}.pcf spleen-${size}.bdf
     49 .endfor
     50 
     51 psf:
     52 .for size in $(SIZES)
     53 	$(BDF2PSF) --fb spleen-${size}.bdf $(OPTIONS) spleen-${size}.psfu
     54 .endfor
     55 
     56 otb:
     57 .for size in $(SIZES)
     58 	$(FONTTOSFNT) -b -c -o spleen-${size}.otb spleen-${size}.bdf
     59 .endfor
     60 
     61 sfd:
     62 .for size in $(OTFSIZES)
     63 	$(BDF2SFD) -f "Spleen ${size}" -p "Spleen${size}" spleen-${size}.bdf > spleen-${size}.sfd
     64 	$(FONTFORGE) -lang ff -c 'Open("spleen-${size}.sfd"); SelectAll(); RemoveOverlap(); Simplify(-1, 1); Save("spleen-${size}.sfd")'
     65 .endfor
     66 
     67 otf:
     68 .for size in $(OTFSIZES)
     69 	$(FONTFORGE) -lang ff -c 'Open("spleen-${size}.sfd"); Generate("spleen-${size}.otf")'
     70 .endfor
     71 
     72 screenshots:
     73 .for size in $(SIZES)
     74 	awk 'BEGIN { for(chr = 32; chr < 127; chr++) printf "%c", chr }' | \
     75 	$(PBMTEXT) -font spleen-${size}.bdf -nomargins | \
     76 	$(PPMCHANGE) black "#aaa" | \
     77 	$(PPMCHANGE) white black | \
     78 	$(PNMTOPNG) > spleen-${size}.png
     79 .endfor
     80 	$(OPTIPNG) *.png
     81 
     82 specimen:
     83 	echo "\n  Spleen         " | \
     84 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
     85 	$(PPMCHANGE) white "#ff7f2a" | \
     86 	$(PPMCHANGE) black "#fff" > spleen.pnm
     87 
     88 	echo "\n  Aa Ee Gg       \n  Qq Rr Ss" | \
     89 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
     90 	$(PPMCHANGE) white "#ff7f2a" > examples.pnm
     91 
     92 	echo "\n     The future  " | \
     93 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
     94 	$(PPMCHANGE) white "#ff7f2a" | \
     95 	$(PPMCHANGE) black "#fff" > future.pnm
     96 
     97 	echo "  abcdefghijklm  \n  nopqrstuvwxyz" | \
     98 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
     99 	$(PPMCHANGE) white "#ff2a7f" > letters.pnm
    100 
    101 	echo "     0123456789  " | \
    102 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
    103 	$(PPMCHANGE) white "#ff2a7f" | \
    104 	$(PPMCHANGE) black "#fff"  > digits.pnm
    105 
    106 	$(PNMCAT) -tb spleen.pnm examples.pnm future.pnm letters.pnm digits.pnm > specimen.pnm
    107 
    108 	echo "a" | \
    109 	$(PBMTEXT) -font spleen-32x64.bdf -nomargins | \
    110 	$(PPMCHANGE) white "#ff7f2a" | \
    111 	$(PPMCHANGE) black "#fff" | \
    112 	$(PNMSCALE) 4 | \
    113 	$(PNMPASTE) - 364 100 specimen.pnm | \
    114 	$(PNMTOPNG) > specimen.png
    115 	rm *.pnm
    116 	$(OPTIPNG) *.png
    117 
    118 clean:
    119 	rm -f *.bak *.dfont *.gz *.sfd *.otb *.otf *.pcf *.psfu *.png