chiark / gitweb /
Add support for separated 4-cell mosaic graphics
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 28 Mar 2020 21:35:01 +0000 (21:35 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 28 Mar 2020 21:35:01 +0000 (21:35 +0000)
The shapes of the 4-cell mosaic graphics are based on an alternative
history in which Teletext adopted 4-cell graphics.  It's obviously
reasonable that such a world would still have separated graphics, so
let's have them.

This makes me thing that the method I've used for flagging separated
graphics is silly, but that's a story for another commit.

bedstead.c

index 78c525f4552566abc8217f23701673ebaaac14e1..b4e188c7360726e32c5134133c80996361c1e5c3 100644 (file)
@@ -216,7 +216,7 @@ struct weight const *weight = &weights[0];
 static 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 domosaic4(unsigned code);
+static void domosaic4(unsigned code, bool sep);
 static void doalias(char const *alias_of);
 static void dopanose(void);
 static void glyph_complement(void);
@@ -1434,18 +1434,22 @@ static struct glyph {
  {{012,012,012,033,000,033,012,012,012}, 0x256c, "SF440000" },
 
  /* Block elements */
- {{ 3}, 0x2580, "upblock", MOS4 }, {{12}, 0x2584, "dnblock", MOS4 },
- {{15}, 0x2588, "block",   MOS4 }, {{0x7f}, -1, "block.sep6", MOS },
- {{ 5}, 0x258c, "lfblock", MOS4 }, {{0x35}, -1, "lfblock.sep6", MOS },
- {{10}, 0x2590, "rtblock", MOS4 }, {{0x6a}, -1, "rtblock.sep6", MOS },
+ {{0x03}, 0x2580, "upblock", MOS4 }, {{0x23}, -1, "upblock.sep4", MOS4 },
+ {{0x0c}, 0x2584, "dnblock", MOS4 }, {{0x2c}, -1, "dnblock.sep4", MOS4 },
+ {{0x0f}, 0x2588, "block",   MOS4 }, {{0x2f}, -1, "block.sep4",   MOS4 },
+ {{0x7f}, -1, "block.sep6", MOS },
+ {{0x05}, 0x258c, "lfblock", MOS4 }, {{0x25}, -1, "lfblock.sep4", MOS4 },
+ {{0x35}, -1, "lfblock.sep6", MOS },
+ {{0x0a}, 0x2590, "rtblock", MOS4 }, {{0x2a}, -1, "rtblock.sep4", MOS4 },
+ {{0x6a}, -1, "rtblock.sep6", MOS },
  {{025,000,012,000,025,000,012,000,025}, 0x2591, "ltshade" },
  {{022,011,004,022,011,004,022,011,004}, 0x2592, "shade" },
  {{025,037,012,037,025,037,012,037,025}, 0x2593, "dkshade" },
- {{ 4}, U(2596), MOS4 }, {{ 8}, U(2597), MOS4 },
{{ 1}, U(2598), MOS4 }, {{13}, U(2599), MOS4 },
{{ 9}, U(259A), MOS4 }, {{ 7}, U(259B), MOS4 },
{{11}, U(259C), MOS4 }, {{ 2}, U(259D), MOS4 },
- {{ 6}, U(259E), MOS4 }, {{14}, U(259F), MOS4 },
+#define M(x, u) { {(x)}, U(u), MOS }, { {(x)|0x20}, -1, "uni" #u ".sep4", MOS4 }
M( 4, 2596), M( 8, 2597), M( 1, 2598), M(13, 2599),
M( 9, 259A), M( 7, 259B), M(11, 259C), M( 2, 259D),
M( 6, 259E), M(14, 259F),
+#undef M
 
  /* Geometric shapes */
  {{037,021,021,021,021,021,037,000,000}, 0x25a1, "H22073" },
@@ -1915,10 +1919,14 @@ main(int argc, char **argv)
        printf("Lookup: 1 0 0 \"ss04: SAA5054 forms\" {\"ss04\" (\"saa5054\")} "
            "['ss04' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n");
        printf("OtfFeatName: 'ss04' 1033 \"SAA5054\"\n");
+       printf("Lookup: 1 0 0 \"ss14: 4-cell separated graphics\" "
+              "{\"ss14\" (\"sep4\")} "
+           "['ss14' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n");
+       printf("OtfFeatName: 'ss14' 1033 \"4-cell separated graphics\"\n");
        printf("Lookup: 1 0 0 \"ss16: 6-cell separated graphics\" "
               "{\"ss16\" (\"sep6\")} "
            "['ss16' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n");
-       printf("OtfFeatName: 'ss14' 1033 \"4-cell separated graphics\"\n");
+       printf("OtfFeatName: 'ss16' 1033 \"6-cell separated graphics\"\n");
        printf("Lookup: 3 0 0 \"aalt: all alternates\" {\"aalt\"} "
            "['aalt' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n");
        printf("Lookup: 257 0 0 \"palt: proportional metrics\" {\"palt\"} "
@@ -1953,7 +1961,8 @@ main(int argc, char **argv)
                        domosaic(glyphs[i].data[0],
                                 (glyphs[i].data[0] & 0x20) != 0);
                else if (glyphs[i].flags & MOS4)
-                       domosaic4(glyphs[i].data[0]);
+                       domosaic4(glyphs[i].data[0],
+                                 (glyphs[i].data[0] & 0x20) != 0);
                else {
                        if (plottermode)
                                dochar_plotter(glyphs[i].data, glyphs[i].flags);
@@ -2670,14 +2679,14 @@ domosaic(unsigned code, bool sep)
 }
 
 static void
-domosaic4(unsigned code)
+domosaic4(unsigned code, bool sep)
 {
 
        clearpath();
-       if (code & 1) tile(0, 6, 3, 11);
-       if (code & 2) tile(3, 6, 6, 11);
-       if (code & 4) tile(0, 1, 3, 6);
-       if (code & 8) tile(3, 1, 6, 6);
+       if (code & 1) tile(0 + sep, 6 + sep, 3, 11);
+       if (code & 2) tile(3 + sep, 6 + sep, 6, 11);
+       if (code & 4) tile(0 + sep, 1 + sep, 3, 6);
+       if (code & 8) tile(3 + sep, 1 + sep, 6, 6);
        clean_path();
        emit_path();
 }