EStatusCode Type1ToType2Converter::CallOtherSubr(const LongList& inOperandList,LongList& outPostScriptOperandStack)
{
	// should get here onther for 0 othersubr, to mark flex segment end. implement it...and also insert a node
	// for flex
	LongList::const_reverse_iterator it = inOperandList.rbegin();
	long otherSubrIndex = *it; // this should be 0
	++it;
	long argumentsCount = *it;
	++it;

	// the next argument should be the FD...place it in the parameters collection
	long flexDepth = *it;

	mFlexParameters.push_back(flexDepth);

	// take care of the postscript operand stack
	for(long i=0;i<argumentsCount;++i)
	{
		outPostScriptOperandStack.push_back(*it);
		++it;
	}

	// now finalize flex, by placing a type 2 flex command
	EStatusCode status = RecordOperatorWithParameters(0x0c23,mFlexParameters);

	// cleanup flex mode
	mFlexParameters.clear();
	mInFlexCollectionMode = false;
	return status;
}
EStatusCode Type1ToType2Converter::Type1Seac(const LongList& inOperandList)
{
	// le'ts convert it already to the final EndChar...and stop any later recording
	
	// note that type2 endchar implementation avoids sidebearing
	LongList params;
	LongList::const_iterator it = inOperandList.begin();
	++it;
	for(; it != inOperandList.end();++it)
		params.push_back(*it);
	return RecordOperatorWithParameters(14,params);
}
Example #3
0
bool Object_content::Read(Environment &env,
									Stream &stream, Image::Format format)
{
	Signal &sig = env.GetSignal();
	int cntIcons = 0;
	do {
		IconDir iconDir;
		if (stream.Read(sig, &iconDir, IconDir::Size) < IconDir::Size) {
			sig.SetError(ERR_FormatError, "invalid ICO format");
			return false;
		}
		cntIcons = Gura_UnpackUShort(iconDir.idCount);
	} while (0);
	LongList imageOffsets;
	for (int iIcon = 0; iIcon < cntIcons; iIcon++) {
		IconDirEntry iconDirEntry;
		if (stream.Read(sig, &iconDirEntry, IconDirEntry::Size) < IconDirEntry::Size) {
			sig.SetError(ERR_FormatError, "invalid ICO format");
			return false;
		}
		long imageOffset = Gura_UnpackLong(iconDirEntry.dwImageOffset);
		imageOffsets.push_back(imageOffset);
	}
	foreach (LongList, pImageOffset, imageOffsets) {
		long imageOffset = *pImageOffset;
		if (!stream.Seek(sig, imageOffset, Stream::SeekSet)) return false;
		Image::BitmapInfoHeader bih;
		if (stream.Read(sig, &bih, Image::BitmapInfoHeader::Size) < Image::BitmapInfoHeader::Size) {
			sig.SetError(ERR_FormatError, "invalid ICO format");
			return false;
		}
		int biWidth = Gura_UnpackLong(bih.biWidth);
		int biHeight = Gura_UnpackLong(bih.biHeight) / 2;
		UShort biBitCount = Gura_UnpackUShort(bih.biBitCount);
		AutoPtr<Image> pImage(new Image(format));
		if (!pImage->ReadDIBPalette(env, stream, biBitCount)) return false;
		if (!pImage->ReadDIB(sig, stream, biWidth, biHeight, biBitCount, true)) {
			return false;
		}
		_valList.push_back(Value(new Object_image(env, pImage.release())));
	}