[ttml2] tts:fontSize clarification (#1272)

alexandercerutti has just created a new issue for https://github.com/w3c/ttml2:

== tts:fontSize clarification ==
Hi, as I'm integrating a support to TTML inside my OSS subtitles engine, I don't have a very clean picture of how the support to `tts:fontSize` should be implemented.

I've picked what I'd like to understand better and detailed here below:

___

1.

The table reports that the property _applies_ (only) _to_ `<span>`s.

However, I was looking in the issues here on github and in other parts of the document itself and I saw examples that include `tts:fontSize` as attributes for `p`aragraphs or `style`s. 

Furthermore, paragraphs below report it can be used also on `region`s.

So, which is the truth here? I am available to open a PR, if I understand where this attribute applies.

___

2.

I was trying to understand how the percentages are supported on this element. Document reports two not-very-clear statements on this (at least, to me).

It says that percentages should be calculated in the following ways:

 - ✅ When a percentage is used on a `region` (which means on `<region>` or a `<style>` inside of it?), it should be _relative to the [computed cell size](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-computed-cell-size)._
 
 - ⚠️ When a percentage is used on _the other supported elements_ (see above), it should be _relative to nearest ancestor [styled element's](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-styled-element) computed font size_.
 
About the second point, what is not very clear in the documentation is the "nearest ancestor styled element".

I was wondering where the resolution chain would stop and what is the "nearest ancestor element".

Also, I read this right below the table:

> If the relative unit is a percentage, then the referenced value is either the computed value of the font size of the nearest styled ancestor element or the [computed cell size](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-computed-cell-size).

So, I started looking around in the issues (as I didn't find anything useful in the document) and found [this comment](https://github.com/w3c/ttml2/pull/242#issuecomment-278875595), which reports:
 
> region inherits from tt
> in TTML2, and the initial value of fontSize is 1c on tt (absent being
> overridden by initial).

I know this comment talks only about the `region`, but bear with me and tell me if I'm wrong on this:

Even if `tt` uniquely the support to TT Parameter Namespace (`ttp:`) and not to TT Style Namespace (`tts:`), it still _implicitly_ defines some initial values (which are reported in tables as "_Initial:_" and which can be overridden by `<initial>`).

So, about `tts:fontSize`, its initial value is `1c` and therefore:

[computed cell size](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-computed-cell-size) will be used in these situations:
   - `tts:fontSize` is applied on regions (or its styles?);
   - In the anchestor chain of resolved styles, there is an anchestor that uses a Cell Size value (like `1c`);
   - There is no further ancestors that can provide a resolved `tts:fontSize` and therefore we fallback to the initial `1c` (or the overridden one by `<initial>`);
   
The first bullet point translates into:

- [out-of-line regions](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-out-of-line-region) have no other element but `<tt>` (+ `<initial>`) to refer to as an anchestor
- [inline regions](https://www.w3.org/TR/2018/REC-ttml2-20181108/#terms-inline-region) styles do not go beyond the "region barrier" (I remember I read it, but I cannot find the precise point right now) and therefore the third point applies as there are no further ancestors that can provide one (except the fact that we do not consider `<tt>` nor `<initial>` in this case but just the `1c`.


Did I get everything correcly?
Thank you very much for your support!

Please view or discuss this issue at https://github.com/w3c/ttml2/issues/1272 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 18 May 2024 01:14:28 UTC