Lay complement out more in keeping with Unicode values.

Now each column represents one column in the Unicode code charts, with
entirely empty columns suppressed.  Unencoded characters are packed in
at the end.
This commit is contained in:
Ben Harris 2017-07-31 23:22:48 +01:00
parent b7333078b7
commit 0153fbc059

View File

@ -2139,8 +2139,8 @@ byunicode(const void *va, const void *vb)
static void
glyph_complement()
{
int i;
int const nrow = 20, ncol=12;
int const nrow = 16, ncol=12;
int i, unicol = 32/nrow, col = -1, row = 0;
int const nglyphs = sizeof(glyphs) / sizeof(glyphs[0]);
int npages = 0;
struct glyph const *sorted[nglyphs], *g;
@ -2174,14 +2174,25 @@ glyph_complement()
printf("{ pop << /SubsetFonts false >> setdistillerparams } if\n");
printf("%%%%EndProlog\n");
for (i = 0; i < nglyphs; i++) {
if (i % (nrow*ncol) == 0) {
g = sorted[i];
if (g->unicode / nrow != unicol ||
(g->unicode == -1 && row == nrow)) {
if (++col == ncol) {
printf("grestore showpage\n");
col = -1;
}
unicol = g->unicode / nrow;
row = 0;
}
if (col == -1) {
++npages;
printf("%%%%Page: %d %d\n", npages, npages);
printf("gsave 20 800 translate\n");
col = 0;
}
g = sorted[i];
printf("gsave %d %d translate ",
20 + (((i%(nrow*ncol)/nrow) * 40)),
800 - ((i%nrow) * 40));
(col * 40),
-((g->unicode == -1 ? row++ : g->unicode%nrow) * 40));
if (g->unicode != -1)
printf("(U+%04X)", g->unicode);
else
@ -2191,8 +2202,6 @@ glyph_complement()
else
printf("/uni%04X ", g->unicode);
printf("exemplify grestore\n");
if (i % (nrow*ncol) == (nrow*ncol)-1)
printf("showpage\n");
}
printf("showpage\n");
printf("%%%%EOF\n");