printf(" endchar");
}
+static void
+emit_hints(int vstems[XSIZE], int hstems[YSIZE])
+{
+ int i, start, size, cur;
+ bool printed;
+
+ cur = 0; printed = false;
+ size = XPIX_S + weight->weight;
+ for (i = 0; i < XSIZE; i++) {
+ if (vstems[i] > 0) {
+ start = i * XPIX_S - weight->weight;
+ printf(" %g %g",
+ (double)((start - cur) / XSCALE),
+ (double)(size / XSCALE));
+ cur = start + size;
+ i++; /* Avoid overlapping stems. */
+ printed = true;
+ }
+ }
+ if (printed) printf(" vstem");
+
+ cur = DESCENT * YPIX; printed = false;
+ size = YPIX_S;
+ for (i = YSIZE - 1; i >= 0; i--) {
+ if (hstems[i] > 0) {
+ start = (YSIZE - i - 1) * YPIX_S;
+ printf(" %g %g",
+ (double)((start - cur) / YSCALE),
+ (double)(size / YSCALE));
+ cur = start + size;
+ i--; /* Avoid overlapping stems. */
+ printed = true;
+ }
+ }
+ if (printed) printf(" hstem");
+}
+
/*
* To vary the weight of Bedstead, we just vary the thickness of
* vertical strokes. More precisely, we pretend that the weight
dochar(struct glyph *g)
{
int x, y;
+ int vstems[XSIZE], hstems[YSIZE];
#define GETPIX(x,y) (getpix(g->data, (x), (y), g->flags))
#define L GETPIX(x-1, y)
#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;
clearpath();
for (x = 0; x < XSIZE; x++) {
for (y = 0; y < YSIZE; y++) {
if (L || DL || D) bl = true;
if (R || DR || D) br = true;
blackpixel(x, YSIZE - y - 1, bl, br, tr, tl);
+ if (!L && !R && (U || D))
+ vstems[x]++;
+ if (!U && !D && (L || R))
+ hstems[y]++;
+ if (UL + U + UR + L + R + DL + D + DR == 0) {
+ vstems[x]++;
+ hstems[y]++;
+ }
} else {
bool tl, tr, bl, br;
clean_path();
adjust_weight();
record_lsb(g);
+ emit_hints(vstems, hstems);
emit_path();
}