]> granicus.if.org Git - libass/commitdiff
Add support for \fs+ and \fs- syntax
authorGrigori Goronzy <greg@blackbox>
Thu, 12 Aug 2010 20:15:10 +0000 (22:15 +0200)
committerGrigori Goronzy <greg@blackbox>
Thu, 12 Aug 2010 20:23:01 +0000 (22:23 +0200)
These forms can be used to add or subtract a value from the
current font size instead of setting a new font size. Animations
are supported, but not recommended, as they won't be fluid due to
grid-fitting/hinting.

libass/ass_parse.c

index 776416d9b01d6291e02df2934de6442c9bd2e43d..40aaf0430262f6b309eb4be81c408c68b051a95b 100644 (file)
@@ -359,6 +359,22 @@ static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
                 render_priv->state.hspacing * (1 - pwr) + val * pwr;
         else
             render_priv->state.hspacing = render_priv->state.style->Spacing;
+    } else if (mystrcmp(&p, "fs+")) {
+        double val;
+        if (mystrtod(&p, &val)) {
+            val = render_priv->state.font_size + pwr * val;
+        } else
+            val = render_priv->state.style->FontSize;
+        if (render_priv->state.font)
+            change_font_size(render_priv, val);
+    } else if (mystrcmp(&p, "fs-")) {
+        double val;
+        if (mystrtod(&p, &val))
+            val = render_priv->state.font_size - pwr * val;
+        else
+            val = render_priv->state.style->FontSize;
+        if (render_priv->state.font)
+            change_font_size(render_priv, val);
     } else if (mystrcmp(&p, "fs")) {
         double val;
         if (mystrtod(&p, &val))