1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-28 19:05:51 +01:00

default system font string (which is readonly) overwrite bug fix

This commit is contained in:
kojima
1999-09-19 01:30:13 +00:00
parent e7df5ed456
commit 5b9b715cc4

View File

@@ -317,31 +317,41 @@ WMDrawImageString(WMScreen *scr, Drawable d, GC gc, WMFont *font, int x, int y,
static char* static char*
makeFontSetOfSize(char *fontset, int size) makeFontSetOfSize(char *fontset, int size)
{ {
char font[300]; char font[300], *f;
char *newfs = NULL; char *newfs = NULL;
char *ptr; char *ptr;
char *tmp;
do { do {
int hold = ' '; char *tmp;
int end;
f = fontset;
ptr = strchr(fontset, ','); ptr = strchr(fontset, ',');
if (ptr) { if (ptr) {
hold = *(ptr+1); int count = ptr-fontset;
*(ptr+1) = 0;
} if (count > 255) {
if (strlen(fontset)>255) { wwarning("font description %s is too large.", fontset);
wwarning("font description %s is too large.", fontset); } else {
} else { memcpy(font, fontset, count);
sprintf(font, fontset, size); font[count] = 0;
tmp = wstrappend(newfs, font); f = (char*)font;
if (newfs) }
free(newfs);
newfs = tmp;
}
if (ptr) {
*(ptr+1) = hold;
} }
if (newfs)
end = strlen(newfs);
else
end = 0;
tmp = wmalloc(end + strlen(f) + 8);
sprintf(tmp + end, f, size);
if (newfs)
free(newfs);
newfs = tmp;
fontset = ptr+1; fontset = ptr+1;
} while (ptr!=NULL); } while (ptr!=NULL);