Пример #1
0
/*ARGSUSED*/
_cf_release(struct cf* self, jint op, JMCException* *exc)
{
	cfImplHeader* impl = (cfImplHeader*)cf2cfImpl(self);
	--impl->refcount;

	// Run the GC
	cfImpl *oimpl = cf2cfImpl(self);
	FontObject *fob = (FontObject *)oimpl->object;
	int ret = fob->GC();
	
	if (impl->refcount == 0)
	{
		cf_finalize(self, exc);
	}
}
Пример #2
0
void wfComplete(NET_StreamClass *stream)
{
	struct stream_data *data = (struct stream_data *) stream->data_object;
	void *fh = nfstrm_Complete((nfstrm *)data->fpStream, NULL);
	cfImpl *oimpl = cf2cfImpl(data->f);
	FontObject *fob = (FontObject *)oimpl->object;	
	if (fh)
	{
		// Include this fh in the correct FontObject
		fob->addFontHandle(data->fpPeer, fh);
		WF_TRACEMSG( ("NF: Stream done. Fonthandle created. Setting font state to COMPLETE.") );
		fob->setState(NF_FONT_COMPLETE);
	}
	else
	{
		// This font will never become ok as the fonthandle
		// that we got was 0. We will assume that the data
		// that we streamed didn't make a valid font.
		WF_TRACEMSG( ("NF: Stream done. Fonthandle NOT CREATED. Setting font state to ERROR.") );
		fob->setState(NF_FONT_ERROR);
	}
	
	// Notify the nfdoer on the status of Complete
	wf_NotifyObserver(data);
	wf_ReleaseStreamData(data);
	return;
}
Пример #3
0
/*ARGSUSED*/
_cf_GetState(struct cf* self, jint op, struct JMCException* *exceptionThrown)
{
	cfImpl *oimpl = cf2cfImpl(self);
	XP_ASSERT(oimpl->header.refcount);
	FontObject *fob = (FontObject *)oimpl->object;
	return((jint)fob->GetState());
}
Пример #4
0
/*ARGSUSED*/
_cf_GetMatchInfo(struct cf* self, jint op, struct nfrc *rc,
				 jint pointsize, struct JMCException* *exceptionThrown)
{
	cfImpl *oimpl = cf2cfImpl(self);
	XP_ASSERT(oimpl->header.refcount);
	FontObject *fob = (FontObject *)oimpl->object;
	return(fob->GetMatchInfo(rc, pointsize));
}
Пример #5
0
/*ARGSUSED*/
_cf_EnumerateSizes(struct cf* self, jint op, struct nfrc *rc,
				   struct JMCException* *exceptionThrown)
{
	cfImpl *oimpl = cf2cfImpl(self);
	XP_ASSERT(oimpl->header.refcount);
	FontObject *fob = (FontObject *)oimpl->object;
	return(fob->EnumerateSizes(rc));
}
Пример #6
0
int
wfFontObjectCache::releaseRf(struct nfrf *rf)
{
#ifdef DEBUG
	WF_TRACEMSG( ("NF: Deleting rf (0x%x).", rf) );
#endif /* DEBUG */

	struct wfListElement *tmp = head;
	int nrelease = 0;
    while(tmp)
	{
		struct font_store *ele = (struct font_store *) tmp->item;

		// We know that this Font object was created by us. So we can
		// snoop into its implementation to call implementation specific
		// methods.
		cfImpl *oimpl = cf2cfImpl(ele->f);
		FontObject *fob = (FontObject *)oimpl->object;

		//
		// WARNING: Before calling FontObject::releaseRf we need to get the
		// next item in the list. This is because the FontObject could turn
		// around and decide to remove itself from our list.
		//
		tmp = tmp->next;
		int n = fob->releaseRf(rf);
		if (n)
		{
			// Run the garbage collector since some rf was released. This
			// could even cause the font object to be deleted.
			if (!fob->GC())
			{
				struct nff *f_to_delete = (struct nff *) ele->f;

				// Delete the FontObject. Deleting the FontObject will turn
				// around and delete the element in the fontObjectCache list
				// by calling FontObjectCache::releaseFont().
				//
				// So DONT REMOVE THE ELEMENT. It will be removed.
				// wfList::remove(ele);

				nff_addRef(f_to_delete, NULL);
				nff_release(f_to_delete, NULL);
			}
		}
		nrelease += n;
	}

	if (nrelease)
	{
		// Some font had this rf. It is not possbile then for the same rf
		// exist with webfonts. Skip looking into the webfonts.
		return(nrelease);
	}
	return (nrelease);
}
Пример #7
0
void wfAbort(NET_StreamClass *stream, int status)
{
	struct stream_data *data = (struct stream_data *) stream->data_object;
	nfstrm_Abort((nfstrm *)data->fpStream, (jint) status, NULL);

	// Mark the font as in error
	cfImpl *oimpl = cf2cfImpl(data->f);
	FontObject *fob = (FontObject *)oimpl->object;
	fob->setState(NF_FONT_ERROR);	
	
	// Notify nfdoer with status of Abort
	wf_NotifyObserver(data);
	wf_ReleaseStreamData(data);
	return;
}
Пример #8
0
/*ARGSUSED*/
_cf_init(struct cf* self, struct JMCException* *exceptionThrown,
		 struct nfrc *rc)
{
	cfImpl *oimpl = cf2cfImpl(self);
	FontObject *fobj = new FontObject((struct nff *)self, rc);
	if (fobj == NULL)
	  {
		JMC_EXCEPTION(exceptionThrown, JMCEXCEPTION_OUT_OF_MEMORY);
	  }
	else
	  {
		oimpl->object = fobj;
	  }
	return;
}
Пример #9
0
/*ARGSUSED*/
_cf_finalize(struct cf* self, jint op, JMCException* *exception)
{
	/* Release this font object from the fontObjectCache in the Broker */
	cfbImpl *fbimpl = cfb2cfbImpl(WF_fbc);
	FontBrokerObject *fbobj = (FontBrokerObject *)fbimpl->object;

	WF_TRACEMSG( ("NF: Deleting font object [0x%x].", fbobj) );
	fbobj->fontObjectCache.releaseFont((struct nff *)self);
	
	/* Delete the font object */
	struct cfImpl *oimpl = cf2cfImpl(self);
	FontObject *fob = (FontObject *)oimpl->object;
	delete fob;
	
	/* Finally, free the memory for the object containter. */
	XP_FREEIF(self);
}
Пример #10
0
struct nff *
wfFontObjectCache::
Rf2Font(struct nfrf *rf)
{
	struct nff *f = NULL;
	struct wfListElement *tmp = head;
    for (; tmp; tmp = tmp->next)
	  {
		struct font_store *ele = (struct font_store *) tmp->item;

		// We know that this Font object was created by us. So we can
		// snoop into its implementation to call implementation specific
		// methods.
		cfImpl *oimpl = cf2cfImpl(ele->f);
		FontObject *fob = (FontObject *)oimpl->object;
		if (fob->isRfExist(rf))
		  {
			f = ele->f;
			nff_addRef((struct nff *)f, NULL);
			break;
		  }
	  }
	return f;
}
Пример #11
0
/*ARGSUSED*/
_cf_getInterface(struct cf* self, jint op, const JMCInterfaceID* iid, JMCException* *exc)
{
	if (memcmp(iid, &nff_ID, sizeof(JMCInterfaceID)) == 0)
		return cfImpl2cf(cf2cfImpl(self));
	return _cf_getBackwardCompatibleInterface(self, iid, exc);
}