Esempio n. 1
0
void MMVRRead(LongN start, Card32 length)
	{
	IntX i;
	
	if (loaded)
		return;

	MMVR = (MMVRTbl *)memNew(sizeof(MMVRTbl));
	SEEK_ABS(start);

	IN1(MMVR->Version);
	IN1(MMVR->Flags);
	IN1(MMVR->AxisCount);

	MMVR->axis = memNew(sizeof(Axis) * MMVR->AxisCount);
	for (i = 0; i < MMVR->AxisCount; i++)
		{
		Axis *axis = &MMVR->axis[i];
		
		IN1(axis->Tag);
		IN1(axis->Default);
		IN1(axis->Scale);
		}

	loaded = 1;
	}
Esempio n. 2
0
static int readFile(char * filename)
{
	  Card32 value;

	/* See if we can recognize the file type */
	value = fileSniff();	
	switch (value)
	{
		case bits_:
		case typ1_:		
		case true_:
		case mor0_:
		case OTTO_:
		case VERSION(1,0):
		  sfntRead(0, -1);	/* Read plain sfnt file */
		  sfntDump();
		  sfntFree(1);		  
		  break;
		case ttcf_:
		  sfntTTCRead(0);		/* Read TTC and dump file */
		  break;
		case 256:
		  SEEK_ABS(0); /* Raw resource file as a data fork */ 
		  resRead(0);			/* Read and dump  Macintosh resource file */
		  break;
		case sig_AppleSingle:
		case sig_AppleDouble:
			doASDFormats((ctlTag)value);
			break;
		default:
 			warning(SPOT_MSG_BADFILE, filename);
 			return 1;
		}
	return 0;
}
Esempio n. 3
0
void MMSDRead(LongN start, Card32 length)
	{
	if (loaded)
		return;

	MMSD = (MMSDTbl *)memNew(sizeof(MMSDTbl));
	SEEK_ABS(start);
	
	loaded = 1;
	}
Esempio n. 4
0
void ENCORead(LongN start, Card32 length) {
    IntX i;

    if (loaded)
        return;

    ENCO = (ENCOTbl *)memNew(sizeof(ENCOTbl));

    if (FNAMGetNEncodings(&nEncodings, ENCO_))
        return;

    SEEK_ABS(start);

    IN1(ENCO->version);

    ENCO->offset = memNew(sizeof(ENCO->offset[0]) * (nEncodings + 1));
    for (i = 0; i < nEncodings + 1; i++)
        IN1(ENCO->offset[i]);

    ENCO->encoding = memNew(sizeof(ENCO->encoding[0]) * nEncodings);
    for (i = 0; i < nEncodings; i++) {
        Card16 format;

        SEEK_ABS(ENCO->offset[i] + start);

        IN1(format);
        switch (format) {
            case ENCO_STANDARD:
                ENCO->encoding[i] = readFormat0();
                break;
            case ENCO_SPARSE:
                ENCO->encoding[i] = readFormat1();
                break;
            case ENCO_DENSE:
                ENCO->encoding[i] = readFormat2();
                break;
            default:
                warning(SPOT_MSG_ENCOUNKENCOD, format);
        }
    }

    loaded = 1;
}
Esempio n. 5
0
File: MMFX.c Progetto: brawer/afdko
void MMFXRead(LongN start, Card32 length)
{
    IntX i;
    Card32 lenstr;

    if (loaded)
        return;

    MMFX = (MMFXTbl *)memNew(sizeof(MMFXTbl));
    SEEK_ABS(start);

    IN1(MMFX->version);
    IN1(MMFX->nMetrics);
    IN1(MMFX->offSize);

    MMFX->offset = memNew(sizeof(Int32) * (MMFX->nMetrics + 1));

    for (i = 0; i < MMFX->nMetrics; i++)
    {
        if (MMFX->offSize == 2)
        {
            Int16 tmp;
            IN1(tmp);
            MMFX->offset[i] = tmp;
        }
        else
        {
            IN1(MMFX->offset[i]);
        }
        if (MMFX->offset[i] < (Int32)minoffset) minoffset = MMFX->offset[i];
        if (MMFX->offset[i] > (Int32)maxoffset) maxoffset = MMFX->offset[i];
    }


    lenstr = (start + length) - TELL();
    MMFX->offset[MMFX->nMetrics] = lenstr + 1;
    MMFX->cstrs = memNew(sizeof(Card8) * (lenstr + 1));
    SEEK_ABS(start + minoffset);
    IN_BYTES(lenstr, MMFX->cstrs);
    loaded = 1;
}
Esempio n. 6
0
void hdmxRead(LongN start, Card32 length)
	{
	IntX i;
	LongN recordOffset = start + TBL_HDR_SIZE;

	if (loaded)
		return;

	hdmx = (hdmxTbl *)memNew(sizeof(hdmxTbl));

	if (maxpGetNGlyphs(&nGlyphs, hdmx_))
		return;

	SEEK_ABS(start);

	IN1(hdmx->version);
	IN1(hdmx->nRecords);
	IN1(hdmx->recordSize);

	hdmx->record = memNew(sizeof(DeviceRecord) * hdmx->nRecords);
	for (i = 0; i < hdmx->nRecords; i++)
		{
		IntX j;
		DeviceRecord *rec = &hdmx->record[i];

		IN1(rec->pixelsPerEm);
		IN1(rec->maxWidth);
		
		rec->widths = memNew(sizeof(rec->widths[0]) * nGlyphs);
		for (j = 0; j < nGlyphs; j++)
			IN1(rec->widths[j]);

		recordOffset += hdmx->recordSize;
		SEEK_ABS(recordOffset);
		}
	
	loaded = 1;
	}
