GithubHelp home page GithubHelp logo

Font size percentage about imscjs HOT 6 CLOSED

sandflow avatar sandflow commented on May 29, 2024
Font size percentage

from imscjs.

Comments (6)

palemieux avatar palemieux commented on May 29, 2024

However, as the ttx styles are combined with the region-1 definition at the paragraph level, shouldn't it be 80% of the region's height?

tts:fontSize="80%" on p means relative to parent element's font size, so relative to tts:fontSize on div, which inherits from tts:fontSize on body, which inherits from tts:fontSize on region.

The initial value of tts:fontSize on region is 1c, so tts:fontSize="80%" on p means 80% of 1c.

from imscjs.

Gontran-Molotov avatar Gontran-Molotov commented on May 29, 2024

Thank you very much for your explanation.

The point is indeed that this is 80% of the parent's font size, not the parent's height, as specified in the TTML standard https://www.w3.org/TR/ttaf1-dfxp/#style-attribute-fontSize

In my case, maybe the font used as "monospaceSansSerif" on my system is not the right one. Is there a reference font that is recommended to display captions?

from imscjs.

palemieux avatar palemieux commented on May 29, 2024

@Gontran-Molotov It looks like, unfortunately, the file was not authored correctly, i.e. the font size was set too large for the size of the region.

Authors have a couple of (non-mutually-exclusive) options to avoid this situation:

  • use one of the reference fonts specified in IMSC1 , i.e. by specifying monospaceSerif or proportionalSansSerif
  • create a large region and use tts:displayAlign and tts:textAlign to position the text, See example below.
<?xml version="1.0" encoding="utf-8"?>
<tt xmlns="http://www.w3.org/ns/ttml" xmlns:smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="ita">
    <head>
        <smpte:information smpte:mode="Enhanced" />
        <metadata>
            <ttm:title></ttm:title>
            <ttm:desc></ttm:desc>
            <ttm:copyright></ttm:copyright>
        </metadata>
        <styling>
            <style xml:id="ttx" tts:fontFamily="monospaceSansSerif" tts:fontSize="80%" />
        </styling>
        <layout>
            <region xml:id="region-1" tts:extent="82.50% 84.17%" tts:origin="17.50% 11.67%" tts:displayAlign="after"/>
        </layout>
    </head>
    <body>
        <div>
            <p begin="418692:19:25.000" end="418692:19:25.040" region="region-1" style="ttx">
                <span tts:color="#FF00FF" tts:backgroundColor="#000000">He sings in english.</span>
            </p>
        </div>
    </body>
</tt>

from imscjs.

Gontran-Molotov avatar Gontran-Molotov commented on May 29, 2024

Thank you again for your answer.

I'm not sure I can adapt the TTML file I use as it is automatically generated from a Teletext content. The converter tool does not offer advanced settings to tweak the generated content.

However, I did some search about recommended fonts to display captions, and I found that Tiresias Infofont is the most adapted one for the height of the regions defined in my TTML file. All letters which are not descenders are fully visible. The bottom part of descenders like g, j, p, q, y are still hidden, and I have to apply a CSS class that sets overflow: visible !important on DIV elements representing regions to override the default overflow: hidden set by imscJS.

from imscjs.

nigelmegitt avatar nigelmegitt commented on May 29, 2024

I've seen cropped descenders too @Gontran-Molotov and I'm not really sure why. However, reducing the font size and increasing the line height seems to help. For example if you have tts:fontSize="100%" tts:lineHeight="120%" you can achieve the same line spacing with a slightly smaller font by adjusting them, for example tts:fontSize="96%" tts:lineHeight="125%". You'd need to do the maths to adjust for your file.

In terms of font, it isn't obvious why Tiresias would be a good one for avoiding this problem - it is true that it is often used in subtitle applications, for example it is in the UK regulator Ofcom's current guidance for DVB bitmap subtitles. The thing to watch out for is the font table values for ascender, descender and linegap, which are usually used to determine the line spacing.

from imscjs.

palemieux avatar palemieux commented on May 29, 2024

@Gontran-Molotov Can you DM me the name of the converter tool ([email protected])? It looks like it needs to be fixed.

from imscjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.