diff --git a/bedstead.c b/bedstead.c index 698a49c..25c3d4c 100644 --- a/bedstead.c +++ b/bedstead.c @@ -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");