Esempio n. 7
0
void WDTHRead(LongN start, Card32 length)
	{
	IntX i;
	IntX size;
	IntX nElements;
	IntX nOffsets;

	if (loaded)
		return;
	WDTH = (WDTHTbl *)memNew(sizeof(WDTHTbl));

	SEEK_ABS(start);
	
	IN1(WDTH->version);
	IN1(WDTH->flags);
	IN1(WDTH->nMasters);
	IN1(WDTH->nRanges);

	size = (WDTH->flags & LONG_OFFSETS) ? sizeof(Card32) : sizeof(Card16);
	nElements = WDTH->nRanges + 1;

	/* Read first glyphs */
	WDTH->firstGlyph = memNew(sizeof(GlyphId) * nElements);
	for (i = 0; i < nElements; i++)
		IN1(WDTH->firstGlyph[i]);

	/* Read offsets */
	if (WDTH->flags & LONG_OFFSETS)
		{
		Card32 *offset = WDTH->offset = memNew(sizeof(Card32) * nElements);
		for (i = 0; i < nElements; i++)
			IN1(offset[i]);	
		nOffsets = offset[WDTH->nRanges] - offset[0];
		}
	else
		{
		Card16 *offset = WDTH->offset = memNew(sizeof(Card16) * nElements);
		for (i = 0; i < nElements; i++)
			IN1(offset[i]);	
		nOffsets = offset[WDTH->nRanges] - offset[0];
		}

	/* Read widths */
	WDTH->width = memNew(sizeof(uFWord) * WDTH->nMasters * nOffsets);
	for (i = 0; i < nOffsets; i++)
		IN1(WDTH->width[i]);

	loaded = 1;
	}
Esempio n. 8
0
void CID_Read(LongN start, Card32 length) {
    if (loaded)
        return;

    CID_ = (CID_Tbl *)memNew(sizeof(CID_Tbl));

    SEEK_ABS(start);

    IN1(CID_->Version);
    IN1(CID_->Flags);
    IN1(CID_->CIDCount);
    IN1(CID_->TotalLength);
    IN1(CID_->AsciiLength);
    IN1(CID_->BinaryLength);
    IN1(CID_->FDCount);

    loaded = 1;
}
Esempio n. 9
0
void HFMXRead(LongN start, Card32 length) {
    if (loaded)
        return;
    HFMX = (HFMXTbl *)memNew(sizeof(HFMXTbl));

    nMasters = BLNDGetNMasters();
    SEEK_ABS(start);

    IN1(HFMX->Version);

    HFMX->Ascent = hybridRead();
    HFMX->Descent = hybridRead();
    HFMX->LineGap = hybridRead();
    HFMX->CaretSlopeRise = hybridRead();
    HFMX->CaretSlopeRun = hybridRead();
    HFMX->CaretOffset = hybridRead();

    loaded = 1;
}
Esempio n. 10
0
static Format4_0 *read4_0(LongN start)
	{
	IntX i;
	Format4_0 *format;

	if (maxpGetNGlyphs(&nGlyphs, post_))
		{
		warning(SPOT_MSG_postNONGLYPH);
		return NULL;
		}

	format = memNew(sizeof(Format4_0));
	format->code = memNew(sizeof(format->code[0]) * nGlyphs );
	
	SEEK_ABS(start + TBL_HDR_SIZE);
	for (i = 0; i < nGlyphs; i++)
		IN1(format->code[i]);

	return format;
	}
Esempio n. 11
0
void postRead(LongN start, Card32 length)
	{
	if (loaded)
		return;

	post = (postTbl *)memNew(sizeof(postTbl));
	SEEK_ABS(start);

	/* Read header */
	IN1(post->version);
	IN1(post->italicAngle);
	IN1(post->underlinePosition);
	IN1(post->underlineThickness);
	IN1(post->isFixedPitch);
	IN1(post->minMemType42);
	IN1(post->maxMemType42);
	IN1(post->minMemType1);
	IN1(post->maxMemType1);

	switch (post->version)
		{
	case VERSION(1,0):
		break;
	case VERSION(2,0):
		post->format = read2_0(length - TBL_HDR_SIZE);
		break;
	case VERSION(2,5):
		post->format = read2_5();
		break;
	case VERSION(3,0):
		break;
	case VERSION(4,0):
		post->format = read4_0(start);
		break;
	default:
		warning(SPOT_MSG_postBADVERS, VERSION_ARG(post->version));
		return;
		}

	loaded = 1;
	}
