summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2014-05-01 02:47:43 +0100
committerOleg Oshmyan <chortos@inbox.lv>2014-06-06 15:08:15 +0100
commit03c66c1dfd283f955d43b63e20ffa5a2f4dce9a8 (patch)
tree991a46d5c7dcb8ae79bda35f831c7353863c8d86
parent2f3ed2f5e36e645f02024e063a830c34002fe648 (diff)
downloadlibass-03c66c1dfd283f955d43b63e20ffa5a2f4dce9a8.tar.bz2
libass-03c66c1dfd283f955d43b63e20ffa5a2f4dce9a8.tar.xz
parse_tag: merge \fs+, \fs-, \fs
-rw-r--r--libass/ass_parse.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
index aa4a206..3410f83 100644
--- a/libass/ass_parse.c
+++ b/libass/ass_parse.c
@@ -349,26 +349,15 @@ 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;
- mystrtod(&p, &val);
- val = render_priv->state.font_size * (1 + pwr * val / 10);
- if (val <= 0)
- val = render_priv->state.style->FontSize;
- if (render_priv->state.font)
- change_font_size(render_priv, val);
- } else if (mystrcmp(&p, "fs-")) {
- double val;
- mystrtod(&p, &val);
- val = render_priv->state.font_size * (1 - pwr * val / 10);
- if (val <= 0)
- 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 * (1 - pwr) + val * pwr;
+ char *start = p;
+ if (mystrtod(&p, &val)) {
+ if (*start == '+' || *start == '-')
+ val = render_priv->state.font_size * (1 + pwr * val / 10);
+ else
+ val = render_priv->state.font_size * (1 - pwr) + val * pwr;
+ }
if (val <= 0)
val = render_priv->state.style->FontSize;
if (render_priv->state.font)