#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
+
+#define VERSION "002.009"
#define XSIZE 6
#define YSIZE 10
return fontname;
}
+/* Get a suitable asctime-format time string for a TTX file. */
+static char *
+time_for_ttx(void)
+{
+ time_t now;
+ struct tm *timeptr;
+ char *timestr;
+
+ /* Work out what timestamp to use. */
+ now = time(NULL);
+ if (now == (time_t)-1) {
+ fprintf(stderr, "Can't get current time\n");
+ return NULL;
+ }
+ timeptr = gmtime(&now);
+ if (timeptr == NULL) {
+ fprintf(stderr, "Can't convert time to UTC\n");
+ return NULL;
+ }
+ timestr = asctime(timeptr);
+ assert(strlen(timestr) == 25);
+ timestr[24] = '\0'; /* Remove newline. */
+ return timestr;
+}
+
static int
compare_glyphs_by_name(const void *va, const void *vb)
{
bool gen_bdf = false;
int i;
int extraglyphs = 0;
- char *endptr;
+ char *endptr, *timestr;
if (argc == 2 && strcmp(argv[1], "--complement") == 0) {
glyph_complement();
extraglyphs++;
printf("<?xml version='1.0'?>\n");
printf("<ttFont sfntVersion='OTTO'>\n");
+ printf(" <head>\n");
+ printf(" <tableVersion value='1.0'/>\n");
+ printf(" <fontRevision value='%s'/>\n", VERSION);
+ printf(" <checkSumAdjustment value='0'/>\n");
+ printf(" <magicNumber value='0x5f0f3cf5'/>\n");
+ /*
+ * Flags:
+ * Baseline and left sidebearing point at (0,0)
+ * Force ppem to integer
+ */
+ printf(" <flags value='00000000 00001011'/>\n");
+ printf(" <unitsPerEm value='%d'/>\n", (int)(YSIZE * YPIX));
+ if ((timestr = time_for_ttx()) == NULL) return 1;
+ printf(" <created value='%s'/>\n", timestr);
+ printf(" <modified value='%s'/>\n", timestr);
+ printf(" <xMin value='%d'/>\n", 0);
+ printf(" <yMin value='%d'/>\n", (int)(-2 * YPIX));
+ printf(" <xMax value='%d'/>\n", (int)(XSIZE * XPIX));
+ printf(" <yMax value='%d'/>\n", (int)((YSIZE - 2) * YPIX));
+ printf(" <macStyle value='00000000 0%c%c000%c'/>\n",
+ width->ttfwidth > 5 ? '1' : '0', /* Expanded? */
+ width->ttfwidth < 5 ? '1' : '0', /* Condensed? */
+ weight->ttfweight > 500 ? '1' : '0'); /* Bold? */
+ printf(" <lowestRecPPEM value='%d'/>\n", (int)YSIZE);
+ printf(" <fontDirectionHint value='0'/>\n"); /* Fully bi-di. */
+ printf(" <indexToLocFormat value='0'/>\n");
+ printf(" <glyphDataFormat value='0'/>\n");
+ printf(" </head>\n");
/* printf("FontName: %s\n", fullname_to_fontname(get_fullname())); */
/* printf("FullName: %s\n", get_fullname()); */
/* printf("FamilyName: Bedstead\n"); */