Add support for choosing font size and weight in BDF generation

This commit is contained in:
Ben Harris 2024-11-01 14:38:39 +00:00
parent 4c81bfa249
commit ca7fa3a80d

View File

@ -2768,7 +2768,18 @@ main(int argc, char **argv)
}
if (gen_bdf) {
bdf_gen(10);
unsigned long u;
if (argc != 2) {
fprintf(stderr, "--bdfgen needs precisely one size\n");
return EXIT_FAILURE;
}
u = strtoul(argv[1], &endptr, 10);
if (*endptr != '\0') {
fprintf(stderr, "--bdfgen needs a numeric size\n");
return EXIT_FAILURE;
}
bdf_gen(u);
return EXIT_SUCCESS;
}
@ -3848,7 +3859,8 @@ bdf_gen(int px_height)
printf("/d [1 0 0 1 0 0] %d %d <ff 00> makeimagedevice def\n",
(px_width + 7) / 8 * 8, px_height);
printf("d setdevice\n");
printf("/Bedstead findfont %d scalefont setfont\n", px_height);
printf("/%s findfont %d scalefont setfont\n",
fullname_to_fontname(get_fullname()), px_height);
printf("/f (%%stdout) (w) file def\n");
printf("/buf %d string def\n", (px_width + 7) / 8);
printf("(\\\n");