envbvs@epb7.lbl.gov (Brian V. Smith) (06/22/91)
As soon as I posted the patches to xfig to bring it to patchlevel 10
I found two particularly bad bugs. The change object menu would set
any filled object to black unless the user modified the fill color.
Also, the user who contributed the change for the OPENWINDOWS font
stuff apparently has a function called lower(), which doesn't exist
in Sunos and Ultrix.
Rather than waiting until pl11 to fix this, here is a patch.
>>> Be sure to save the original change.c file, so that when you apply
pl11 the patch procedure will succeed.
*** change.c.old Fri Jun 21 11:33:10 1991
--- change.c Fri Jun 14 14:20:14 1991
***************
*** 1086,1093 ****
XtSetArg(args[1], XtNvertDistance, 2);
XtSetValues(area_fill_panel, args, TWO);
XtSetValues(fill_pct_label, args, TWO);
! if (no_fill_flag)
! panel_clear_value(area_fill_panel);
/* make popup line style menu */
--- 1086,1092 ----
XtSetArg(args[1], XtNvertDistance, 2);
XtSetValues(area_fill_panel, args, TWO);
XtSetValues(fill_pct_label, args, TWO);
! panel_clear_value(area_fill_panel);
/* make popup line style menu */
*** font.c.old Fri Jun 14 12:48:06 1991
--- font.c Mon Jun 17 08:01:22 1991
***************
*** 132,137 ****
--- 132,138 ----
struct xfont *xf;
XFontStruct *fontst;
char fn[128];
+ int i;
if (f<0) /* use font 0 for default font (-1) */
f=0;
***************
*** 140,146 ****
#ifdef OPENWIN
sprintf (fn, "%s-%d", fontnames[f].psfont, s);
! lower(fn);
if (appres.DEBUG)
fprintf(stderr,"Loading font %s\n",fn);
fontst = XLoadQueryFont(tool_d, fn);
--- 141,148 ----
#ifdef OPENWIN
sprintf (fn, "%s-%d", fontnames[f].psfont, s);
! for (i=0; i<strlen(fn); i++)
! fn[i]=tolower(fn[i]);
if (appres.DEBUG)
fprintf(stderr,"Loading font %s\n",fn);
fontst = XLoadQueryFont(tool_d, fn);
--
Brian V. Smith (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL; they don't pay me enough for that.
pete@esv2.biosym.COM (Pete Ware) (06/24/91)
The following code fragment isn't so hot, either. ! for (i=0; i<strlen(fn); i++) ! fn[i]=tolower(fn[i]); One needs to check if it is upper case before converting it to lower case since some OS's define tolower to just subtract a constant. For example: #define tolower(c) ((c)-'A'+'a') --pete Pete Ware / Biosym / San Diego CA / (619) 546-5532 email: pete@biosym.com
mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (06/25/91)
> The following code fragment isn't so hot, either. >> for (i=0; i<strlen(fn); i++) >> fn[i]=tolower(fn[i]); > One needs to check if it is upper case before converting it to lower > case since some OS's define tolower to just subtract a constant. And there is absolutely no excuse for calling strlen each time around the loop, since the body doesn't alter the length. Try making it for (i=strlen(fn)-1;i>=0;i--) since the body of the loop is such that it will work equally well either way. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu