diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-04-24 22:25:12 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-04-24 22:25:12 +0100 |
| commit | bbbbc8b22bae0aa15b48273f763b0e215df0c7af (patch) | |
| tree | 0fac3e6f2fb2546be4c03f9911d6210f3a930263 | |
| parent | fcf1d274c3f512e6f70cba71832e0ecc97b656d3 (diff) | |
| download | puzzles-bbbbc8b22bae0aa15b48273f763b0e215df0c7af.zip puzzles-bbbbc8b22bae0aa15b48273f763b0e215df0c7af.tar.gz puzzles-bbbbc8b22bae0aa15b48273f763b0e215df0c7af.tar.bz2 puzzles-bbbbc8b22bae0aa15b48273f763b0e215df0c7af.tar.xz | |
Pattern: Reduce row clue spacing if there are lots of them
Normally, we put two spaces between row clues, but if there are a lot
then even with a smaller font size they might overflow the left edge
of the window. To compensate, go down to one space between clues
instead of two if there are a lot of them. On my laptop the GTK build
demonstrates overflow with "13x1:1//1//1//1//1//1//1/1.1.1.1.1.1.1".
| -rw-r--r-- | pattern.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1853,11 +1853,15 @@ static void draw_numbers( } else { int x, y; size_t off = 0; + const char *spaces = " "; assert(rowlen <= state->common->rowsize); *ds->strbuf = '\0'; + /* Squish up a bit if there are lots of clues. */ + if (rowlen > TLBORDER(state->common->w)) spaces++; for (j = 0; j < rowlen; j++) - off += sprintf(ds->strbuf + off, "%s%d", j ? " " : "", rowdata[j]); + off += sprintf(ds->strbuf + off, "%s%d", + j ? spaces : "", rowdata[j]); y = ry; x = BORDER + TILE_SIZE * (TLBORDER(state->common->w)-1); draw_text(dr, x+TILE_SIZE, y+TILE_SIZE/2, FONT_VARIABLE, |