]> granicus.if.org Git - libass/commitdiff
Disable kerning by default and make it configurable
authorGrigori Goronzy <greg@blackbox>
Tue, 8 Sep 2009 20:21:43 +0000 (22:21 +0200)
committerGrigori Goronzy <greg@blackbox>
Tue, 8 Sep 2009 20:21:43 +0000 (22:21 +0200)
Kerning causes problems with many (broken) fonts. VSFilter doesn't use
kerning so these problems won't be apparant, while libass uses kerning
by default.

For compatibility reasons, disable kerning by default. In addition,
make it configurable through style overrides and the Script Info
header.

I.e. put "Kerning: yes" into the Script Info header to enable kerning.
With MPlayer, using "-ass-force-style Kerning=yes" will always
enable kerning.

This also includes a minor ABI change for tracking the kerning boolean.
As this only affects code that creates or modifies ASS_Tracks manually,
and I'm not aware of anyone doing that, the SONAME will not be bumped.

libass/ass.c
libass/ass_render.c
libass/ass_types.h

index 057a6e349b8fcc31f120e5e41a1e22d8dd7c145c..f7f5bccd4bcb259db570dae5b9ec1c56fdba6085 100644 (file)
@@ -389,6 +389,8 @@ void ass_process_force_style(ASS_Track *track)
             track->WrapStyle = atoi(token);
         else if (!strcasecmp(*fs, "ScaledBorderAndShadow"))
             track->ScaledBorderAndShadow = parse_bool(token);
+        else if (!strcasecmp(*fs, "Kerning"))
+            track->Kerning = parse_bool(token);
 
         dt = strrchr(*fs, '.');
         if (dt) {
@@ -571,6 +573,8 @@ static int process_info_line(ASS_Track *track, char *str)
         track->WrapStyle = atoi(str + 10);
     } else if (!strncmp(str, "ScaledBorderAndShadow:", 22)) {
         track->ScaledBorderAndShadow = parse_bool(str + 22);
+    } else if (!strncmp(str, "Kerning:", 8)) {
+        track->Kerning = parse_bool(str + 8);
     }
     return 0;
 }
index edb0c840ad40caf1bae7f91abf38f3a1a0d99689..e713ab004460666ed6f311528947864851571e35 100644 (file)
@@ -1816,6 +1816,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
     int MarginL, MarginR, MarginV;
     int last_break;
     int alignment, halign, valign;
+    int kern = render_priv->track->Kerning;
     double device_x = 0;
     double device_y = 0;
     TextInfo *text_info = &render_priv->text_info;
@@ -1879,7 +1880,7 @@ ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
         }
 
         // Add kerning to pen
-        if (previous && code && !drawing->hash) {
+        if (kern && previous && code && !drawing->hash) {
             FT_Vector delta;
             delta =
                 ass_font_get_kerning(render_priv->state.font, previous,
index d6a01110153fc5015cca7c8aa62b5329dcda8d2f..63bc36c4026ab53b4198b0ce0456f45a435d04b1 100644 (file)
@@ -113,6 +113,7 @@ typedef struct ass_track {
     double Timer;
     int WrapStyle;
     int ScaledBorderAndShadow;
+    int Kerning;
 
     int default_style;      // index of default style
     char *name;             // file name in case of external subs, 0 for streams