+
+ if(Cmd_Argc() < 3)
+ filelist = "gfx/conchars";
+ else
+ filelist = Cmd_Argv(2);
+
+ memset(f->fallbacks, 0, sizeof(f->fallbacks));
+ memset(f->fallback_faces, 0, sizeof(f->fallback_faces));
+
+ // first font is handled "normally"
+ c = strchr(filelist, ':');
+ cm = strchr(filelist, ',');
+ if(c && (!cm || c < cm))
+ f->req_face = atoi(c+1);
+ else
+ {
+ f->req_face = 0;
+ c = cm;
+ }
+
+ if(!c || (c - filelist) > MAX_QPATH)
+ strlcpy(mainfont, filelist, sizeof(mainfont));
+ else
+ {
+ memcpy(mainfont, filelist, c - filelist);
+ mainfont[c - filelist] = 0;
+ }
+
+ for(i = 0; i < MAX_FONT_FALLBACKS; ++i)
+ {
+ c = strchr(filelist, ',');
+ if(!c)
+ break;
+ filelist = c + 1;
+ if(!*filelist)
+ break;
+ c = strchr(filelist, ':');
+ cm = strchr(filelist, ',');
+ if(c && (!cm || c < cm))
+ f->fallback_faces[i] = atoi(c+1);
+ else
+ {
+ f->fallback_faces[i] = 0; // f->req_face; could make it stick to the default-font's face index
+ c = cm;
+ }
+ if(!c || (c-filelist) > MAX_QPATH)
+ {
+ strlcpy(f->fallbacks[i], filelist, sizeof(mainfont));
+ }
+ else
+ {
+ memcpy(f->fallbacks[i], filelist, c - filelist);
+ f->fallbacks[i][c - filelist] = 0;
+ }
+ }
+
+ // for now: by default load only one size: the default size
+ f->req_sizes[0] = 0;
+ for(i = 1; i < MAX_FONT_SIZES; ++i)
+ f->req_sizes[i] = -1;
+
+ scale = 1;
+ voffset = 0;
+ if(Cmd_Argc() >= 4)
+ {
+ for(sizes = 0, i = 3; i < Cmd_Argc(); ++i)
+ {
+ // special switches
+ if (!strcmp(Cmd_Argv(i), "scale"))
+ {
+ i++;
+ if (i < Cmd_Argc())
+ scale = atof(Cmd_Argv(i));
+ continue;
+ }
+ if (!strcmp(Cmd_Argv(i), "voffset"))
+ {
+ i++;
+ if (i < Cmd_Argc())
+ voffset = atof(Cmd_Argv(i));
+ continue;
+ }
+
+ if (sizes == -1)
+ continue; // no slot for other sizes
+
+ // parse one of sizes
+ sz = atof(Cmd_Argv(i));
+ if (sz > 0.001f && sz < 1000.0f) // do not use crap sizes
+ {
+ // search for duplicated sizes
+ int j;
+ for (j=0; j<sizes; j++)
+ if (f->req_sizes[j] == sz)
+ break;
+ if (j != sizes)
+ continue; // sz already in req_sizes, don't add it again
+
+ if (sizes == MAX_FONT_SIZES)
+ {
+ Con_Printf("Warning: specified more than %i different font sizes, exceding ones are ignored\n", MAX_FONT_SIZES);
+ sizes = -1;
+ continue;
+ }
+ f->req_sizes[sizes] = sz;
+ sizes++;
+ }
+ }
+ }
+
+ LoadFont(true, mainfont, f, scale, voffset);