/* * The standard OrionModel constructor. */ OrionModelClass *New_OrionModelClassFromStream( tsiMemObject *mem, InputStream *in ) { int i, j; unsigned char major, minor; OrionModelClass *t = (OrionModelClass *) tsi_AllocMem( mem, sizeof( OrionModelClass ) ); t->mem = mem; major = ReadUnsignedByteMacro( in ); minor = ReadUnsignedByteMacro( in ); t->num_eb1 = ReadUnsignedByteMacro( in ); t->num_e = ReadUnsignedByteMacro( in ); t->num_eb2 = t->num_e - t->num_eb1 - 1; assert( major == ORION_MAJOR_VERSION ); assert( minor == ORION_MINOR_VERSION ); /* assert( t->num_eb1 == NUM_ECOPYX ); assert( t->num_e == NUM_EX ); */ t->copy = (SCODER **)tsi_AllocMem( mem, t->num_eb1 * sizeof( SCODER * ) ); t->literal = (SCODER **)tsi_AllocMem( mem, t->num_e * sizeof( SCODER * ) ); t->control = New_SCODER_FromStream( mem, in ); t->ep = New_SCODER_FromStream( mem, in ); for ( i = 0; i < t->num_eb1; i++ ) { t->copy[i] = New_SCODER_FromStream( mem, in ); } for ( i = 0; i < t->num_e; i++ ) { t->literal[i] = New_SCODER_FromStream( mem, in ); } t->dx = (short *)tsi_AllocMem( mem, t->num_eb1 * 256 * sizeof(short) ); t->dy = (short *)tsi_AllocMem( mem, t->num_eb1 * 256 * sizeof(short) ); t->onCurve = (char *) tsi_AllocMem( mem, t->num_eb1 * 256 * sizeof(char) ); j = t->num_eb1 * 256; for ( i = 0; i < j; i++ ) { t->onCurve[i] = (char)ReadDeltaXYValue( in, &(t->dx[i]), &(t->dy[i]) ); } return t; /*****/ }
static void ReadBigMetrics( bigGlyphMetricsT2K *m, InputStream *in ) { m->height = ReadUnsignedByteMacro( in ); m->width = ReadUnsignedByteMacro( in ); m->horiBearingX = (tt_int8)ReadUnsignedByteMacro( in ); m->horiBearingY = (tt_int8)ReadUnsignedByteMacro( in ); m->horiAdvance = ReadUnsignedByteMacro( in ); m->vertBearingX = (tt_int8)ReadUnsignedByteMacro( in ); m->vertBearingY = (tt_int8)ReadUnsignedByteMacro( in ); m->vertAdvance = ReadUnsignedByteMacro( in ); }
/* * 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; /*****/ }
static void ReadSmallMetrics( bigGlyphMetricsT2K *m, InputStream *in ) { /* We read smallGlyphMetrics but put the result into bigGlyphMetrics to simplify. */ /* smallGlyphMetrics *m */ m->height = ReadUnsignedByteMacro( in ); m->width = ReadUnsignedByteMacro( in ); m->horiBearingX = (tt_int8)ReadUnsignedByteMacro( in ); m->horiBearingY = (tt_int8)ReadUnsignedByteMacro( in ); m->horiAdvance = ReadUnsignedByteMacro( in ); /* Copy over to the other direction */ m->vertBearingX = m->horiBearingX; m->vertBearingY = m->horiBearingY; m->vertAdvance = m->horiAdvance; #ifdef OLD /* smallGlyphMetrics *m */ m->height = ReadUnsignedByteMacro( in ); m->width = ReadUnsignedByteMacro( in ); m->BearingX = (tt_int8)ReadUnsignedByteMacro( in ); m->BearingY = (tt_int8)ReadUnsignedByteMacro( in ); m->Advance = ReadUnsignedByteMacro( in ); #endif }
/* Read in prep class instructions */ prepClass *Read_prepClass ( prepClass *t, InputStream *in ) { tt_uint32 numInstructions=t->numInstructions; tt_uint8 *instructionPtr=t->instructions; #if 0 for ( i = 0; i < numInstructions; i++ ) { *instructionPtr++ = ReadUnsignedByteMacro( in ); } #else ReadSegment( in, instructionPtr, numInstructions ); #endif return t; /*****/ }
/* * 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; /*****/ }