Comments (6)
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.
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.
@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
orproportionalSansSerif
- create a large region and use
tts:displayAlign
andtts: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.
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.
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.
@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)
- For .. in loops not protected from iterating prototype properties HOT 14
- Upgrade to use es6 language features? HOT 1
- `Set()` has a name clash with the ES6 `Set` object HOT 1
- Multiple referenced generic font family names can result in duplicate font-family values
- Error parsing fontSize with two lengths HOT 2
- Improve performance with a large number of regions and ISDs
- Unable to specify rgba color values for tts:textShadow HOT 1
- elementBoundingRect needs to be declared a `var`
- Update timeBase attribute to accept full list of values HOT 6
- adjacent tts:textCombine spans are combined into a single span HOT 3
- HTML rb, rtc and rbc elements are deprecated HOT 2
- if a line starts/ends with a ruby definition, line padding is not applied
- SMPTE timecode parsed incorrectly (23.976 FPS) HOT 1
- Resolve images source while generating ISD HOT 18
- Replace the XML SAX parser with a DOM parser HOT 6
- Spaces in `tts:fontFamily` list not handled in HTMLStylingMapDefinition code HOT 1
- Firefox bug with negative margins HOT 1
- FontFamily `default` name mapping missing HOT 7
- fillLineGap doesn't always fill the gap HOT 11
- Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'imscISD') HOT 4
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 imscjs.