mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-10 14:03:06 -04:00
Support for edge hints in select_hints()
Which demonstrated plenty of bugs in the code generating them. Currently edge hints only appear in a helpful comment.
This commit is contained in:
parent
15b8a9a584
commit
347dcfd579
33
bedstead.c
33
bedstead.c
@ -3837,6 +3837,21 @@ select_hints(int nstems, int stems[nstems],
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Now look for edge hints, preferring ones closer to the edge
|
||||
* of the character.
|
||||
*/
|
||||
for (int i = 0; i < nstems - 1; i++)
|
||||
if (aedges[i] > 0 && hints[i] == hint_none &&
|
||||
(i == 0 || hints[i-1] == hint_none))
|
||||
hints[i] = hint_aedge;
|
||||
for (int i = nstems - 1; i >= 1; i--)
|
||||
if (zedges[i] > 0 && hints[i] == hint_none &&
|
||||
(i == nstems - 1 || hints[i+1] == hint_none))
|
||||
hints[i] = hint_zedge;
|
||||
printf("<!-- HINTS ");
|
||||
for (int i = 0; i < nstems; i++) printf("%c", ".|[]"[hints[i]]);
|
||||
printf(" -->");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4035,8 +4050,8 @@ dochar(struct glyph *g)
|
||||
#define DL GETPIX(x-1, y+1)
|
||||
#define DR GETPIX(x+1, y+1)
|
||||
|
||||
for (x = 0; x < XSIZE; x++) vstems[x] = 0;
|
||||
for (y = 0; y < YSIZE; y++) hstems[y] = 0;
|
||||
for (x = 0; x < XSIZE; x++) vstems[x] = ledges[x] = redges[x] = 0;
|
||||
for (y = 0; y < YSIZE; y++) hstems[y] = tedges[y] = bedges[y] = 0;
|
||||
clearpath();
|
||||
for (y = 0; y < YSIZE; y++) {
|
||||
for (x = 0; x < XSIZE; x++) {
|
||||
@ -4058,16 +4073,14 @@ dochar(struct glyph *g)
|
||||
blackpixel(x, YSIZE - y - 1, bl, br, tr, tl);
|
||||
if (!L && !R && (U || D))
|
||||
vstems[x]++;
|
||||
else if (!U && !D && (L || R))
|
||||
if (!U && !D && (L || R))
|
||||
hstems[y]++;
|
||||
else if (UL + U + UR + L + R + DL + D + DR == 0)
|
||||
if (UL + U + UR + L + R + DL + D + DR == 0)
|
||||
vstems[x]++, hstems[y]++;
|
||||
else { /* Not a stem. Maybe an edge? */
|
||||
if (UL + U + UR == 0) tedges[y]++;
|
||||
if (DL + D + DR == 0) bedges[y]++;
|
||||
if (UL + L + DL == 0) ledges[x]++;
|
||||
if (UR + R + DR == 0) redges[x]++;
|
||||
}
|
||||
if (UL + U + UR == 0) tedges[y]++;
|
||||
if (DL + D + DR == 0) bedges[y]++;
|
||||
if (UL + L + DL == 0) ledges[x]++;
|
||||
if (UR + R + DR == 0) redges[x]++;
|
||||
} else {
|
||||
bool tl, tr, bl, br;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user