diff options
-rw-r--r-- | libass/ass.h | 7 | ||||
-rw-r--r-- | libass/ass_render.c | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/libass/ass.h b/libass/ass.h index 0778a5c..cb85a2c 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -56,6 +56,13 @@ typedef struct ass_image { /* * Hinting type. (see ass_set_hinting below) * + * Setting hinting to anything but ASS_HINTING_NONE will put libass in a mode + * that reduces compatibility with vsfilter and many ASS scripts. The main + * problem is that hinting conflicts with smooth scaling, which precludes + * animations and precise positioning. + * + * In other words, enabling hinting might break some scripts severely. + * * FreeType's native hinter is still buggy sometimes and it is recommended * to use the light autohinter, ASS_HINTING_LIGHT, instead. For best * compatibility with problematic fonts, disable hinting. diff --git a/libass/ass_render.c b/libass/ass_render.c index e592548..45d88bb 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -1097,9 +1097,16 @@ get_outline_glyph(ASS_Renderer *priv, GlyphInfo *info) v.desc = drawing->desc; key.u.drawing.text = strdup(drawing->text); } else { - // arbitrary, not too small to prevent grid fitting rounding effects - // XXX: this is a rather crude hack - const double ft_size = 256.0; + double ft_size; + if (priv->settings.hinting == ASS_HINTING_NONE) { + // arbitrary, not too small to prevent grid fitting rounding effects + // XXX: this is a rather crude hack + ft_size = 256.0; + } else { + // If hinting is enabled, we want to pass the real font size + // to freetype. Normalize scale_y to 1.0. + ft_size = info->scale_y * info->font_size; + } ass_face_set_size(info->font->faces[info->face_index], ft_size); ass_font_set_transform(info->font, info->scale_x * info->font_size / ft_size, |