if (last_name != 0) XFree(last_name); last_name = name; if (result != 0) strcpy(result, name);
get_font_name_props(Display *dpy, XFontStruct *fs){	static FontNameProperties props;	register XFontProp *fp;	register int i;	Atom fontatom = XInternAtom (dpy, "FONT", False);	char *name;	char *str;	/*	* first get the full font name	*/	for (name = 0, i = 0, fp = fs->properties;		i < fs->n_properties;			i++, fp++)		if (fp->name == fontatom)			name = XGetAtomName (dpy, fp->card32);	if (name == 0)		return 0;	/*	* Now split it up into parts and put them in	* their places. Since we are using parts of	* the original string, we must not free the Atom Name	*/	/* registry, foundry, family */	if ((props.beginning = n_fields(&name, 1, 3)) == 0)		return 0;	/* weight is the next */	if ((props.width = n_fields(&name, 1, 1)) == 0)		return 0;	/* slant, width, add style */	if ((props.middle = n_fields(&name, 1, 3)) == 0)		return 0;	/* pixel size */	if ((str = n_fields(&name, 1, 1)) == 0)		return 0;	if ((props.pixel_size = atoi(str)) == 0)		return 0;	/* point size */	if ((props.point_size = n_fields(&name, 1, 1)) == 0)		return 0;	/* res_x */	if ((str = n_fields(&name, 1, 1)) == 0)		return 0;	if ((props.res_x = atoi(str)) == 0)		return 0;	/* res_y */	if ((str = n_fields(&name, 1, 1)) == 0)		return 0;	if ((props.res_y = atoi(str)) == 0)		return 0;	/* spacing */	if ((props.spacing = n_fields(&name, 1, 1)) == 0)		return 0;	/* skip the average width */	if ((str = n_fields(&name, 1, 1)) == 0)		return 0;	/* the rest: charset registry and charset encoding */	props.end = name;	return &props;}