Example #1
0
/*
 * The ebscClass class contructor (EBSC table)
 */
ebscClass *New_ebscClass( tsiMemObject *mem, InputStream *in )
{
	F16Dot16 version;
	register int i, j;
	ebscClass *t = NULL;
	
	version			= ReadInt32(in);
	
	/* Assume we understand this version number range. */
	if ( version >= 0x00020000 && version < 0x00030000 ) {
		t 				= (ebscClass *) tsi_AllocMem( mem, sizeof( ebscClass ) );
		t->mem			= mem;

		t->version		= version;
		t->numSizes		= (tt_uint32)ReadInt32(in);
		
        t->table = (bitmapScaleEntry *) tsi_AllocArray(mem, t->numSizes, sizeof(bitmapScaleEntry));
		for ( i = 0; i < (int)t->numSizes; i++ ) {
			for ( j = 0; j < NUM_SBIT_METRICS_BYTES; j++ ) {
				t->table[i].hori[j] = ReadUnsignedByteMacro( in );
			}
			for ( j = 0; j < NUM_SBIT_METRICS_BYTES; j++ ) {
				t->table[i].vert[j] = ReadUnsignedByteMacro( in );
			}
			t->table[i].ppemX			= ReadUnsignedByteMacro( in );
			t->table[i].ppemY			= ReadUnsignedByteMacro( in );
			t->table[i].substitutePpemX	= ReadUnsignedByteMacro( in );
			t->table[i].substitutePpemY	= ReadUnsignedByteMacro( in );
		}
	}
	return t; /*****/
}
Example #2
0
	/* Allocate an cvt class, but do not read data yet. */
	cvtClass *New_cvtEmptyClass
	( 
		tsiMemObject *mem, 
		tt_int32 numFWords
	)
	{
		/* Allocate the class object.*/
		cvtClass *t = (cvtClass *) tsi_AllocMem( mem, sizeof( cvtClass ) );
		/* Save the private memory object*/
		t->mem		 = mem;
		t->numFWords = numFWords;
		/* allocate a pointer, even when zero.*/
        t->varFWords = (tt_uint16 *) tsi_AllocArray(mem, numFWords, sizeof(tt_uint16));
		return t; /*****/
	}
Example #3
0
/*
 * The blocClass class contructor (EBLC/bloc table)
 */
blocClass *New_blocClass( tsiMemObject *mem, int fontIsSbitOnly, InputStream *in )
{
	F16Dot16 version;
	tt_uint32	startOffset;
	register int i;
	blocClass *t = NULL;
	
	startOffset			= Tell_InputStream( in );
	version				= ReadInt32(in);
	
	/* Assume we understand this version number range. */
	if ( version >= 0x00020000 && version < 0x00030000 ) {
		t 					= (blocClass *) tsi_AllocMem( mem, sizeof( blocClass ) );
		t->mem				= mem;
		t->startOffset  	= startOffset;
		t->fontIsSbitOnly 	= fontIsSbitOnly;
		
		/* Read the EBLC/bloc header. */
		t->version			= version;
		t->nTables			= (tt_uint32)ReadInt32(in);
		
		/* The EBLC/bloc header is followed immediately by the bitmapSizeTable array(s). */
        t->table = (bitmapSizeTableT2K **) tsi_AllocArray(mem, t->nTables, sizeof(bitmapSizeTableT2K *));
		for ( i = 0; i < (int)t->nTables; i++ ) {
			t->table[i] = New_bitmapSizeTable( mem, in, t->startOffset ); /* One bitmapSizeTable for each strike */
		}
		/* Initialize data fields */
		t->gInfo.offsetA		= 0;
		t->gInfo.offsetB		= 0;
		t->gInfo.imageFormat	= 0;
		t->gInfo.glyphIndex		= 0;
		t->gInfo.ppemX			= 0;
		t->gInfo.ppemY			= 0;
		
		t->gInfo.baseAddr		= NULL;
		t->gInfo.rowBytes		= 0;
	}
	
	return t; /*****/
}
Example #4
0
/*
 * The bitmapSizeTable class constructor.
 * Each strike is defined by one bitmapSizeTable.
 */
static bitmapSizeTableT2K *New_bitmapSizeTable( tsiMemObject *mem, InputStream *in, tt_uint32 blocOffset )
{
	register int i;
	tt_uint32 savepos;
	
	bitmapSizeTableT2K *t	= (bitmapSizeTableT2K *) tsi_AllocMem( mem, 
					      sizeof( bitmapSizeTableT2K ) );
	t->mem				= mem;
	
	t->indexSubTableArrayOffset		= (tt_uint32)ReadInt32(in);
	t->indexTableSize				= (tt_uint32)ReadInt32(in);
	t->numberOfIndexSubTables		= (tt_uint32)ReadInt32(in);
	t->colorRef						= (tt_uint32)ReadInt32(in);
	
	for ( i = 0; i < NUM_SBIT_METRICS_BYTES; i++ ) {
		t->hori[i] = ReadUnsignedByteMacro( in );
	}
	for ( i = 0; i < NUM_SBIT_METRICS_BYTES; i++ ) {
		t->vert[i] = ReadUnsignedByteMacro( in );
	}
	t->startGlyphIndex				= (tt_uint16)ReadInt16( in );
	t->endGlyphIndex				= (tt_uint16)ReadInt16( in );

	t->ppemX						= ReadUnsignedByteMacro( in );
	t->ppemY						= ReadUnsignedByteMacro( in );
	t->bitDepth						= ReadUnsignedByteMacro( in );
	t->flags						= ReadUnsignedByteMacro( in );

    t->table = (indexSubTableArray *) tsi_AllocArray(mem, t->numberOfIndexSubTables, sizeof(indexSubTableArray));

	savepos = Tell_InputStream( in );
	Seek_InputStream( in, blocOffset + t->indexSubTableArrayOffset );
	for ( i = 0; i < (int)t->numberOfIndexSubTables; i++ ) {
		t->table[i].firstGlyphIndex		= (tt_uint16)ReadInt16( in );
		t->table[i].lastGlyphIndex		= (tt_uint16)ReadInt16( in );
		t->table[i].additionalOffsetToIndexSubTable	= (tt_uint32)ReadInt32(in);
	}
	Seek_InputStream( in, savepos );
	return t; /*****/
}