189 0,5,0,1,0,1,0,0,0,0,0,
226 0,5,0,1,0,1,0,0,0,0,0,
304 char Macnamestring[] = {
'V',
'e',
'r',
's',
'i',
'o',
'n',
' ',
'1',
'.',
'0'};
305 char Unamestring[] = {0x00,
'V', 0x00,
'e', 0x00,
'r', 0x00,
's', 0x00,
'i',
306 0x00,
'o', 0x00,
'n', 0x00,
' ', 0x00,
'1', 0x00,
'.',
307 0x00,
'0', 0x00, 0x00, 0x00};
381 int main (
int argc,
char **argv)
385 unsigned long offset =
387 length = 0, checksum = 0, HeadTableOffset, Working;
391 unsigned int NameLength, i, FileLength;
393 printf(
"Ken's Glyph-free font creator\n");
395 fprintf (stderr,
"Usage: GlyphLessFont <output filename>\n");
399 OutputFile = fopen (argv[1],
"wb+");
400 if (OutputFile == 0) {
401 fprintf (stderr,
"Couldn't open file %s for writing\n", argv[1]);
407 fwrite (&Table,
sizeof (
TableRecord), 10, OutputFile);
408 offset = ftell(OutputFile);
409 Table[3].
offset = HeadTableOffset = offset;
428 fwrite (&head,
sizeof(
head_table), 1, OutputFile);
429 offset = ftell(OutputFile);
432 fwrite (&hhea,
sizeof(
hhea_table), 1, OutputFile);
433 offset = ftell(OutputFile);
436 fwrite (&maxp,
sizeof(
maxp_table), 1, OutputFile);
437 offset = ftell(OutputFile);
440 fwrite (&OS2,
sizeof(
OS2_table), 1, OutputFile);
441 offset = ftell(OutputFile);
444 fwrite (&hmtx,
sizeof(
hmtx_table), 1, OutputFile);
445 offset = ftell(OutputFile);
448 fwrite (&cmap,
sizeof(
cmap_table), 1, OutputFile);
449 offset = ftell(OutputFile);
452 fwrite (&loca,
sizeof(
short), 1, OutputFile);
453 fwrite (&loca,
sizeof(
short), 1, OutputFile);
454 fwrite (&loca,
sizeof(
short), 1, OutputFile);
455 fwrite (&loca,
sizeof(
short), 1, OutputFile);
456 offset = ftell(OutputFile);
459 fwrite (&glyf,
sizeof(
long), 1, OutputFile);
460 offset = ftell(OutputFile);
467 fwrite (&name,
sizeof(
name_table), 1, OutputFile);
471 offset = ftell(OutputFile);
474 fwrite (&post,
sizeof(
post_table), 1, OutputFile);
475 FileLength = ftell(OutputFile);
477 Table[3].
tag[0] =
'h';
478 Table[3].
tag[1] =
'e';
479 Table[3].
tag[2] =
'a';
480 Table[3].
tag[3] =
'd';
485 Table[4].
tag[0] =
'h';
486 Table[4].
tag[1] =
'h';
487 Table[4].
tag[2] =
'e';
488 Table[4].
tag[3] =
'a';
492 Table[7].
tag[0] =
'm';
493 Table[7].
tag[1] =
'a';
494 Table[7].
tag[2] =
'x';
495 Table[7].
tag[3] =
'p';
499 Table[0].
tag[0] =
'O';
500 Table[0].
tag[1] =
'S';
501 Table[0].
tag[2] =
'/';
502 Table[0].
tag[3] =
'2';
506 Table[5].
tag[0] =
'h';
507 Table[5].
tag[1] =
'm';
508 Table[5].
tag[2] =
't';
509 Table[5].
tag[3] =
'x';
513 Table[1].
tag[0] =
'c';
514 Table[1].
tag[1] =
'm';
515 Table[1].
tag[2] =
'a';
516 Table[1].
tag[3] =
'p';
520 Table[6].
tag[0] =
'l';
521 Table[6].
tag[1] =
'o';
522 Table[6].
tag[2] =
'c';
523 Table[6].
tag[3] =
'a';
527 Table[2].
tag[0] =
'g';
528 Table[2].
tag[1] =
'l';
529 Table[2].
tag[2] =
'y';
530 Table[2].
tag[3] =
'f';
534 Table[8].
tag[0] =
'n';
535 Table[8].
tag[1] =
'a';
536 Table[8].
tag[2] =
'm';
537 Table[8].
tag[3] =
'e';
543 NameLength = Table[8].
length;
545 Table[9].
tag[0] =
'p';
546 Table[9].
tag[1] =
'o';
547 Table[9].
tag[2] =
's';
548 Table[9].
tag[3] =
't';
554 ULONG *EndPtr, *Data, *Current;
558 LENGTH = (length + 3 & ~3);
559 Data = (
ULONG *)malloc(LENGTH);
560 memset(Data, 0x00, LENGTH);
561 fseek(OutputFile, offset, SEEK_SET);
562 fread(Data, length, 1, OutputFile);
565 EndPtr = Data + (LENGTH /
sizeof(
ULONG));
566 while(Current < EndPtr){
568 Working = *Current++;
569 Sum += ((Working & 0xff) << 24) +
570 ((Working & 0xff00) << 8) +
571 ((Working & 0xff0000) >> 8) +
581 ((offset & 0xff) << 24) +
582 ((offset & 0xff00) << 8) +
583 ((offset & 0xff0000) >> 8) +
586 ((length & 0xff) << 24) +
587 ((length & 0xff00) << 8) +
588 ((length & 0xff0000) >> 8) +
591 ((Sum & 0xff) << 24) +
592 ((Sum & 0xff00) << 8) +
593 ((Sum & 0xff0000) >> 8) +
601 fwrite (&Table,
sizeof(
TableRecord), 10, OutputFile);
603 fseek(OutputFile, 0, SEEK_SET);
605 for (i=0;i < FileLength /
sizeof(long);i++) {
606 fread(&Working,
sizeof(
long), 1, OutputFile);
608 checksum += ((Working & 0xff) << 24) +
609 ((Working & 0xff00) << 8) +
610 ((Working & 0xff0000) >> 8) +
616 checksum = 0xB1B0AFBA - checksum;
619 ((checksum & 0xff) << 24) +
620 ((checksum & 0xff00) << 8) +
621 ((checksum & 0xff0000) >> 8) +
626 fseek(OutputFile, HeadTableOffset, SEEK_SET);
627 fwrite (&head,
sizeof(
head_table), 1, OutputFile);
int main(int argc, char **argv)