Skip to content

Commit

Permalink
libass/ass_fontselect: ignore width
Browse files Browse the repository at this point in the history
As far as I can tell, this is completely unused in VSFilter.
  • Loading branch information
rcombs committed May 13, 2024
1 parent 0a63b95 commit 3f153be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion libass/ass_fontconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ static void scan_fonts(FcConfig *config, ASS_FontProvider *provider)

// simple types
result = FcPatternGetInteger(pat, FC_SLANT, 0, &meta.slant);
result |= FcPatternGetInteger(pat, FC_WIDTH, 0, &meta.width);
result |= FcPatternGetDouble(pat, FC_WEIGHT, 0, &weight);
result |= FcPatternGetInteger(pat, FC_INDEX, 0, &index);
if (result != FcResultMatch)
Expand Down
12 changes: 1 addition & 11 deletions libass/ass_fontselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ struct font_info {

int slant;
int weight; // TrueType scale, 100-900
int width;

// how to access this face
char *path; // absolute path
Expand Down Expand Up @@ -317,7 +316,6 @@ get_font_info(FT_Library lib, FT_Face face, const char *fallback_family_name,
// fill our struct
info->slant = slant;
info->weight = weight;
info->width = 100; // FIXME, should probably query the OS/2 table

info->postscript_name = (char *)FT_Get_Postscript_Name(face);
info->is_postscript = !FT_Get_PS_Font_Info(face, &postscript_info);
Expand Down Expand Up @@ -391,7 +389,7 @@ ass_font_provider_add_font(ASS_FontProvider *provider,
int index, void *data)
{
int i;
int weight, slant, width;
int weight, slant;
ASS_FontSelector *selector = provider->parent;
ASS_FontInfo *info = NULL;
ASS_FontProviderMetaData implicit_meta = {0};
Expand Down Expand Up @@ -449,22 +447,18 @@ ass_font_provider_add_font(ASS_FontProvider *provider,
printf("\n");
printf(" slant: %d\n", meta->slant);
printf(" weight: %d\n", meta->weight);
printf(" width: %d\n", meta->width);
printf(" path: %s\n", path);
printf(" index: %d\n", index);
#endif

weight = meta->weight;
slant = meta->slant;
width = meta->width;

// check slant/weight for validity, use defaults if they're invalid
if (weight < 100 || weight > 900)
weight = 400;
if (slant < 0 || slant > 110)
slant = 0;
if (width < 50 || width > 200)
width = 100;

// check size
if (selector->n_font >= selector->alloc_font) {
Expand All @@ -482,7 +476,6 @@ ass_font_provider_add_font(ASS_FontProvider *provider,

info->slant = slant;
info->weight = weight;
info->width = width;
info->n_fullname = meta->n_fullname;
info->n_family = meta->n_family;
info->is_postscript = meta->is_postscript;
Expand Down Expand Up @@ -678,7 +671,6 @@ static unsigned font_attributes_similarity(ASS_FontInfo *a, ASS_FontInfo *req)
unsigned similarity = 0;
similarity += ABS(a->weight - req->weight);
similarity += ABS(a->slant - req->slant);
similarity += ABS(a->width - req->width);

return similarity;
}
Expand All @@ -701,7 +693,6 @@ static void font_info_dump(ASS_FontInfo *font_infos, size_t len)
printf("\n");
printf(" slant: %d\n", font_infos[i].slant);
printf(" weight: %d\n", font_infos[i].weight);
printf(" width: %d\n", font_infos[i].width);
printf(" path: %s\n", font_infos[i].path);
printf(" index: %d\n", font_infos[i].index);
printf(" score: %d\n", font_infos[i].score);
Expand Down Expand Up @@ -735,7 +726,6 @@ find_font(ASS_FontSelector *priv,
// fill font request
req.slant = italic;
req.weight = bold;
req.width = 100;

// Match font family name against font list
unsigned score_min = UINT_MAX;
Expand Down
2 changes: 0 additions & 2 deletions libass/ass_fontselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@ struct ass_font_provider_meta_data {
int slant; // Font slant value from FONT_SLANT_*
int weight; // Font weight in TrueType scale, 100-900
// See FONT_WEIGHT_*
int width; // Font weight in percent, normally 100
// See FONT_WIDTH_*

/**
* Whether the font contains PostScript outlines.
Expand Down

0 comments on commit 3f153be

Please sign in to comment.