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

Address ambiguity in 'tts:lineHeight' normal algorithm (#1241). #1242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/entities.dtd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

<!-- comment / uncomment the appropriate entity -->
<!-- <!ENTITY % sub.entities SYSTEM "entitiesedcopy.dtd" > -->
<!ENTITY % sub.entities SYSTEM "entitiesedcopy.dtd" >
<!-- <!ENTITY % sub.entities SYSTEM "entitieswd.dtd" > -->
<!-- <!ENTITY % sub.entities SYSTEM "entitiesfpwd.dtd" > -->
<!ENTITY % sub.entities SYSTEM "entitiescr.dtd" >
<!-- <!ENTITY % sub.entities SYSTEM "entitiescr.dtd" > -->
<!-- <!ENTITY % sub.entities SYSTEM "entitiespr.dtd" > -->
<!-- <!ENTITY % sub.entities SYSTEM "entitiesrec.dtd" > -->

Expand Down
20 changes: 19 additions & 1 deletion spec/ttml2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11520,7 +11520,25 @@ where this set of available fonts is constrained as needed to satisfy the comput
<loc href="#style-attribute-fontWeight"><att>tts:fontWeight</att></loc>, and
<loc href="#style-attribute-fontVariant"><att>tts:fontVariant</att></loc>,
style properties of <emph>P</emph>.
</p></item>
</p>
<note role="clarification">
<p>For compatibility with the <loc href="https://www.w3.org/TR/css-fonts-3/#character-map">first available font</loc>
defined by <bibref ref="css3-fonts"/>, it is intended that the phrase <emph>the first font obtained</emph>, as used in the previous text, refers to the
first font whose <loc href="#embedded-content-value-unicode-range">&lt;unicode-range&gt;</loc> includes the U+0020 (space) character,
Comment on lines +11526 to +11527
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recognise this intent as anything that TTWG discussed. However, I think it's obvious that the CSS algorithm needs to be considered a valid implementation.

Rather than duplicating the definition of the CSS algorithm, can we reference it instead, simplifying this text? Something along the lines of "This requirement is intended to be compatible with the CSS3 font algorithm for selecting the first font obtained; however if that algorithm is used, then it effectively overrides any semantic defined by tts:fontSelectionStrategy when determining line height."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that won't work for a number of reasons, which I would be happy to explain in a ttwg call

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next TTWG call will be in September, so it would be worth sketching out the reasons here in order to make progress sooner.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primarily:

  • CSS Font Module Level 3 (which TTML2 references) has slightly different wording that has been updated since in CSS Font Module Level 4; namely, "the first available font that would match the U+0020 (space) character" (CSS Fonts 3) vs "the first font whose unicode-range includes the U+0020 (space) character" (CSS Fonts 4); see also [css-fonts] Reconsider the definition of "first available font" csswg-drafts#4796;
  • AFAICT neither CSS Font Module Level 3 nor 4 specifies what it means to evaluate the unicode-range of a system (built-in) font;
  • neither CSS Font Module Level 3 nor 4 has our <font/> element, but instead has a @font-face rule, so we need language that refers to the unicode-range, i.e., our @range attribute (either specified or defaulted);

Bottom line is we can't reference CSS Font Module Level 3 for the language we need, and we still need to add language about the meaning of unicode-range, all together ending up with about the same (if not more) text in the note.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that CSS Fonts 4 probably needs some further work here, which means the CSS algorithm with which we should be compatible is effectively unstable right now. That suggests to me that we should not make any change until it is stable, and we should highlight the issues regarding unicode-range on that specification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • AFAICT neither CSS Font Module Level 3 nor 4 specifies what it means to evaluate the unicode-range of a system (built-in) font;

I just added a comment at w3c/csswg-drafts#4796 (comment) relating to this.

It seems to me that any font selection needs to happen after processing any <font>s and be based on the tts:fontFamily list. This is actually the same in both CSS and TTML, if we can assume the same intent of processing any font loading directives beforehand.

To do that would require alternative wording though, both here and in CSS, to refer to the existence of the 0x0020 character in the font's "character map" regardless of how that map has been derived.

Does this seem reasonable to you @skynavga ? I'm slightly worried that I've missed something...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution at w3c/csswg-drafts@abbc961 for CSS (that closed w3c/csswg-drafts#4796) looks like it could be applied here too, even if by using similar phrasing rather than by reference, in other words:

  • The unicode range of a local font is assumed to include all code points
  • The unicode range of a referenced font is defined by the font element's range attribute.
  • The test is then that the unicode range includes U+0020.

Alternatively we could say that for interpreting as per CSS the font element's range attribute must be taken to define the unicode-range descriptor as in CSS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this issue, i.e., for finding the first font having a mapping for 0x0020 (SPACE), it would be best to phrase the first bullet above as "the unicode range of a built-in font resource must include U+0020 for it to be a candidate for the first font obtained" or something to this effect.

where (1) the <loc href="#embedded-content-value-unicode-range">&lt;unicode-range&gt;</loc> of a built-in
<loc href="#terms-font-resource">font resource</loc>, i.e., a <loc href="#terms-font-resource">font resource</loc> provided by the
<loc href="#terms-presentation-processor">presentation processor</loc>, is a
<loc href="#embedded-content-value-unicode-range">&lt;unicode-range&gt;</loc> that contains each character of the font's
<loc href="https://www.w3.org/TR/css-fonts-3/#character-map">character map</loc>; and (2) the
<loc href="#embedded-content-value-unicode-range">&lt;unicode-range&gt;</loc> of an embedded <loc href="#terms-font-resource">font resource</loc>,
i.e., a <loc href="#terms-font-resource">font resource</loc> provided or referenced by a <loc href="#embedded-content-vocabulary-font">font</loc>
element, is the specified (or defaulted) <loc href="#embedded-content-value-unicode-range">&lt;unicode-range&gt;</loc> of that
<loc href="#embedded-content-vocabulary-font">font</loc> element.</p>
<p>Furthermore, this use of the U+0020 (SPACE) character as the fixed (and only) content context for choosing
<emph>the first font obtained</emph> effectively voids the use of
<loc href="#style-attribute-fontSelectionStrategy"><att>tts:fontSelectionStrategy</att></loc> as a mapping constraint.</p>
</note>
</item>
<item><p>
If <emph>F0</emph> is associated with font metrics that specify altitude <emph>A</emph>, depth <emph>D</emph>, and line gap <emph>G</emph>,
then set <emph>LH</emph> to the sum of scaled(<emph>A</emph>), scaled(<emph>D</emph>), and scaled(<emph>G</emph>),
Expand Down