Esempio n. 1
0
LOCAL void
dfb_closevisual(DFBDISPLAY *mod, struct TVRequest *req)
{
	struct DFBPen *pen;
	TAPTR exec = TGetExecBase(mod);
	DFBWINDOW *v = req->tvr_Op.CloseWindow.Window;
	if (v == TNULL) return;

	TDBPRINTF(TDB_INFO,("Visual close\n"));

	TRemove(&v->node);

	if (mod->dfb_Focused == (TAPTR) v)
	{
		/* pass focus on to the next window */
		DFBWINDOW *vt = (DFBWINDOW *)TFIRSTNODE(&mod->dfb_vlist);
		if (vt) genimsg(mod, TNULL, vt, TITYPE_FOCUS);
		mod->dfb_Focused = (TAPTR) vt;
	}

	if (mod->dfb_Active == (TAPTR) v)
		mod->dfb_Active = TNULL;

	while ((pen = (struct DFBPen *) TRemHead(&v->penlist)))
	{
		/* free pens */
		TRemove(&pen->node);
		TExecFree(mod->dfb_ExecBase, pen);
	}

	v->winsurface->Release(v->winsurface);
	v->window->Release(v->window);
	mod->dfb_fm.defref--;
	TExecFree(exec, v);
}
Esempio n. 2
0
static void rfb_freefontnode(struct rfb_Display *mod, struct rfb_FontNode *fn)
{
	if (!fn)
		return;
	TExecFree(mod->rfb_ExecBase, fn->name);
	TExecFree(mod->rfb_ExecBase, fn);
}
Esempio n. 3
0
/* FontQueryHandle destructor
** free all memory associated with a fontqueryhandle including
** all fontquerynodes, a fontqueryhandle is obtained by calling
** dfb_hostqueryfonts()
*/
static THOOKENTRY TTAG
dfb_fqhdestroy(struct THook *hook, TAPTR obj, TTAG msg)
{
	if (msg == TMSG_DESTROY)
	{
		struct FontQueryHandle *fqh = obj;
		DFBDISPLAY *mod = fqh->handle.thn_Owner;
		TAPTR exec = TGetExecBase(mod);
		struct TNode *node, *next;

		node = fqh->reslist.tlh_Head;
		for (; (next = node->tln_Succ); node = next)
		{
			struct FontQueryNode *fqn = (struct FontQueryNode *)node;

			/* remove from resultlist */
			TRemove(&fqn->node);

			/* destroy fontname */
			if (fqn->tags[0].tti_Value)
				TExecFree(exec, (TAPTR)fqn->tags[0].tti_Value);

			/* destroy node */
			TExecFree(exec, fqn);
		}

		/* destroy queryhandle */
		TExecFree(exec, fqh);
	}

	return 0;
}
Esempio n. 4
0
LOCAL TAPTR
dfb_hostqueryfonts(TMOD_DFB *mod, TTAGITEM *tags)
{
	TSTRPTR fname = TNULL;
	struct fnt_attr fattr;
	struct TNode *node, *next;
	struct FontQueryHandle *fqh = TNULL;
	TAPTR exec = TGetExecBase(mod);

	TDBPRINTF(10, ("***********************************************\n"));

	/* init fontname list */
	TInitList(&fattr.fnlist);

	/* fetch and parse fname */
	fname = (TSTRPTR) TGetTag(tags, TVisual_FontName, (TTAG) FNT_WILDCARD);
	if (fname)	fnt_getfnnodes(mod, &fattr.fnlist, fname);

	/* fetch user specified attributes */
	fattr.fpxsize = (TINT) TGetTag(tags, TVisual_FontPxSize, (TTAG) FNT_DEFPXSIZE);
	fattr.fnum = (TINT) TGetTag(tags, TVisual_FontNumResults, (TTAG) INT_MAX);
	/* not yet
	fattr.fitalic = (TBOOL) TGetTag(tags, TVisual_FontItalic, (TTAG) FNTQUERY_UNDEFINED);
	fattr.fbold = (TBOOL) TGetTag(tags, TVisual_FontBold, (TTAG) FNTQUERY_UNDEFINED);
	*/

	/* init result list */
	fqh = TExecAlloc0(exec, mod->dfb_MemMgr, sizeof(struct FontQueryHandle));
	if (fqh)
	{
		fqh->handle.thn_Owner = mod;
		/* connect destructor */
		TInitHook(&fqh->handle.thn_Hook, fqhdestroy, fqh);
		TInitList(&fqh->reslist);
		/* init list iterator */
		fqh->nptr = &fqh->reslist.tlh_Head;

		hostqueryfonts(mod, fqh, &fattr);
		TDB(10,(fnt_dumplist(&fqh->reslist)));
		TDBPRINTF(10, ("***********************************************\n"));
	}
	else
		TDBPRINTF(20, ("out of memory :(\n"));

	/* free memory of fnt_nodes */
	for (node = fattr.fnlist.tlh_Head; (next = node->tln_Succ); node = next)
	{
		struct fnt_node *fnn = (struct fnt_node *)node;
		TExecFree(exec, fnn->fname);
		TRemove(&fnn->node);
		TExecFree(exec, fnn);
	}

	return fqh;
}
Esempio n. 5
0
LOCAL void
dfb_hostclosefont(DFBDISPLAY *mod, TAPTR font)
{
	struct FontNode *fn = (struct FontNode *) font;
	TAPTR exec = TGetExecBase(mod);

	if (font == mod->dfb_fm.deffont)
	{
		if (mod->dfb_fm.defref)
		{
			/* prevent freeing of default font if it's */
			/* still referenced */
			mod->dfb_fm.defref--;
			return;
		}
	}

	/* free dfbfont */
	if (fn->font)
	{
		fn->font->Release(fn->font);
		fn->font = TNULL;
	}

	/* remove font from openfonts list */
	TRemove(&fn->handle.thn_Node);

	/* free fontnode itself */
	TExecFree(exec, fn);
}
Esempio n. 6
0
LOCAL TAPTR
dfb_hostopenfont(DFBDISPLAY *mod, TTAGITEM *tags)
{
	struct fnt_attr fattr;
	struct FontNode *fn;
	TAPTR font = TNULL;
	TAPTR exec = TGetExecBase(mod);

	/* fetch user specified attributes */
	fattr.fname = (TSTRPTR) TGetTag(tags, TVisual_FontName, (TTAG) FNT_DEFNAME);
	fattr.fpxsize = (TINT) TGetTag(tags, TVisual_FontPxSize, (TTAG) FNT_DEFPXSIZE);

	/* not yet
	fattr.fitalic = (TBOOL) TGetTag(tags, TVisual_FontItalic, (TTAG) TFALSE);
	fattr.fbold = (TBOOL) TGetTag(tags, TVisual_FontBold, (TTAG) TFALSE);
	fattr.fscale = (TBOOL) TGetTag(tags, TVisual_FontScaleable, (TTAG) TFALSE);
	*/

	if (fattr.fname)
	{
		fn = TExecAlloc0(exec, mod->dfb_MemMgr, sizeof(struct FontNode));
		if (fn)
		{
			fn->handle.thn_Owner = mod;

			if (hostopenfont(mod, fn, &fattr))
			{
				/* load succeeded, save font attributes */
				fn->pxsize = fattr.fpxsize;
				fn->font->GetHeight(fn->font, &fn->height);
				fn->font->GetAscender(fn->font, &fn->ascent);
				fn->font->GetDescender(fn->font, &fn->descent);

				/* not yet
				if (fattr.fitalic)
					fn->attr = FNT_ITALIC;
				if (fattr.fbold)
					fn->attr |= FNT_BOLD;
				*/

				/* append to the list of open fonts */
				TDBPRINTF(TDB_INFO, ("O '%s' %dpx\n", fattr.fname, fattr.fpxsize));
				TAddTail(&mod->dfb_fm.openfonts, &fn->handle.thn_Node);
				font = (TAPTR)fn;
			}
			else
			{
				/* load failed, free fontnode */
				TDBPRINTF(TDB_INFO,("X unable to load '%s'\n", fattr.fname));
				TExecFree(exec, fn);
			}
		}
		else
			TDBPRINTF(TDB_FAIL,("out of memory :(\n"));
	}
	else
		TDBPRINTF(TDB_ERROR,("X invalid fontname '%s' specified\n", fattr.fname));

	return font;
}
Esempio n. 7
0
LOCAL void
dfb_freepen(DFBDISPLAY *mod, struct TVRequest *req)
{
	struct DFBPen *pen = (struct DFBPen *) req->tvr_Op.FreePen.Pen;
	TRemove(&pen->node);
	TExecFree(mod->dfb_ExecBase, pen);
}
Esempio n. 8
0
static TBOOL
hostopenfont(DFBDISPLAY *mod, struct FontNode *fn, struct fnt_attr *fattr)
{
	TBOOL succ = TFALSE;
	TAPTR exec = TGetExecBase(mod);
	DFBFontDescription fdsc;
	TSTRPTR fontfile = TExecAlloc0(exec, mod->dfb_MemMgr,
		strlen(fattr->fname) + strlen(FNT_DEFDIR) + 5);

	if (fontfile)
	{
		fdsc.flags = DFDESC_HEIGHT;
		fdsc.height = fattr->fpxsize;

		sprintf(fontfile, "%s%s.ttf", FNT_DEFDIR, fattr->fname);
		TDBPRINTF(TDB_INFO,("? %s:%d\n", fontfile, fattr->fpxsize));

		if (mod->dfb_DFB->CreateFont(mod->dfb_DFB, fontfile,
			&fdsc, &fn->font) == DFB_OK)
			succ = TTRUE;

		TExecFree(exec, fontfile);
	}
	else
		TDBPRINTF(TDB_FAIL,("out of memory :(\n"));

	return succ;
}
Esempio n. 9
0
TLIBAPI void
TFreeInstance(TAPTR mod)
{
	if (mod)
	{
		TAPTR exec = TGetExecBase(mod);
		TExecFree(exec, (TINT8 *) mod - ((struct TModule *) mod)->tmd_NegSize);
	}
}
Esempio n. 10
0
static void freelist(TAPTR exec, struct TList *list)
{
	struct TNode *next, *node = list->tlh_Head;
	for (; (next = node->tln_Succ); node = next)
	{
		TREMOVE(node);
		TExecFree(exec, node);
	}
}
Esempio n. 11
0
/* allocate a fontquerynode and fill in properties
*/
static struct FontQueryNode *
fnt_getfqnode(DFBDISPLAY *mod, TSTRPTR filename, TINT pxsize)
{
	TAPTR exec = TGetExecBase(mod);
	struct FontQueryNode *fqnode = TNULL;

	/* allocate fquery node */
	fqnode = TExecAlloc0(exec, mod->dfb_MemMgr, sizeof(struct FontQueryNode));
	if (fqnode)
	{
		/* fquerynode ready - fill in attributes */
		TSTRPTR myfname = TNULL;
		TINT flen = strlen(filename)-4; /* discard '.ttf' */

		if (flen > 0)
			myfname = TExecAlloc0(exec, mod->dfb_MemMgr, flen + 1);
		else
			TDBPRINTF(TDB_ERROR,("found invalid font: '%s'\n", filename));

		if (myfname)
		{
			TExecCopyMem(exec, filename, myfname, flen);
			fqnode->tags[0].tti_Tag = TVisual_FontName;
			fqnode->tags[0].tti_Value = (TTAG) myfname;
		}
		else
		{
			if (flen > 0)
				TDBPRINTF(TDB_FAIL,("out of memory :(\n"));
		}

		if (fqnode->tags[0].tti_Value)
		{
			TINT i = 1;

			fqnode->tags[i].tti_Tag = TVisual_FontPxSize;
			fqnode->tags[i++].tti_Value = (TTAG) pxsize;

			/* always true */
			fqnode->tags[i].tti_Tag = TVisual_FontScaleable;
			fqnode->tags[i++].tti_Value = (TTAG) TTRUE;

			fqnode->tags[i].tti_Tag = TTAG_DONE;
		}
		else
		{
			TExecFree(exec, fqnode);
			fqnode = TNULL;
		}

	} /* endif fqnode */
	else
		TDBPRINTF(TDB_FAIL,("out of memory :(\n"));

	return fqnode;
}
Esempio n. 12
0
/* examine filename according to the specified flags and set the
** corresponding bits in the flagfield the function returns
** at the moment only FNT_MATCH_NAME is suppported
*/
static TUINT
fnt_matchfont(DFBDISPLAY *mod, TSTRPTR filename, TSTRPTR fname,
	struct fnt_attr *fattr, TUINT flag)
{
	TUINT match = 0;
	TAPTR exec = TGetExecBase(mod);

