mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 13:33:06 -04:00
Beginnings of mechanisms for generating a glyph complement PDF.
This commit is contained in:
parent
0ad411932d
commit
2e8a4e90c9
6
Makefile
6
Makefile
@ -50,6 +50,12 @@ bedstead-ultracondensed.sfd: bedstead
|
||||
bedstead-%-df.png: df.ps bedstead.pfa
|
||||
gs -q -dSAFER -dsize=$* -sDEVICE=png16m -o $@ bedstead.pfa $<
|
||||
|
||||
complement.ps: bedstead
|
||||
./bedstead --glyph-complement > complement.ps
|
||||
|
||||
complement.pdf: complement.ps bedstead.pfa
|
||||
gs -q -dSAFER -sDEVICE=pdfwrite -o $@ bedstead.pfa $<
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f bedstead *.sfd *.otf *.bdf *.pfa *.png
|
||||
|
||||
41
bedstead.c
41
bedstead.c
@ -191,7 +191,8 @@ void doprologue(void);
|
||||
void dochar(char const data[YSIZE], unsigned flags);
|
||||
static void dochar_plotter(char const data[YSIZE], unsigned flags);
|
||||
static void domosaic(unsigned code, bool sep);
|
||||
static void dopanose();
|
||||
static void dopanose(void);
|
||||
static void glyph_complement(void);
|
||||
|
||||
struct glyph {
|
||||
char data[YSIZE];
|
||||
@ -1264,6 +1265,12 @@ main(int argc, char **argv)
|
||||
int extraglyphs = 0;
|
||||
char *endptr;
|
||||
|
||||
if (argc == 2 && strcmp(argv[1], "--complement")) {
|
||||
glyph_complement();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
while (argc > 1) {
|
||||
for (i = 0; i < nparams; i++)
|
||||
if (strcmp(argv[1], params[i].option) == 0) {
|
||||
@ -2048,3 +2055,35 @@ domosaic(unsigned code, bool sep)
|
||||
clean_path();
|
||||
emit_path();
|
||||
}
|
||||
|
||||
static void
|
||||
glyph_complement()
|
||||
{
|
||||
int i;
|
||||
char uni[10];
|
||||
int const nglyphs = sizeof(glyphs) / sizeof(glyphs[0]);
|
||||
|
||||
printf("%%!\n");
|
||||
printf("/xfont /Bedstead findfont 20 scalefont def\n");
|
||||
printf("/lfont /Bedstead findfont 4 scalefont def\n");
|
||||
printf("/str 50 string def\n");
|
||||
/* unicode glyphname exemplify -- */
|
||||
printf("/exemplify {\n");
|
||||
printf(" xfont setfont dup 10 14 moveto glyphshow\n");
|
||||
printf(" lfont setfont 10 36 moveto str cvs show\n");
|
||||
printf(" dup -1 eq { pop } { 10 2 moveto (U+) show 16 str cvrs\n");
|
||||
printf(" dup length 1 3 { pop (0) show } for show } ifelse\n");
|
||||
printf(" 0 0 moveto 0 40 lineto 40 40 lineto 40 0 lineto closepath\n");
|
||||
printf(" 1 setlinewidth stroke\n");
|
||||
printf("} def\n");
|
||||
for (i = 0; i < nglyphs; i++) {
|
||||
if (glyphs[i].name == NULL)
|
||||
sprintf(uni, "uni%04X", glyphs[i].unicode);
|
||||
printf("gsave %d %d translate 0 0 moveto "
|
||||
"%d /%s exemplify grestore\n",
|
||||
20 + ((i/20) * 40),
|
||||
800 - ((i%20) * 40), glyphs[i].unicode,
|
||||
glyphs[i].name ? glyphs[i].name : uni);
|
||||
}
|
||||
printf("showpage\n");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user