Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for negative % values on TTML/DFXP? #300

Open
rlaphoenix opened this issue Mar 17, 2023 · 1 comment
Open

No support for negative % values on TTML/DFXP? #300

rlaphoenix opened this issue Mar 17, 2023 · 1 comment

Comments

@rlaphoenix
Copy link
Contributor

pycaption.exceptions.CaptionReadSyntaxError: CaptionReadSyntaxError(Invalid size: -2%. Please make sure the provided value is a number followed by one of the supported units: px, em, %, c, pt.)

Is the value of -2% really invalid/against spec? There are some services that avidly use it often.

<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml"
    xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
    xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
    xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ebuttm="urn:ebu:metadata"
    xmlns:ebutts="urn:ebu:style" xml:lang="" xml:space="default"
    ttp:cellResolution="50 30"
    ttp:timeBase="media">
    <head>
        <metadata>
            <ttm:title></ttm:title>
            <ttm:desc></ttm:desc>
            <ttm:copyright></ttm:copyright>
        </metadata>
        <styling>
            <style xml:id="BlackOnBlack"
                tts:backgroundColor="#00000080" tts:color="#00000080" />
            <style
                xml:id="BlackOnBlue" tts:backgroundColor="#0000ffff" tts:color="#00000080"
            />
            <style xml:id="BlackOnCyan" tts:backgroundColor="#00ffffff"
                tts:color="#00000080" />
            <style xml:id="BlackOnGreen"
                tts:backgroundColor="#00ff00ff" tts:color="#00000080" />
            <style
                xml:id="BlackOnMagenta" tts:backgroundColor="#ff00ffff" tts:color="#00000080"
            />
            <style xml:id="BlackOnRed" tts:backgroundColor="#ff0000ff"
                tts:color="#00000080" />
            <style xml:id="BlackOnWhite"
                tts:backgroundColor="#ffffffff" tts:color="#00000080" />
            <style
                xml:id="BlackOnYellow" tts:backgroundColor="#ffff00ff" tts:color="#00000080"
            />
            <style xml:id="BlueOnBlack" tts:backgroundColor="#00000080"
                tts:color="#0000ffff" />
            <style xml:id="BlueOnBlue"
                tts:backgroundColor="#0000ffff" tts:color="#0000ffff" />
            <style
                xml:id="BlueOnCyan" tts:backgroundColor="#00ffffff" tts:color="#0000ffff"
            />
            <style xml:id="BlueOnGreen" tts:backgroundColor="#00ff00ff"
                tts:color="#0000ffff" />
            <style xml:id="BlueOnMagenta"
                tts:backgroundColor="#ff00ffff" tts:color="#0000ffff" />
            <style
                xml:id="BlueOnRed" tts:backgroundColor="#ff0000ff" tts:color="#0000ffff"
            />
            <style xml:id="BlueOnWhite" tts:backgroundColor="#ffffffff"
                tts:color="#0000ffff" />
            <style xml:id="BlueOnYellow"
                tts:backgroundColor="#ffff00ff" tts:color="#0000ffff" />
            <style
                xml:id="CyanOnBlack" tts:backgroundColor="#00000080" tts:color="#00ffffff"
            />
            <style xml:id="CyanOnBlue" tts:backgroundColor="#0000ffff"
                tts:color="#00ffffff" />
            <style xml:id="CyanOnCyan"
                tts:backgroundColor="#00ffffff" tts:color="#00ffffff" />
            <style
                xml:id="CyanOnGreen" tts:backgroundColor="#00ff00ff" tts:color="#00ffffff"
            />
            <style xml:id="CyanOnMagenta" tts:backgroundColor="#ff00ffff"
                tts:color="#00ffffff" />
            <style xml:id="CyanOnRed"
                tts:backgroundColor="#ff0000ff" tts:color="#00ffffff" />
            <style
                xml:id="CyanOnWhite" tts:backgroundColor="#ffffffff" tts:color="#00ffffff"
            />
            <style xml:id="CyanOnYellow" tts:backgroundColor="#ffff00ff"
                tts:color="#00ffffff" />
            <style xml:id="GreenOnBlack"
                tts:backgroundColor="#00000080" tts:color="#00ff00ff" />
            <style
                xml:id="GreenOnBlue" tts:backgroundColor="#0000ffff" tts:color="#00ff00ff"
            />
            <style xml:id="GreenOnCyan" tts:backgroundColor="#00ffffff"
                tts:color="#00ff00ff" />
            <style xml:id="GreenOnGreen"
                tts:backgroundColor="#00ff00ff" tts:color="#00ff00ff" />
            <style
                xml:id="GreenOnMagenta" tts:backgroundColor="#ff00ffff" tts:color="#00ff00ff"
            />
            <style xml:id="GreenOnRed" tts:backgroundColor="#ff0000ff"
                tts:color="#00ff00ff" />
            <style xml:id="GreenOnWhite"
                tts:backgroundColor="#ffffffff" tts:color="#00ff00ff" />
            <style
                xml:id="GreenOnYellow" tts:backgroundColor="#ffff00ff" tts:color="#00ff00ff"
            />
            <style xml:id="MagentaOnBlack" tts:backgroundColor="#00000080"
                tts:color="#ff00ffff" />
            <style xml:id="MagentaOnBlue"
                tts:backgroundColor="#0000ffff" tts:color="#ff00ffff" />
            <style
                xml:id="MagentaOnCyan" tts:backgroundColor="#00ffffff" tts:color="#ff00ffff"
            />
            <style xml:id="MagentaOnGreen" tts:backgroundColor="#00ff00ff"
                tts:color="#ff00ffff" />
            <style xml:id="MagentaOnMagenta"
                tts:backgroundColor="#ff00ffff" tts:color="#ff00ffff" />
            <style
                xml:id="MagentaOnRed" tts:backgroundColor="#ff0000ff" tts:color="#ff00ffff"
            />
            <style xml:id="MagentaOnWhite" tts:backgroundColor="#ffffffff"
                tts:color="#ff00ffff" />
            <style xml:id="MagentaOnYellow"
                tts:backgroundColor="#ffff00ff" tts:color="#ff00ffff" />
            <style
                xml:id="RedOnBlack" tts:backgroundColor="#00000080" tts:color="#ff0000ff"
            />
            <style xml:id="RedOnBlue" tts:backgroundColor="#0000ffff"
                tts:color="#ff0000ff" />
            <style xml:id="RedOnCyan"
                tts:backgroundColor="#00ffffff" tts:color="#ff0000ff" />
            <style
                xml:id="RedOnGreen" tts:backgroundColor="#00ff00ff" tts:color="#ff0000ff"
            />
            <style xml:id="RedOnMagenta" tts:backgroundColor="#ff00ffff"
                tts:color="#ff0000ff" />
            <style xml:id="RedOnRed" tts:backgroundColor="#ff0000ff"
                tts:color="#ff0000ff" />
            <style xml:id="RedOnWhite"
                tts:backgroundColor="#ffffffff" tts:color="#ff0000ff" />
            <style
                xml:id="RedOnYellow" tts:backgroundColor="#ffff00ff" tts:color="#ff0000ff"
            />
            <style xml:id="WhiteOnBlack" tts:backgroundColor="#00000080"
                tts:color="#ffffffff" />
            <style xml:id="WhiteOnBlue"
                tts:backgroundColor="#0000ffff" tts:color="#ffffffff" />
            <style
                xml:id="WhiteOnCyan" tts:backgroundColor="#00ffffff" tts:color="#ffffffff"
            />
            <style xml:id="WhiteOnGreen" tts:backgroundColor="#00ff00ff"
                tts:color="#ffffffff" />
            <style xml:id="WhiteOnMagenta"
                tts:backgroundColor="#ff00ffff" tts:color="#ffffffff" />
            <style
                xml:id="WhiteOnRed" tts:backgroundColor="#ff0000ff" tts:color="#ffffffff"
            />
            <style xml:id="WhiteOnWhite" tts:backgroundColor="#ffffffff"
                tts:color="#ffffffff" />
            <style xml:id="WhiteOnYellow"
                tts:backgroundColor="#ffff00ff" tts:color="#ffffffff" />
            <style
                xml:id="YellowOnBlack" tts:backgroundColor="#00000080" tts:color="#ffff00ff"
            />
            <style xml:id="YellowOnBlue" tts:backgroundColor="#0000ffff"
                tts:color="#ffff00ff" />
            <style xml:id="YellowOnCyan"
                tts:backgroundColor="#00ffffff" tts:color="#ffff00ff" />
            <style
                xml:id="YellowOnGreen" tts:backgroundColor="#00ff00ff" tts:color="#ffff00ff"
            />
            <style xml:id="YellowOnMagenta" tts:backgroundColor="#ff00ffff"
                tts:color="#ffff00ff" />
            <style xml:id="YellowOnRed"
                tts:backgroundColor="#ff0000ff" tts:color="#ffff00ff" />
            <style
                xml:id="YellowOnWhite" tts:backgroundColor="#ffffffff" tts:color="#ffff00ff"
            />
            <style xml:id="YellowOnYellow" tts:backgroundColor="#ffff00ff"
                tts:color="#ffff00ff" />
            <style xml:id="defaultStyle"
                tts:backgroundColor="#00000000" tts:color="#ffffffff"
                tts:fontFamily="monospaceSansSerif" tts:fontSize="130%" tts:fontStyle="normal"
                tts:fontWeight="normal" tts:lineHeight="150%" tts:opacity="0"
                tts:textAlign="center" tts:textDecoration="none" />
            <style xml:id="doubleHeight"
                tts:fontSize="115%" />
            <style xml:id="textAlignCenter" tts:textAlign="center"
            />
            <style xml:id="textAlignLeft" tts:textAlign="start" />
            <style
                xml:id="textAlignRight" tts:textAlign="end" />
        </styling>
        <layout>
            <region
                xml:id="bottomAligned" tts:displayAlign="after" tts:extent="80% 80%"
                tts:origin="10% 10%" tts:padding="-2%" tts:writingMode="lrtb"
            />
        </layout>
    </head>
    <body>
        <div style="defaultStyle" xml:id="SGN0">
            <p
                begin="00:00:00.000" end="00:00:00.320" region="bottomAligned"
                style="textAlignLeft" xml:id="sub0">
                <span style="WhiteOnBlack 
doubleHeight">story: redacted</span>
                <br />
                <span style="WhiteOnBlack 
doubleHeight">Title: redacted</span>
                <br />
                <span style="WhiteOnBlack 
doubleHeight">config:2</span>
                <br />
                <span style="WhiteOnBlack doubleHeight">ep:
                    1</span>
                <br />
                <span style="WhiteOnBlack 
doubleHeight">air:</span>
            </p>
        </div>
    </body>
</tt>
@ianShifrin
Copy link

Hi, I believe negative margins are allowed per the spec, but believe negative padding is not.

Here is a link to a mention from the working group, https://lists.w3.org/Archives/Public/public-tt/2013May/0097.html

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants