IRT-Open-Source / imsced

MIT License
12 stars 1 forks source link

Line to line collisions #6

Open andreastai opened 4 years ago

andreastai commented 4 years ago

A user reported the following behaviour:

When opening the below subtitle file (shortened and copied inline), he gets a collision of text lines.

Screenshot from imscED:

grafik

Is this a bug?

<?xml version="1.0" encoding="UTF-8"?>
<tt:tt xmlns:tt="http://www.w3.org/ns/ttml" 
   xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
   xmlns:tts="http://www.w3.org/ns/ttml#styling"
   xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
   ttp:timeBase="media"
   xml:lang="de" ttp:cellResolution="50 30" xml:space="default">
    <tt:head>
        <tt:styling>
            <tt:style xml:id="defaultStyle" tts:fontSize="80%" tts:lineHeight="125%"
                tts:textAlign="center" tts:color="#ffffffff" tts:backgroundColor="#00000000"
                tts:fontStyle="normal" tts:fontWeight="normal" tts:textDecoration="none"
                tts:fontFamily="monospaceSansSerif"/>
            <tt:style xml:id="WhiteOnBlack" 
              tts:color="#ffffffff"
              tts:backgroundColor="#000000ff"/>
            <tt:style xml:id="textAlignCenter" tts:textAlign="center"/>
            <tt:style xml:id="doubleHeight" tts:fontSize="200%"/>
        </tt:styling>
        <tt:layout>
            <tt:region xml:id="bottom" tts:extent="80% 80%" tts:origin="10% 10%"
                tts:padding="0%" tts:displayAlign="after" tts:writingMode="lrtb"/>
        </tt:layout>
    </tt:head>
    <tt:body>
        <tt:div style="defaultStyle">
            <tt:p begin="00:00:00.000" end="00:00:30.000" style="textAlignCenter"
                region="bottom" xml:id="sub1">
                <tt:span style="WhiteOnBlack doubleHeight">First subtitle row</tt:span>
                <tt:br/>
                <tt:span style="WhiteOnBlack doubleHeight">Second subtitle row</tt:span>
            </tt:p>
        </tt:div>
    </tt:body>
</tt:tt>
andreastai commented 4 years ago

The above TTML file is a special case. The line-height of the containing block element is smaller than the text that appears in the container (the <span> reference a style where the font-size is 200%).

The rendering engine of imscED is imscJS by @palemieux. If you test the file on the imscJS Demo page you get the same behavior:

grafik

As the implementation of imscJS is following the TTML specifcation very strictly, it is probable that there is problem with the file.

I will check this in more detail.