chiark / gitweb /
More BDF properties and a proper XLFD name
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 1 Nov 2024 10:18:14 +0000 (10:18 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 10 Nov 2024 09:29:36 +0000 (09:29 +0000)
bedstead.c

index 8c239db8bb33a8a3ce15b0206cd86115b5a9fcd4..3e0ff8312d13383febfe137b74105600baa05ca3 100644 (file)
@@ -3839,6 +3839,8 @@ static void
 bdf_gen(int px_height)
 {
        int px_width = (px_height * XPIX * XSIZE) / (YPIX * YSIZE);
+       int pt_height = (long)(px_height * 7227 + 3750) / 7500;
+       int dpt_height = (long)(px_height * 7227 + 375) / 750;
        int base = (px_height * 200) / (YPIX * YSIZE);
        int i;
 
@@ -3851,9 +3853,37 @@ bdf_gen(int px_height)
        printf("/buf %d string def\n", (px_width + 7) / 8);
        printf("(\\\n");
        printf("STARTFONT 2.1\n");
-       printf("FONT bedstead-%d\n", px_height);
-       printf("SIZE %d 75 75\n", px_height);
+       printf("FONT -bjh21-Bedstead-%s-R-%s--"
+              "%d-%d-75-75-C-%d-ISO10646-1\n",
+              *weight->suffix ? weight->suffix : "Medium",
+              *width->suffix ? width->suffix : "Normal",
+              dpt_height, px_height, px_width * 10);
+       printf("SIZE %d 75 75\n", pt_height);
        printf("FONTBOUNDINGBOX %d %d 0 %d\n", px_width, px_height, -base);
+       printf("STARTPROPERTIES 20\n");
+       printf("FOUNDRY \"bjh21\"\n");
+       printf("FAMILY_NAME \"Bedstead\"\n");
+       printf("WEIGHT_NAME \"%s\"\n",
+              *weight->suffix ? weight->suffix : "Medium");
+       printf("SLANT \"R\"\n");
+       printf("SETWIDTH_NAME \"%s\"\n",
+              *width->suffix ? width->suffix : "Normal");
+       printf("ADD_STYLE_NAME \"\"\n");
+       printf("PIXEL_SIZE %d\n", px_height);
+       printf("POINT_SIZE %d\n", dpt_height);
+       printf("RESOLUTION_X 75\n");
+       printf("RESOLUTION_Y 75\n");
+       printf("SPACING \"C\"\n");
+       printf("AVERAGE_WIDTH %d\n", px_width * 10);
+       printf("CHARSET_REGISTRY \"ISO10646\"\n");
+       printf("CHARSET_ENCODING \"1\"\n");
+       printf("FONT_ASCENT %d\n", px_height - base);
+       printf("FONT_DESCENT %d\n", base);
+       printf("UNDERLINE_POSITION %d\n", base / 2);
+       printf("UNDERLINE_THICKNESS %d\n", base / 2);
+       printf("RELATIVE_SETWIDTH %d\n", width->ttfwidth * 10);
+       printf("RELATIVE_WEIGHT %d\n", weight->ttfweight / 10);
+       printf("ENDPROPERTIES\n");
        printf("CHARS %d\n", nglyphs);
        for (i = 0; i < nglyphs; i++) {
                struct glyph *g = &glyphs[i];