/* An "A" edge is top or left, a "Z" edge is bottom or right. */
enum hint_type {
- hint_none, hint_stem, hint_aedge, hint_zedge
+ hint_none, hint_stem, hint_counter_stem, hint_aedge, hint_zedge
};
static void
}
}
}
+ /* Look for evenly spaced stems to attach counter masks to. */
+ for (int step = 2; step < (nstems + 1) / 2; step++)
+ for (int i = 0; i < nstems - 2 * step; i++)
+ if (hints[i] && hints[i+step] && hints[i+step*2]) {
+ for (int j = i; j < nstems; j += step)
+ if (hints[j])
+ hints[j] = hint_counter_stem;
+ else break;
+ goto counters_done;
+ }
+counters_done:
/*
* Now look for edge hints, preferring ones closer to the edge
* of the character.
(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]]);
+ for (int i = 0; i < nstems; i++) printf("%c", ".|I[]"[hints[i]]);
printf(" -->");
}
for (i = 0; i < YSIZE; i++) {
switch (hhints[YSIZE - 1 - i]) {
case hint_stem:
+ case hint_counter_stem:
start = i * YPIX_S;
size = YPIX_S;
break;
for (i = 0; i < XSIZE; i++) {
switch (vhints[i]) {
case hint_stem:
+ case hint_counter_stem:
start = i * XPIX_S - weight->weight;
size = XPIX_S + weight->weight;
break;