TRACE(("Proportional font!\n"))
TRACE(("Proportional font! normal %d/%d, bold %d/%d\n", nfs->min_bounds.width, nfs->max_bounds.width, bfs->min_bounds.width, bfs->max_bounds.width));
xtermLoadFont (	TScreen *screen,	char *nfontname,	char *bfontname,	Bool doresize,	int fontnum){	FontNameProperties *fp;	XFontStruct *nfs = NULL;	XFontStruct *bfs = NULL;	XGCValues xgcv;	unsigned long mask;	GC new_normalGC      = NULL;	GC new_normalboldGC  = NULL;	GC new_reverseGC     = NULL;	GC new_reverseboldGC = NULL;	Pixel new_normal;	Pixel new_revers;	char *tmpname = NULL;	Boolean proportional = False;	if (!nfontname) return 0;	if (fontnum == fontMenu_fontescape	 && nfontname != screen->menu_font_names[fontnum]) {		tmpname = (char *) malloc (strlen(nfontname) + 1);		if (!tmpname)			return 0;		strcpy (tmpname, nfontname);	}	TRACE(("xtermLoadFont normal %s\n", nfontname))	if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;	if (EmptyFont(nfs))		goto bad;		/* can't use a 0-sized font */	if (bfontname == 0) {		fp = get_font_name_props(screen->display, nfs);		if (fp != 0) {			bfontname = bold_font_name(fp);			TRACE(("...derived bold %s\n", bfontname))		}		if (bfontname == 0		 || (bfs = XLoadQueryFont (screen->display, bfontname)) == 0) {			bfs = nfs;			TRACE(("...cannot load a matching bold font\n"))		} else if (!same_font_size(nfs, bfs)		 || !got_bold_font(screen->display, bfs, bfontname)) {			XFreeFont(screen->display, bfs);			bfs = nfs;			TRACE(("...did not get a matching bold font\n"))		}	} else if ((bfs = XLoadQueryFont (screen->display, bfontname)) == 0) {		bfs = nfs;		TRACE(("...cannot load bold font %s\n", bfontname))	}	if (EmptyFont(bfs))		goto bad;		/* can't use a 0-sized font */	if (nfs->min_bounds.width != nfs->max_bounds.width	 || bfs->min_bounds.width != bfs->max_bounds.width	 || nfs->min_bounds.width != bfs->min_bounds.width	 || nfs->max_bounds.width != bfs->max_bounds.width) {		TRACE(("Proportional font!\n"))		proportional = True;	}	mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures |	GCFunction);	new_normal = getXtermForeground(term->flags, term->cur_foreground);	new_revers = getXtermBackground(term->flags, term->cur_background);	xgcv.font = nfs->fid;	xgcv.foreground = new_normal;	xgcv.background = new_revers;	xgcv.graphics_exposures = TRUE;	/* default */	xgcv.function = GXcopy;	new_normalGC = XtGetGC((Widget)term, mask, &xgcv);	if (!new_normalGC) goto bad;	if (nfs == bfs) {			/* there is no bold font */		new_normalboldGC = new_normalGC;	} else {		xgcv.font = bfs->fid;		new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv);		if (!new_normalboldGC) goto bad;	}	xgcv.font = nfs->fid;	xgcv.foreground = new_revers;	xgcv.background = new_normal;	new_reverseGC   = XtGetGC((Widget)term, mask, &xgcv);	if (!new_reverseGC) goto bad;	if (nfs == bfs) {			/* there is no bold font */		new_reverseboldGC = new_reverseGC;	} else {		xgcv.font = bfs->fid;		new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);		if (!new_reverseboldGC) goto bad;	}	if (NormalGC(screen) != NormalBoldGC(screen))		XtReleaseGC ((Widget) term, NormalBoldGC(screen));	XtReleaseGC ((Widget) term, NormalGC(screen));	if (ReverseGC(screen) != ReverseBoldGC(screen))		XtReleaseGC ((Widget) term, ReverseBoldGC(screen));	XtReleaseGC ((Widget) term, ReverseGC(screen));	NormalGC(screen)      = new_normalGC;	NormalBoldGC(screen)  = new_normalboldGC;	ReverseGC(screen)     = new_reverseGC;	ReverseBoldGC(screen) = new_reverseboldGC;	/*	 * If we're switching fonts, free the old ones.  Otherwise we'll leak	 * the memory that is associated with the old fonts.  The	 * XLoadQueryFont call allocates a new XFontStruct.	 */	if (screen->fnt_bold != 0	 && screen->fnt_bold != screen->fnt_norm)		XFreeFont(screen->display, screen->fnt_bold);	if (screen->fnt_norm != 0)		XFreeFont(screen->display, screen->fnt_norm);	screen->fnt_norm = nfs;	screen->fnt_bold = bfs;	screen->fnt_prop = proportional;	screen->enbolden = (nfs == bfs);	set_menu_font (False);	screen->menu_font_number = fontnum;	set_menu_font (True);	if (tmpname) {			/* if setting escape or sel */		if (screen->menu_font_names[fontnum])			free (screen->menu_font_names[fontnum]);		screen->menu_font_names[fontnum] = tmpname;		if (fontnum == fontMenu_fontescape) {			set_sensitivity (term->screen.fontMenu,				fontMenuEntries[fontMenu_fontescape].widget,				TRUE);		}	}	set_cursor_gcs (screen);	xtermUpdateFontInfo (screen, doresize);	return 1;bad:	if (tmpname)		free (tmpname);	if (new_normalGC)		XtReleaseGC ((Widget) term, screen->fullVwin.normalGC);	if (new_normalGC && new_normalGC != new_normalboldGC)		XtReleaseGC ((Widget) term, new_normalboldGC);	if (new_reverseGC)		XtReleaseGC ((Widget) term, new_reverseGC);	if (new_reverseGC && new_reverseGC != new_reverseboldGC)		XtReleaseGC ((Widget) term, new_reverseboldGC);	if (nfs)		XFreeFont (screen->display, nfs);	if (bfs && nfs != bfs)		XFreeFont (screen->display, bfs);	return 0;}