int n_fullname;
int slant;
- int weight;
+ int weight; // TrueType scale, 100-900
// how to access this face
char *path;
unsigned int index, void *data)
{
int i;
+ int weight, slant;
ASS_FontSelector *selector = provider->parent;
ASS_FontInfo *info;
// TODO: sanity checks. do we have a path or valid get_face function?
+ weight = meta->weight;
+ slant = meta->slant;
+
+ // check slant/weight for validity, use defaults if they're invalid
+ if (weight < 100 || weight > 900)
+ meta->weight = 400;
+ if (slant < 0 || slant > 110)
+ slant = 0;
+
// check size
if (selector->n_font >= selector->alloc_font) {
selector->alloc_font = FFMAX(1, 2 * selector->alloc_font);
// set uid
info->uid = selector->uid++;
- info->slant = meta->slant;
- info->weight = meta->weight;
+ info->slant = slant;
+ info->weight = weight;
info->family = strdup(meta->family);
info->n_fullname = meta->n_fullname;
info->fullnames = calloc(meta->n_fullname, sizeof(char *));