]> granicus.if.org Git - libass/commitdiff
Bold/italic: interpret -1 as "true"
authorGrigori Goronzy <greg@blackbox>
Wed, 22 Jul 2009 01:21:33 +0000 (03:21 +0200)
committerGrigori Goronzy <greg@blackbox>
Wed, 22 Jul 2009 01:24:14 +0000 (03:24 +0200)
Interpret the value -1 as "true", as specified in the ASS
specifications.  Otherwise, clamp the value to 0 for other values <
0, so these are interpreted as "false".

libass/ass_render.c

index ece333da00778267e9274bb517a676015d6ccef0..de7d262e33df7210f130848ad1e40bdc0eab4057 100644 (file)
@@ -1052,17 +1052,17 @@ static void update_font(ass_renderer_t *render_priv)
 
     val = render_priv->state.bold;
     // 0 = normal, 1 = bold, >1 = exact weight
-    if (val == 0)
-        val = 80;               // normal
-    else if (val == 1)
+    if (val == 1 || val == -1)
         val = 200;              // bold
+    else if (val <= 0)
+        val = 80;               // normal
     desc.bold = val;
 
     val = render_priv->state.italic;
-    if (val == 0)
+    if (val == 1 || val == -1)
+        val = 110;              // italic
+    else if (val <= 0)
         val = 0;                // normal
-    else if (val == 1)
-        val = 110;              //italic
     desc.italic = val;
 
     render_priv->state.font =