	if (flag & FNT_MATCH_NAME)
	{
		TINT i;
		TINT len = strlen(fname);

		if (strncmp(fname, FNT_WILDCARD, len) == 0)
		{
			/* match all, but filter out invalid filenames like '.' or '..' */
			if (strlen(filename) > 4)
				match = FNT_MATCH_NAME;
		}
		else
		{
			TSTRPTR tempname = TNULL;

			/* convert fontnames to lower case */
			for (i = 0; i < len; i++)
				fname[i] = tolower(fname[i]);

			tempname = TExecAlloc0(exec, mod->dfb_MemMgr, len+1);
			if (!tempname)
			{
				TDBPRINTF(TDB_FAIL,("out of memory :(\n"));
				return -1;
			}

			for (i = 0; i < len; i++)
				tempname[i] = tolower(filename[i]);

			/* compare converted fontnames */
			if (strncmp(fname, tempname, len) == 0)
				match = FNT_MATCH_NAME;

			TExecFree(exec, tempname);
		}
	}

	/* not yet
	if (flag & FNT_MATCH_SLANT)		;
	if (flag & FNT_MATCH_WEIGHT)	;
	*/

	return match;
}
Esempio n. 13
0
static TUINT fnt_matchfont(struct rfb_Display *mod, TSTRPTR filename,
	TSTRPTR fname, struct fnt_attr *fattr, TUINT flag)
{
	TUINT match = 0;

	if (flag & FNT_MATCH_NAME)
	{
		TINT i;
		TINT len = strlen(fname);

		if (strncmp(fname, FNT_WILDCARD, len) == 0)
		{
			/* match all, but filter out invalid filenames like '.' or '..' */
			if (strlen(filename) > 4)
				match = FNT_MATCH_NAME;
		}
		else
		{
			TSTRPTR tempname = TNULL;

			/* convert fontnames to lower case */
			for (i = 0; i < len; i++)
				fname[i] = tolower(fname[i]);

			tempname =
				TExecAlloc0(mod->rfb_ExecBase, mod->rfb_MemMgr, len + 1);
			if (!tempname)
			{
				TDBPRINTF(20, ("out of memory :(\n"));
				return -1;
			}

			for (i = 0; i < len; i++)
				tempname[i] = tolower(filename[i]);

			/* compare converted fontnames */
			if (strncmp(fname, tempname, len) == 0)
				match = FNT_MATCH_NAME;

			TExecFree(mod->rfb_ExecBase, tempname);
		}
	}

	return match;
}
Esempio n. 14
0
File: hal.c Progetto: callcc/tekui
LOCAL TCALLBACK struct TTimeRequest *
hal_open(struct THALBase *hal, struct TTask *task, TTAGITEM *tags)
{
	struct HALSpecific *hws = hal->hmb_Specific;
	TAPTR exec = (TAPTR) TGetTag(tags, THalBase_Exec, TNULL);
	struct TTimeRequest *req;
	hws->hsp_ExecBase = exec;

	req = TExecAllocMsg0(exec, sizeof(struct TTimeRequest));
	if (req)
	{
		EnterCriticalSection(&hws->hsp_DevLock);

		if (!hws->hsp_Timer)
		{
			if (timeBeginPeriod(1) == TIMERR_NOERROR)
			{
				g_hws = hws;
				g_hal = hal;
				TInitList(&g_ReplyList);
				TInitList(&hws->hsp_ReqList);
				hws->hsp_Timer =
					timeSetEvent(1, 1, hal_timeproc, TNULL, TIME_PERIODIC);
			}
		}

		if (hws->hsp_Timer)
		{
			hws->hsp_RefCount++;
			req->ttr_Req.io_Device = (struct TModule *) hal;
		}
		else
		{
			TExecFree(exec, req);
			req = TNULL;
		}

		LeaveCriticalSection(&hws->hsp_DevLock);
	}

	return req;
}
Esempio n. 15
0
File: hal.c Progetto: callcc/tekui
LOCAL TCALLBACK struct TTimeRequest *
hal_open(struct THALBase *hal, struct TTask *task, TTAGITEM *tags)
{
	struct HALSpecific *hws = hal->hmb_Specific;
	TAPTR exec = (TAPTR) TGetTag(tags, THalBase_Exec, TNULL);
	struct TTimeRequest *req;
	hws->hsp_ExecBase = exec;

	req = TExecAllocMsg0(exec, sizeof(struct TTimeRequest));
	if (req)
	{
		EnterCriticalSection(&hws->hsp_DevLock);

		if (!hws->hsp_DevTask)
		{
			TTAGITEM tasktags[2];
			tasktags[0].tti_Tag = TTask_Name;			/* set task name */
			tasktags[0].tti_Value = (TTAG) TTASKNAME_HALDEV;
			tasktags[1].tti_Tag = TTAG_DONE;
			TInitList(&hws->hsp_ReqList);
			hws->hsp_DevTask = TExecCreateSysTask(exec, hal_devfunc, tasktags);
		}

		if (hws->hsp_DevTask)
		{
			hws->hsp_RefCount++;
			req->ttr_Req.io_Device = (struct TModule *) hal;
		}
		else
		{
			TExecFree(exec, req);
			req = TNULL;
		}

		LeaveCriticalSection(&hws->hsp_DevLock);
	}

	return req;
}
Esempio n. 16
0
static TMODAPI void rfb_freereq(struct rfb_Display *mod, struct TVRequest *req)
{
	TExecFree(mod->rfb_ExecBase, req);
}
Esempio n. 17
0
static TMODAPI void rfb_freereq(RFBDISPLAY *mod, struct TVRequest *req)
{
	TExecFree(mod->rfb_ExecBase, req);
}
Esempio n. 18
0
LOCAL void
dfb_openvisual(DFBDISPLAY *mod, struct TVRequest *req)
{
	TTAGITEM *tags = req->tvr_Op.OpenWindow.Tags;
	TAPTR exec = TGetExecBase(mod);
	DFBWINDOW *v;
	DFBWindowDescription wdsc;

	struct FontNode *fn;

	v = TExecAlloc0(exec, mod->dfb_MemMgr, sizeof(DFBWINDOW));
	req->tvr_Op.OpenWindow.Window = v;
	if (v == TNULL) return;

	v->userdata = TGetTag(tags, TVisual_UserData, TNULL);
	v->eventmask = (TUINT) TGetTag(tags, TVisual_EventMask, 0);

	TInitList(&v->penlist);
	v->bgpen = TVPEN_UNDEFINED;
	v->fgpen = TVPEN_UNDEFINED;

	TInitList(&v->imsgqueue);
	v->imsgport = req->tvr_Op.OpenWindow.IMsgPort;

	v->title = (TSTRPTR)
		TGetTag(tags, TVisual_Title, (TTAG) "TEKlib visual");

	/* size/position calculation: */

	v->winwidth = (TINT) TGetTag(tags,
		TVisual_Width,
		(TTAG) TMIN(mod->dfb_ScrWidth, DEF_WINWIDTH));
	v->winheight = (TINT) TGetTag(tags,
		TVisual_Height,
		(TTAG) TMIN(mod->dfb_ScrHeight, DEF_WINHEIGHT));

	if (TGetTag(tags, TVisual_Center, TFALSE))
	{
		v->winleft = (mod->dfb_ScrWidth - v->winwidth) / 2;
		v->wintop = (mod->dfb_ScrHeight - v->winheight) / 2;
	}
	else if (TGetTag(tags, TVisual_FullScreen, TFALSE))
	{
		v->winwidth = mod->dfb_ScrWidth;
		v->winheight = mod->dfb_ScrHeight;
		v->winleft = 0;
		v->wintop = 0;
	}
	else
	{
		v->winleft = (TINT) TGetTag(tags, TVisual_WinLeft, (TTAG) -1);
		v->wintop = (TINT) TGetTag(tags, TVisual_WinTop, (TTAG) -1);
	}

	if (!TGetTag(tags, TVisual_Borderless, TFALSE))
	{
		v->wminwidth = (TINT) TGetTag(tags, TVisual_MinWidth, (TTAG) -1);
		v->wminheight = (TINT) TGetTag(tags, TVisual_MinHeight, (TTAG) -1);
		v->wmaxwidth = (TINT) TGetTag(tags, TVisual_MaxWidth, (TTAG) -1);
		v->wmaxheight = (TINT) TGetTag(tags, TVisual_MaxHeight, (TTAG) -1);

		if (v->wmaxwidth > 0)
			v->winwidth = TMIN(v->winwidth, v->wmaxwidth);
		if (v->wmaxheight > 0)
			v->winheight = TMIN(v->winheight, v->wmaxheight);
		if (v->wminwidth > 0)
			v->winwidth = TMAX(v->winwidth, v->wminwidth);
		if (v->wminheight > 0)
			v->winheight = TMAX(v->winheight, v->wminheight);

		v->wminwidth = v->wminwidth <= 0 ? 1 : v->wminwidth;
		v->wminheight = v->wminheight <= 0 ? 1 : v->wminheight;
		v->wmaxwidth = v->wmaxwidth <= 0 ? 1000000 : v->wmaxwidth;
		v->wmaxheight = v->wmaxheight <= 0 ? 1000000 : v->wmaxheight;
	}

	v->winleft = TMAX(v->winleft, 0);
	v->wintop = TMAX(v->wintop, 0);

	if (TGetTag(tags, TVisual_Borderless, TFALSE))
		v->borderless = TTRUE;

	wdsc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT);
	wdsc.posx   = v->winleft;
	wdsc.posy   = v->wintop;
	wdsc.width  = v->winwidth;
	wdsc.height = v->winheight;

	if (mod->dfb_Layer->CreateWindow(mod->dfb_Layer, &wdsc, &v->window) == DFB_OK)
	{
		v->window->GetSurface(v->window, &v->winsurface);
		v->window->SetOpacity(v->window, 0xFF);
		v->window->GetID(v->window, &v->winid);
		v->window->AttachEventBuffer(v->window, mod->dfb_Events);

		v->window->RequestFocus(v->window);
		v->window->RaiseToTop(v->window);

		if (!v->borderless)
		{
			/* generate focus events */
			genimsg(mod, (DFBWINDOW *)mod->dfb_Focused, v, TITYPE_FOCUS);
			mod->dfb_Focused = (TAPTR) v;
		}

		v->winsurface->SetColor(v->winsurface, 0x00, 0x00, 0xff, 0xff);
		v->winsurface->DrawRectangle(v->winsurface, 0, 0, wdsc.width, wdsc.height);
		v->winsurface->SetColor(v->winsurface, 0x80, 0x80, 0x80, 0xff);
		v->winsurface->FillRectangle(v->winsurface, 1, 1, wdsc.width-2, wdsc.height-2);
		v->winsurface->Flip(v->winsurface, NULL, 0);

		/* init default font */
		fn = mod->dfb_fm.deffont;
		v->curfont = fn;
		mod->dfb_fm.defref++;

		if (v->winsurface->SetFont(v->winsurface, fn->font) == DFB_OK)
		{
			if (v->winsurface->SetFont(v->winsurface, fn->font) == DFB_OK)
			{
				TDBPRINTF(TDB_TRACE,("Add window: %p\n", v->window));
				TAddHead(&mod->dfb_vlist, &v->node);

				/* success: */
				return;
			}
		}
     }

	TExecFree(exec, v);

	/* failure: */
	TDBPRINTF(TDB_ERROR,("Open failed\n"));
	req->tvr_Op.OpenWindow.Window = TNULL;
}
Esempio n. 19
0
TLIBAPI void region_destroy(struct RectPool *pool, struct Region *region)
{
	region_freerects(pool, &region->rg_Rects);
	TExecFree(pool->p_ExecBase, region);
}
Esempio n. 20
0
static void
hostqueryfonts(DFBDISPLAY *mod, struct FontQueryHandle *fqh, struct fnt_attr *fattr)
{
	TINT i, nfont, fcount = 0;
	struct TNode *node, *next;
	TAPTR exec = TGetExecBase(mod);
	struct dirent **dirlist;
	TUINT matchflg = 0;

	/* scan default font directory */
	nfont = scandir(FNT_DEFDIR, &dirlist, 0, alphasort);
	if (nfont < 0)
	{
		perror("scandir");
		return;
	}

	if (nfont > 0)
	{
		/* found fonts in default font directory */
		for (node = fattr->fnlist.tlh_Head; (next = node->tln_Succ); node = next)
		{
			struct fnt_node *fnn = (struct fnt_node *)node;

			/* build matchflag, font pxsize attribute is ignored,
			   because it's not relevant when matching ttf fonts */

			matchflg = FNT_MATCH_NAME;

			/* not yet
			if (fattr->fitalic != FNTQUERY_UNDEFINED)
				matchflg |= FNT_MATCH_SLANT;
			if (fattr->fbold != FNTQUERY_UNDEFINED)
				matchflg |= FNT_MATCH_WEIGHT;
			*/

			for (i = 0; i < nfont; i++)
			{
				if (fnt_matchfont(mod, dirlist[i]->d_name, fnn->fname,
					fattr, matchflg) == matchflg)
				{
					struct FontQueryNode *fqnode;

					/* create fqnode and fill in attributes */
					fqnode = fnt_getfqnode(mod, dirlist[i]->d_name, fattr->fpxsize);
					if (!fqnode)	break;

					/* compare fqnode with nodes in result list */
					if (fnt_checkfqnode(&fqh->reslist, fqnode) == 0)
					{
						if (fcount < fattr->fnum)
						{
							/* fqnode is unique, add to result list */
							TAddTail(&fqh->reslist, &fqnode->node);
							fcount++;
						}
						else
						{
							/* max count of desired results reached */
							TExecFree(exec, (TSTRPTR)fqnode->tags[0].tti_Value);
							TExecFree(exec, fqnode);
							break;
						}
					}
					else
					{
						/* fqnode is not unique, destroy it */
						TDBPRINTF(TDB_ERROR,("X node is not unique\n"));
						TExecFree(exec, (TSTRPTR)fqnode->tags[0].tti_Value);
						TExecFree(exec, fqnode);
					}
				}
			}

			if (fcount == fattr->fnum)
				break;

		} /* end of fnlist iteration */

	} /* endif fonts found */
	else
		TDBPRINTF(TDB_WARN,("X no fonts found in '%s'\n", FNT_DEFDIR));

	while (nfont--)
		free(dirlist[nfont]);
	free(dirlist);
}