Comments (4)
I mean it will work, but will it actually use the decimal point, or treat {\fs15.5} the same as if it was {\fs15comment}?
This depends on implementation. The most common vsfilter implementation, xy-VSFilter, has done so since 2012 Cyberbeing/xy-VSFilter@404301a, and libass has done so since 2007: libass/libass@66bfd7d. The only one I know of which parses it as an integer and discards the rest is the one used by MPC-HC.
See libass/libass#420 for more details and samples of this. In either case, this should never produce an error, in my opinion, as at least one major renderer does support them..
from ass_tag_parser.
Can you provide some citation for this? The spec is badly worded but the examples include only integer fields.
In case it's illegal, the decoders will discard the decimal point treating it as a comment. This is bad because it leads to the false belief that it is supported.
In any case if this in fact is OK, then the patch is
diff --git a/README.md b/README.md
index 3c06c0e..38230db 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ print(result[2].meta)
AssTagAlignment(alignment=5, legacy=False),
AssTagPosition(x=175.0, y=460.0),
AssTagFontName(name="Utopia with Oldstyle figures"),
- AssTagFontSize(size=90),
+ AssTagFontSize(size=90.0),
AssTagBorder(size=0.0),
AssTagBlurEdgesGauss(weight=3.0),
AssTagColor(red=19, green=19, blue=19, target=1, short=False),
diff --git a/ass_tag_parser/ass_parser.py b/ass_tag_parser/ass_parser.py
index 1ee3714..98ad6aa 100644
--- a/ass_tag_parser/ass_parser.py
+++ b/ass_tag_parser/ass_parser.py
@@ -497,7 +497,7 @@ _PARSING_MAP = [
(r"\fn", AssTagFontName, _single_arg),
(r"\fscx", AssTagFontXScale, _positive_float_arg),
(r"\fscy", AssTagFontYScale, _positive_float_arg),
- (r"\fs", AssTagFontSize, _positive_int_arg),
+ (r"\fs", AssTagFontSize, _positive_float_arg),
(r"\fe", AssTagFontEncoding, _positive_int_arg),
(r"\blur", AssTagBlurEdgesGauss, _positive_float_arg),
(r"\be", AssTagBlurEdges, _positive_int_arg),
diff --git a/ass_tag_parser/tests/test_ass_parsing.py b/ass_tag_parser/tests/test_ass_parsing.py
index 961dff3..931f37c 100644
--- a/ass_tag_parser/tests/test_ass_parsing.py
+++ b/ass_tag_parser/tests/test_ass_parsing.py
@@ -356,7 +356,8 @@ def test_parsing_valid_ass_line(
(r"{\fnComic Sans}", AssTagFontName(name="Comic Sans")),
(r"{\fe5}", AssTagFontEncoding(encoding=5)),
(r"{\fe}", AssTagFontEncoding(encoding=None)),
- (r"{\fs15}", AssTagFontSize(size=15)),
+ (r"{\fs15}", AssTagFontSize(size=15.0)),
+ (r"{\fs5.5}", AssTagFontSize(size=5.5)),
(r"{\fs}", AssTagFontSize(size=None)),
(r"{\fscx5.5}", AssTagFontXScale(scale=5.5)),
(r"{\fscy5.5}", AssTagFontYScale(scale=5.5)),
@@ -618,7 +619,7 @@ def test_parsing_valid_single_tag(
),
(
r"{\fs-5}",
- r"syntax error at pos 6: \fs takes only positive integers",
+ r"syntax error at pos 6: \fs takes only positive decimals",
),
(
r"{\fscx-5.5}",
@@ -864,7 +865,6 @@ def test_parsing_valid_single_tag(
(r"{\1a&HFF&derp}", "syntax error at pos 9: extra data"),
(r"{\be2a}", r"syntax error at pos 6: \be requires an integer"),
(r"{\be2.2}", r"syntax error at pos 7: \be requires an integer"),
- (r"{\fs5.4}", r"syntax error at pos 7: \fs requires an integer"),
(r"{\kgarbage}", r"syntax error at pos 10: \k requires a decimal"),
(r"{\Kgarbage}", r"syntax error at pos 10: \K requires a decimal"),
(r"{\kfgarbage}", r"syntax error at pos 11: \kf requires a decimal"),
from ass_tag_parser.
I don't have any citation.
For the moment, I can give you this: https://slow.pics/c/5JT0MRJb
I will inform myself to see if I can provide you any documentation about it.
Edit: it seems to be the same thing for blur and be tag
Edit: libass does not care of the number type. You can write a decimal for a integer field and it will still work. I think you should just accept any number for all tag that require a number. The subtitle provider will always do it's job to display it.
from ass_tag_parser.
You can write a decimal for a integer field and it will still work.
I mean it will work, but will it actually use the decimal point, or treat {\fs15.5}
the same as if it was {\fs15comment}
?
from ass_tag_parser.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ass_tag_parser.