Esempio n. 12
0
void BBOXRead(LongN start, Card32 length) {
    IntX i;

    if (loaded)
        return;

    BBOX = (BBOXTbl *)memNew(sizeof(BBOXTbl));

    SEEK_ABS(start);

    IN1(BBOX->version);
    IN1(BBOX->flags);
    IN1(BBOX->nGlyphs);
    IN1(BBOX->nMasters);

    BBOX->bbox = memNew(sizeof(BBox) * BBOX->nGlyphs);
    for (i = 0; i < BBOX->nGlyphs; i++) {
        IntX j;
        BBox *bbox = &BBOX->bbox[i];

        bbox->left = memNew(sizeof(FWord) * BBOX->nMasters);
        for (j = 0; j < BBOX->nMasters; j++)
            IN1(bbox->left[j]);

        bbox->bottom = memNew(sizeof(FWord) * BBOX->nMasters);
        for (j = 0; j < BBOX->nMasters; j++)
            IN1(bbox->bottom[j]);

        bbox->right = memNew(sizeof(FWord) * BBOX->nMasters);
        for (j = 0; j < BBOX->nMasters; j++)
            IN1(bbox->right[j]);

        bbox->top = memNew(sizeof(FWord) * BBOX->nMasters);
        for (j = 0; j < BBOX->nMasters; j++)
            IN1(bbox->top[j]);
    }

    loaded = 1;
}
Esempio n. 13
0
PyObject * main_python(PyObject *self, PyObject *args)
	{
	static double glyphptsize = STDPAGE_GLYPH_PTSIZE;
	static opt_Option opt[] =
		{
		  {"-u", opt_Call, showUsage},
		  {"-h", opt_Call, showHelp},
		  {"-ht", opt_Call, sfntTableSpecificUsage},
		  {"-l", opt_Flag},
		  {"-O", opt_Flag},
		  {"-r", opt_Flag},
		  {"-n", opt_Flag},
		  {"-nc", opt_Flag},
		  {"-T", opt_Flag},
		  {"-F", opt_Flag},
		  {"-f", opt_Flag},
		  {"-G", opt_Flag},
		  {"-V", opt_Flag},
		  {"-m", opt_Flag},
		  {"-d", opt_Flag},
		  {"-br", opt_Flag},
		  {"-i", resIdScan},
		  {"-o", sfntTTCScan},
		  {"-t", sfntTagScan},
		  {"-P", sfntFeatScan}, 
		  {"-A", sfntFeatScan}, 
		  {"-p", proofPolicyScan}, 
		  {"-a", opt_Flag},
		  {"-R", opt_Flag},
		  {"-c", opt_Flag},
		  {"-g", glyfGlyphScan},
		  {"-b", glyfBBoxScan},
		  {"-s", glyfScaleScan},
		  {"-@", opt_Double, &glyphptsize},
		  {"-C", opt_Int, &cmapSelected},
#if AUTOSCRIPT
		  {"-X", opt_String, scriptfilename},
#endif
		  {"-ag", opt_String, &glyphaliasfilename},
		  {"-of", opt_String, &outputfilebase},
		};
	char **argv, **argfree;
	int strIndex, argc, argtotal, tries;
	char * argString, *outfilename;
	IntX files;
	IntN argi;
    Byte8 *filename = NULL;
	Card32 value;
	int i = 0;
#if AUTOSCRIPT
	cmdlinetype *cmdl;
	Byte8 foundXswitch = 0;
#endif
    IntN status;

#ifdef SUNOS
	{
	/* To allow gdb to attach to process */
	char* do_debug_sleep;
	do_debug_sleep = getenv("STOP_OTFPROOF_FOR_GDB");
	while (do_debug_sleep != NULL)
		sleep(1);
	}	
#endif


	/* Resetting globals*/
	gcr.reportNumber=0;
	aliasfromfileinit = 0; 
	
/*	freopen("OTFProof.std.log", "w", stdout);*/
	
	value = setjmp(mark);
	
	if(value==-1){
		PyErr_SetString(ErrorObject, "Fatal Error");
		if (PyOutFile != NULL)
			{
			fclose(PyOutFile);
			PyOutFile = NULL;
			}
		freemap();
		return NULL;
	}
	
	if(!PyArg_ParseTuple(args, "ss", &argString, &outfilename)){
		freemap();
		return NULL;
	}
	
	if (PyOutFile == NULL)
		PyOutFile = fopen(outfilename, "w");
	else
		PyOutFile = freopen(outfilename, "w", PyOutFile);
	
	VORGfound=0;
	strIndex=0;
	argfree= (char **) memNew(MAX_ARGS*sizeof(char *));
	argv=(char **) memNew(MAX_ARGS*sizeof(char *));
	
	for(i=0; i<MAX_ARGS; i++){
		argfree[i]=argv[i]=NextToken(argString, &strIndex);
		if(argv[i]==NULL) {
			argtotal=argc=i;
			break;
		}else{
			/*fprintf(OUTPUTBUFF,  ">>%s<<\n", argv[i]);*/
		}
	}
	  status = setjmp(global.env);
	  if (status)
	  {
#if AUTOSCRIPT
	  	if (global.doingScripting)
	  		{
	  		  goto scriptAbEnd;
	  		}
	  	else
#endif
			if(status==2){
				PyErr_SetString(ErrorObject, "Fatal Error");
				if (PyOutFile != NULL)
					{
					fclose(PyOutFile);
					PyOutFile = NULL;
					}
				freemap();
				argFree(argfree, argv);
				return NULL;
			}else{
				if (PyOutFile != NULL)
					{
					fclose(PyOutFile);
					PyOutFile = NULL;
					}
				freemap();
				argFree(argfree, argv);
				return Py_None;
			}
	  }
	  
	  da_SetMemFuncs(memNew, memResize, memFree);
	  global.progname = "OTFproof";
#if AUTOSCRIPT
	scriptfilename[0]='\0';
	for (i = 0; i < argc; i++)
	{
		if (strcmp(argv[i], "-X") == 0)
		{
			if ((argv[i+1] != NULL) && (argv[i+1][0] != '\0'))
			{
				strcpy(scriptfilename, argv[i+1]);
				foundXswitch = 1;
			}
			break;
		}
	}
#endif 
	proofResetPolicies();
	argi = opt_Scan(argc, argv, opt_NOPTS(opt), opt, NULL, NULL);
	
	if (opt_hasError())
		{
		if (PyOutFile != NULL)
			{
			fclose(PyOutFile);
			PyOutFile = NULL;
			}
 		  freemap();
		  argFree(argfree, argv);
		  return Py_None;
		}
		
	 if (opt_Present("-@"))
		proofSetGlyphSize(glyphptsize);

	  if (opt_Present("-V"))  /* equivalent to "-p6" */
		proofSetPolicy(6, 1); 

	  files = argc - argi;

	  for (; argi < argc; argi++)
		{
		  filename = argv[argi];
		  
			fileOpen(filename);
			if (!fileIsOpened())
		  {
		  	warning(SPOT_MSG_BADFILE, filename);
			fileClose();
			continue;
		  }
/*			fprintf(OUTPUTBUFF, "\nProofing %s.\n", filename);			*/
		  tries = 0;
		  /* See if we can recognize the file type */
		  value = fileSniff();	
		  switch (value)
			{
			case bits_:
			case typ1_:		
			case true_:
			case mor0_:
			case OTTO_:
			case VERSION(1,0):
			  sfntRead(0, -1);	/* Read plain sfnt file */
			  sfntDump();
			  sfntFree(1);		  
			  break;
			case ttcf_:
			  sfntTTCRead(0);		/* Read TTC file */
			  continue;
			  break;
			case 256:
			  SEEK_ABS(0); /* Raw resource file as a data fork */ 
			  resRead(0);			/* Read and dump  Macintosh resource file */
			  continue;
			  break;
			case sig_AppleSingle:
			case sig_AppleDouble:
				doASDFormats((ctlTag)value);
				break;
			default:
				warning(SPOT_MSG_BADFILE, filename);
			  	fileClose();
			  continue;
			}

		  fileClose();
		  freemap();
		  argFree(argfree, argv);
#if MEMCHECK
		  memReport();
#endif
		fclose(PyOutFile);
		PyOutFile = NULL;
		  return Py_None;
		}
#if AUTOSCRIPT	
execscript:
			{
				char * end;
				
				end=strrchr(scriptfilename, '\\');
				if(end==NULL)
					sourcepath="";
				else{
					char *scurr = scriptfilename;
					char *dcurr;
					
					sourcepath=(char *)memNew(strlen(scriptfilename));
					dcurr = sourcepath;
					while(scurr!=end)
					{
						*dcurr++=*scurr++;
					}		
					*dcurr=0;
				}
			
			}

	  for (i = 0; i < script.cmdline.cnt ; i++) 
	  {
		char * tempfilename;
		
		cmdl = da_INDEX(script.cmdline, i);
		if (cmdl->args.cnt < 2) continue;

		proofResetPolicies();
		
		{
			IntX a;
			
			inform(SPOT_MSG_EOLN);
			message(SPOT_MSG_ECHOSCRIPTCMD);
			for (a = 1; a < cmdl->args.cnt; a++)
			{
				inform(SPOT_MSG_RAWSTRING, cmdl->args.array[a]);
			}
			inform(SPOT_MSG_EOLN);
		}
		
		argi = opt_Scan(cmdl->args.cnt, cmdl->args.array, opt_NOPTS(opt), opt, NULL, NULL);		

		if (opt_hasError())
			{
			if (PyOutFile != NULL)
				{
				fclose(PyOutFile);
				PyOutFile = NULL;
				}
			freemap();
			argFree(argfree, argv);
			return Py_None;
			}

		if (opt_Present("-@"))
			proofSetGlyphSize(glyphptsize);
	  	if (opt_Present("-V"))  /* equivalent to "-p6" */
			proofSetPolicy(6, 1); 

		tempfilename = MakeFullPath(cmdl->args.array[cmdl->args.cnt-1]);
		
		
		if (fileExists(tempfilename) )
		  { 						/* (new) font filename on cmdline */
			memFree(tempfilename);
			if (filename != NULL) /* not first time */
			{
			  fileClose(); /* previous font file */
	  		  sfntFree(1);
		  	}
			if(sourcepath[0]!='\0')
				filename=MakeFullPath(cmdl->args.array[cmdl->args.cnt-1]);
			else
				filename = cmdl->args.array[cmdl->args.cnt-1];
			fileOpen(filename);
			  tries=0;
retry:
			/* See if we can recognize the file type */
			value = fileSniff();	
			switch (value)
			  {
			  case bits_:
			  case typ1_:		
			  case true_:
			  case mor0_:
			  case OTTO_:
			  case VERSION(1,0):
				sfntRead(0, -1);	/* Read plain sfnt file */
				break;
			  case ttcf_:
				sfntTTCRead(0);		/* Read TTC file */
				continue;
				break;
			  case 256:
				resRead(0);			/* Read Macintosh resource file */
				continue;
				break;
			  default:	 
 				warning(SPOT_MSG_BADFILE, filename);
				fileClose();
				continue;
			  }
		  }
		else
		{
		  /* none specified */
		  fatal(SPOT_MSG_MISSINGFILENAME);
		  memFree(tempfilename);
		  continue;
		}
		
		sfntDump();
		
scriptAbEnd:
		sfntFree(1);
	    fileClose();
	  }
	  global.doingScripting = 0;
#endif	

	/*fprintf(stderr, "\nDone.\n");*/
	
	fileClose();	
	freemap();
	argFree(argfree, argv);
#if MEMCHECK
	memReport();
#endif
	fclose(PyOutFile);
	PyOutFile = NULL;
	return Py_None;
}
Esempio n. 14
0
PyObject * proof_complement(PyObject *self, PyObject *args)
{
	static double glyphptsize = STDPAGE_GLYPH_PTSIZE;
	static opt_Option opt[] =
	{
	  {"-u", opt_Call, showUsage},
	  {"-h", opt_Call, showHelp},
	  {"-ht", opt_Call, sfntTableSpecificUsage},
	  {"-l", opt_Flag},
	  {"-O", opt_Flag},
	  {"-r", opt_Flag},
	  {"-n", opt_Flag},
	  {"-nc", opt_Flag},
	  {"-T", opt_Flag},
	  {"-F", opt_Flag},
	  {"-G", opt_Flag},
	  {"-V", opt_Flag},
	  {"-m", opt_Flag},
	  {"-d", opt_Flag},
	  {"-br", opt_Flag},
	  {"-i", resIdScan},
	  {"-o", sfntTTCScan},
	  {"-t", sfntTagScan},
	  {"-P", sfntFeatScan}, 
	  {"-A", sfntFeatScan}, 
	  {"-p", proofPolicyScan}, 
	  {"-a", opt_Flag},
	  {"-R", opt_Flag},
	  {"-c", opt_Flag},
	  {"-g", glyfGlyphScan},
	  {"-b", glyfBBoxScan},
	  {"-s", glyfScaleScan},
	  {"-@", opt_Double, &glyphptsize},
	  {"-C", opt_Int, &cmapSelected},
	};

	IntN argi;
	Card32 value;
	char *outfilename;
	char *infilenameorig;
	IntN status;
	char *argv[30];
	int argc;
	int startIndex=0;
	int infilesSize;
	int useStdOut = 0;
	int i;
	

	{
	/* To allow gdb to attach to process */
	char* do_debug_sleep;
	do_debug_sleep = getenv("STOP_GLYPH_PROOFER");
	while (do_debug_sleep != NULL)
		sleep(1);
	}	


	value = setjmp(mark);
	
	if(value==-1){
		PyErr_SetString(ErrorObject, "Fatal Error");
		if (PyOutFile != NULL)
			{
			fclose(PyOutFile);
			PyOutFile = NULL;
			}
		freemap();
		return NULL;
	}
	
	if(!PyArg_ParseTuple(args, "s#iisiii", 
				&infilename, &infilesSize, 
				&(gcr.synOnly), &(gcr.numFonts), 
				&outfilename, 
				&(gcr.maxNumGlyphs), &(gcr.byname), &useStdOut)){
		freemap();
		return NULL;
	}

	if (PyOutFile != NULL)
		freopen(outfilename, "w", PyOutFile);
	else
		PyOutFile = fopen(outfilename, "w");
	
	infilenameorig=infilename;
	gcr.reportNumber=0;
	gcr.startGlyph=0;
	gcr.numGlyphs=2;
	gcr.endGlyph=1;
	
	VORGfound=0;
	status = setjmp(global.env);
	if (status)
	{
		if(status==2){
			PyErr_SetString(ErrorObject, "Fatal Error");
			if (PyOutFile != NULL)
				{
				fclose(PyOutFile);
				PyOutFile = NULL;
				}
			freemap();
			return NULL;
		}else{
			if (PyOutFile != NULL)
				{
				fclose(PyOutFile);
				PyOutFile = NULL;
				}
			freemap();
			return Py_None;
		}
	}

	da_SetMemFuncs(memNew, memResize, memFree);
	global.progname = "Glyph_Proofer";
	outputfilebase =  "glyphproofer";
	
	fprintf(OUTPUTBUFF, "%s-library v.%s\n\n", global.progname, libversion);
	
	
	while(gcr.endGlyph!=0 && gcr.endGlyph<gcr.numGlyphs)
	{
		int newstart=gcr.endGlyph;
		infilename=infilenameorig;
		
		if (newstart==1) newstart=0;
		
		/*fprintf(stderr, "Starting again with %d of %d\n", gcr.endGlyph, gcr.numGlyphs);*/
		gcr.endGlyph=0;
		
		for (i=0; i<gcr.numFonts; i++)
		{
			gcr.startGlyph=newstart;	
			/*fprintf(OUTPUTBUFF, "Processing %s\n", infilename);*/
			argc = 0;
			argv[argc++]=global.progname;
			if (useStdOut)
			argv[argc++]="-O";
			argv[argc++]="-tCFF_=9";
			argv[argc++]="-d";
			argv[argc++]="-l";
			argv[argc++]=infilename;
			
			argi = opt_Scan(argc, argv, opt_NOPTS(opt), opt, NULL, NULL);
			
			if (opt_hasError())
				{
				if (PyOutFile != NULL)
					{
					fclose(PyOutFile);
					PyOutFile = NULL;
					}
		 		  freemap();
				  return NULL;
				}
			
			fileOpen(infilename);
			
			if (!fileIsOpened())
			{
				warning(SPOT_MSG_BADFILE, infilename);
				fileClose();
				if (PyOutFile != NULL)
					{
					fclose(PyOutFile);
					PyOutFile = NULL;
					}
				freemap();
				return NULL;
			}else{
				/* See if we can recognize the file type */
				value = fileSniff();
				switch (value)
				{
					case bits_:
					case typ1_:		
					case true_:
					case mor0_:
					case OTTO_:
					case VERSION(1,0):
					  sfntRead(0, -1);	/* Read plain sfnt file */
					  sfntDump();
					  sfntFree(1);		  
					  break;
					case ttcf_:
					  sfntTTCRead(0);		/* Read TTC file */
					  break;
					case 256:
					  SEEK_ABS(0); /* Raw resource file as a data fork */ 
					  resRead(0);			/* Read and dump  Macintosh resource file */
					  break;
					default:
						warning(SPOT_MSG_BADFILE, infilename);
						PyErr_SetString(ErrorObject, "Fatal Error: Not a valid font file");
					  	fileClose();
						if (PyOutFile != NULL)
							{
							fclose(PyOutFile);
							PyOutFile = NULL;
							}
						freemap();
						return NULL;
				}
				fileClose();
				
			}
		
			while(*infilename)
				infilename++;
			infilename++;  /*Gets us past the next NULL character*/
		}
	}
	CFF_SynopsisFinish();
	fclose(PyOutFile);
	PyOutFile = NULL;
	freemap();
	return Py_None;
}