summaryrefslogtreecommitdiffstats
path: root/libass/ass_fontselect.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2011-08-19 01:16:24 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2015-07-10 10:42:40 +0200
commit93c4e8ebf3dea5c9e1978f78a33cb961d6a1aaf7 (patch)
tree10adc9f34146192dafdf6ab158f4022ed2acff3f /libass/ass_fontselect.c
parent986605e29d9d8c7a0d0aeac8f53fc556097334d6 (diff)
downloadlibass-93c4e8ebf3dea5c9e1978f78a33cb961d6a1aaf7.tar.bz2
libass-93c4e8ebf3dea5c9e1978f78a33cb961d6a1aaf7.tar.xz
Use TrueType font weight scale
fontconfig uses an unusual scale from 0-215 for the font weight. It looks like it is somewhat derived from the typographic scale some font families use, but is still rather nonstandard. Nowadays the TrueType scale from 100-900 seems to be standard. CSS uses it, for example. However, most importantly, VSFilter also uses the TrueType scale. So let's use it in libass, too.
Diffstat (limited to 'libass/ass_fontselect.c')
-rw-r--r--libass/ass_fontselect.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c
index 176d0c1..3bf67fd 100644
--- a/libass/ass_fontselect.c
+++ b/libass/ass_fontselect.c
@@ -365,6 +365,8 @@ static char *select_font(ASS_FontSelector *priv, ASS_Library *library,
free(req.fullnames[0]);
free(req.family);
+ font_info_dump(font_infos, priv->n_font);
+
// return best match
if (idx == priv->n_font)
return NULL;
@@ -485,7 +487,7 @@ get_font_info(FT_Library lib, FT_Face face, ASS_FontProviderMetaData *info)
// calculate sensible slant and weight from style attributes
slant = 110 * !!(face->style_flags & FT_STYLE_FLAG_ITALIC);
- weight = 120 * !!(face->style_flags & FT_STYLE_FLAG_BOLD) + 80;
+ weight = 300 * !!(face->style_flags & FT_STYLE_FLAG_BOLD) + 400;
// fill our struct
info->family = family;