TTXI(minMemType1, 0); TTXI(maxMemType1, 0);
printf(" </post>\n");
- /* printf("FontName: %s\n", fullname_to_fontname(get_fullname())); */
- /* printf("FullName: %s\n", get_fullname()); */
- /* printf("FamilyName: Bedstead\n"); */
- /* printf("Weight:%s\n", weight->suffix[0] ? weight->suffix : " Medium"); */
- /* printf("Copyright: Dedicated to the public domain\n"); */
- /* printf("Version: 002.009\n"); */
- /* printf("ItalicAngle: 0\n"); */
- /* printf("UnderlinePosition: %g\n", (double)(-3 * YPIX / 2)); */
- /* printf("UnderlineWidth: %g\n", (double)(YPIX)); */
- /* printf("Ascent: %g\n", (double)(8 * YPIX)); */
- /* printf("Descent: %g\n", (double)(2 * YPIX)); */
- /* printf("LayerCount: 2\n"); */
- /* printf("Layer: 0 0 \"Back\" 1\n"); */
- /* printf("Layer: 1 0 \"Fore\" 0\n"); */
- /* printf("Encoding: UnicodeFull\n"); */
- /* printf("NameList: Adobe Glyph List\n"); */
- /* printf("DisplaySize: -24\n"); */
- /* printf("AntiAlias: 1\n"); */
- /* printf("FitToEm: 1\n"); */
+ printf(" <CFF>\n");
+ TTXI(major, 1); TTXI(minor, 0);
+ printf(" <CFFFont name='%s'>\n",
+ fullname_to_fontname(get_fullname()));
+ TTXS(version, VERSION);
+ TTXS(Notice, "Dedicated to the public domain");
+ TTXS(FullName, get_fullname());
+ TTXS(FamilyName, "Bedstead");
+ TTXS(Weight, *weight->suffix ? weight->suffix + 1 : "Medium");
+ TTXI(isFixedPitch, 1);
+ TTXI(ItalicAngle, 0);
+ TTXI(UnderlinePosition, -3 * YPIX / 2);
+ TTXI(UnderlineThickness, YPIX);
+ TTXI(PaintType, 0);
+ TTXI(CharstringType, 2);
+ TTXF(FontMatrix, "%g 0 0 %g 0 0",
+ 1.0/(YSIZE * YPIX), 1.0/(YSIZE * YPIX));
+ TTXF(FontBBox, "0 %d %d %d", (int)(-DESCENT * YPIX),
+ (int)(XSIZE * XPIX), (int)(ASCENT * YPIX));
+ TTXI(StrokeWidth, 0);
+ printf(" <Encoding name='StandardEncoding'/>\n");
+ printf(" <Private>\n");
+ TTXF(BlueValues, "0 0 %4g %4g %4g %4g %4g %4g",
+ (double)(YPIX * 5), (double)(YPIX * 5),
+ (double)(YPIX * 6), (double)(YPIX * 6),
+ (double)(YPIX * 7), (double)(YPIX * 7));
+ TTXF(OtherBlues, "%4g %4g %4g %4g",
+ (double)(YPIX * -2), (double)(YPIX * -2),
+ (double)(YPIX * 1), (double)(YPIX * 1));
+ TTXI(BlueFuzz, 0);
+ TTXF(StdHW, "%4g", (double)YPIX);
+ TTXF(StdVW, "%4g", (double)(XPIX * (100 + weight->weight) / 100));
+ TTXI(defaultWidthX, XSIZE * XPIX);
+ printf(" </Private>\n");
/* if (plottermode) { */
/* printf("StrokedFont: 1\n"); */
/* printf("StrokeWidth: 50\n"); */
/* } */
- /* printf("BeginPrivate: 5\n"); */
- /* printf(" StdHW 6 [%4g]\n", (double)YPIX); */
- /* printf(" StdVW 6 [%4g]\n", */
- /* (double)(XPIX * (100 + weight->weight) / 100)); */
- /* printf(" BlueValues 35 [0 0 %4g %4g %4g %4g %4g %4g]\n", */
- /* (double)(YPIX * 5), (double)(YPIX * 5), */
- /* (double)(YPIX * 6), (double)(YPIX * 6), */
- /* (double)(YPIX * 7), (double)(YPIX * 7)); */
- /* printf(" OtherBlues 21 [%4g %4g %4g %4g]\n", */
- /* (double)(YPIX * -2), (double)(YPIX * -2), */
- /* (double)(YPIX * 1), (double)(YPIX * 1)); */
- /* printf(" BlueFuzz 1 0\n"); */
- /* printf("EndPrivate\n"); */
/* printf("Lookup: 3 0 0 \"aalt: all alternates\" {\"aalt\"} " */
/* "['aalt' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */
/* printf("Lookup: 1 0 0 \"smcp: lower-case to small caps\" " */
/* printf("OtfFeatName: 'ss16' 1033 \"6-cell separated graphics\"\n"); */
/* printf("Lookup: 257 0 0 \"palt: proportional metrics\" {\"palt\"} " */
/* "['palt' ('DFLT' <'dflt'> 'latn' <'dflt'>)]\n"); */
- /* printf("BeginChars: %ld %d\n", 0x110000L + extraglyphs, nglyphs); */
+ printf(" <CharStrings>\n");
extraglyphs = 0;
for (i = 0; i < nglyphs; i++)
glyphs_by_name[i] = glyphs + i;
qsort(glyphs_by_name, nglyphs, sizeof(glyphs_by_name[0]),
&compare_glyphs_by_name);
for (i = 0; i < nglyphs; i++) {
- /* printf("\nStartChar: %s\n", glyphs[i].name); */
- /* printf("Encoding: %ld %ld %d\n", */
- /* (long)(glyphs[i].unicode != -1 ? glyphs[i].unicode : */
- /* 0x110000 + extraglyphs++), */
- /* (long)glyphs[i].unicode, i); */
- /* printf("Width: %g\n", (double)(XSIZE * XPIX)); */
- /* if (glyphs[i].flags & (MOS6|MOS4)) */
- /* printf("Flags: W\n"); */
- /* else */
- /* printf("Flags: HW\n"); */
- /* printf("LayerCount: 2\n"); */
+ printf(" <CharString name='%s'>\n", glyphs[i].name);
/* dolookups(&glyphs[i]); */
- /* if (glyphs[i].flags & IS_ALIAS) */
- /* doalias(glyphs[i].alias_of); */
- /* else if (glyphs[i].flags & MOS6) */
- /* domosaic(glyphs[i].data[0], */
- /* (glyphs[i].flags & SEP) != 0); */
- /* else if (glyphs[i].flags & MOS4) */
- /* domosaic4(glyphs[i].data[0], */
- /* (glyphs[i].flags & SEP) != 0); */
- /* else { */
- /* if (plottermode) */
- /* dochar_plotter(glyphs[i].data, glyphs[i].flags); */
- /* else */
- /* dochar(glyphs[i].data, glyphs[i].flags); */
- /* } */
- /* printf("EndChar\n"); */
+ if (glyphs[i].flags & IS_ALIAS)
+ doalias(glyphs[i].alias_of);
+ else if (glyphs[i].flags & MOS6)
+ domosaic(glyphs[i].data[0],
+ (glyphs[i].flags & SEP) != 0);
+ else if (glyphs[i].flags & MOS4)
+ domosaic4(glyphs[i].data[0],
+ (glyphs[i].flags & SEP) != 0);
+ else {
+ if (plottermode)
+ dochar_plotter(glyphs[i].data, glyphs[i].flags);
+ else
+ dochar(glyphs[i].data, glyphs[i].flags);
+ }
+ printf(" </CharString>\n");
}
- /* printf("EndChars\n"); */
+ printf(" </CharStrings>\n");
+ printf(" </CFFFont>\n");
+ printf(" </CFF>\n");
+ printf(" <GlyphOrder>\n");
+ for (i = 0; i < nglyphs; i++)
+ printf(" <GlyphID name='%s'/>\n", glyphs[i].name);
+ printf(" </GlyphOrder>\n");
+ printf(" <hmtx>\n");
+ for (i = 0; i < nglyphs; i++)
+ printf(" <mtx name='%s' width='%d' lsb='%d'/>\n",
+ glyphs[i].name, (int)(XSIZE * XPIX), 0 /* XXX */);
+ printf(" </hmtx>\n");
printf("</ttFont>\n");
return EXIT_SUCCESS;
}
} while (done_anything);
}
+static vec cur;
+
static void
emit_contour(point *p0)
{
point *p = p0, *p1;
do {
- printf(" %g %g %s 1\n",
- (double)p->v.x / XSCALE,
- (double)p->v.y / YSCALE - 2*YPIX,
- p == p0 && p->next ? "m" : "l");
+ printf(" %g %g %s\n",
+ (double)(p->v.x - cur.x) / XSCALE,
+ (double)(p->v.y - cur.y) / YSCALE,
+ p == p0 && p->next ? "rmoveto" : "rlineto");
+ cur = p->v;
p1 = p->next;
p->prev = p->next = NULL;
p = p1;
{
int i, pass;
point *p;
- bool started = false;
+ cur.x = 0;
+ cur.y = DESCENT * YPIX;
/*
* On the first pass, emit open contours (if there are any).
* On the second pass, emit all remaining contours.
for (pass = 0; pass <= 1; pass++) {
for (i = 0; i < nextpoint; i++) {
p = &points[i];
- if (p->next && (!p->prev || pass == 1)) {
- if (!started) printf("Fore\nSplineSet\n");
- started = true;
+ if (p->next && (!p->prev || pass == 1))
emit_contour(p);
- }
}
}
- if (started) printf("EndSplineSet\n");
+ printf("endchar\n");
}
/*
{
struct glyph const *g;
- g = get_glyph_by_name(alias_of);
- printf("Refer: %td %d N 1 0 0 1 0 0 1\n", g - glyphs, g->unicode);
+ /* g = get_glyph_by_name(alias_of); */
+ /* printf("Refer: %td %d N 1 0 0 1 0 0 1\n", g - glyphs, g->unicode); */
+ /* XXX */
+ printf("endchar\n");
}
static int