Пример #1
0
// A match is a font object created for
//	1) the same rc type
//	2) the same fmi
//	3) the same accessor
// All fonts served by the native displayer can be shared
// irrespective of the accessor.
//
// So in the algorithm for a match of RcFmi2Font(), we will
// look for only sharable fonts.
//
struct nff *
wfFontObjectCache::RcFmi2Font(struct nfrc *rc, struct nffmi *fmi)
{
	struct nff *f = NULL;
	struct wfListElement *tmp = head;
    for (; tmp; tmp = tmp->next)
	  {
		struct font_store *ele = (struct font_store *) tmp->item;

		cfImpl *oimpl = nff2cfImpl(ele->f);
		FontObject *fob = (FontObject *)oimpl->object;
		if (!fob->isShared())
		{
			continue;
		}
		
		jint f_rcMajorType = nff_GetRcMajorType(ele->f, NULL);
		jint f_rcMinorType = nff_GetRcMinorType(ele->f, NULL);
		if (nfrc_IsEquivalent(rc, f_rcMajorType, f_rcMinorType, NULL)) {
			const char* eleFmiStr = nffmi_toString(ele->fmi, NULL);
			const char* fmiStr = nffmi_toString(fmi, NULL);
			if (eleFmiStr && fmiStr && !strcmp(eleFmiStr, fmiStr)) {
				f = ele->f;
				nff_addRef(f, NULL);
				break;
			}
		}
	  }
	return f;
}