Open nigelmegitt opened 5 years ago
Adding another facet to this requirement:
I recall forwarding to the WG, either in conversation or in an issue (which I now cannot find) a requirement requested from a Japanese contributor to me in person at the HbbTV Symposium in Rome, 17th and 18th October 2017. This requirement was to permit inline presentation of images in text subtitle documents, with the use case being to represent major brand logos in subtitle text.
Coincidentally a colleague at the BBC told me today that, in using TTML to represent on-screen captions there is a need to put in SVG images inline with text. This is not for translations or hard of hearing subtitles, but for styled narrative texts or quotes provided as data for player-based rendering rather than burned into the video image as video pixels. Such captions are typically "forced" and interleaved with non-forced hard of hearing or translation subtitles. The SVG images are for example a Twitter logo, if a quote is being attributed to a tweet. It may be that where an SVG image file is not available a PNG or other format could be used instead.
[updated: completed template moved to first comment in issue]
Example image:
The text at the top right includes an icon, in this case a twitter icon.
I've found the place this was discussed previously: w3c/imsc-vnext-reqs#4
Business test for this:
When a symbol that has no Unicode character (e.g. gaijin) needs to be presented inline with text, content authors can insert the image easily, distributors can distribute it with minimal changes to distribution infrastructure, and players present the images consistently with authoring expectations.
[edited to respond to @skynavga 's comments]
@nigelmegitt https://github.com/w3c/imsc/issues/82 was asking for embedded images for the purpose of transmitting complete timed text programs. It sounds like you are thinking about inline images to supplement text-based timed text programs.
@nigelmegitt How would altText be carried/conveyed in the case of a inline image to be laid out as a grapheme cluster inline with text.
As @palemieux pointed out, we need to separate the sending of images for Image profile vs supplementing text in Text profile with graphics not available as Unicode text. I'll take the action to clean this up.
The easiest way to clean this up was to make this into an issue about embedding images in IMSC Text profile documents and open a new issue (#16) about embedding images in IMSC Image profile documents. Tidy-up now completed.
@palemieux your question in https://github.com/w3c/tt-reqs/issues/15#issuecomment-455230792 is a good one.
I'd add to the requirement like this:
In the context of the example with the Twitter icon, a screen reader may be expected to read the word "Twitter", say, in place of the image.
@cconcolato asked me if the image support needs to include colour. It does - the monochrome Twitter example is not the general case. For example some company logos that may be used in this way need to be presented in colour to work (especially the badly designed ones?!).
To me, there are 2 possible approaches:
I see several points to discuss regarding the image approach:
TTML2 has an example of how altText
metadata items can be used for that:
<p>
<image src="#talking-image">
<ttm:item name="altText" xml:lang="en">Talking</ttm:item>
<ttm:item name="altText" xml:lang="fr">Parlant</ttm:item>
</image>
</p>
So there does not seem to be a need for a technical change for TTML2. I would think though that having a mention of that approach in the image
section would be very useful.
@nigelmegitt Could you clarify the need for this requirement? I can see that if your UI lets the user increase/decrease the font size you would want the Twitter logo to be resized. Any other use case?
IIUC, the sizing of an image is done with tts:extent
, which can specify a <length>
including using the em
unit. Would this solve this sizing issue?
@nigelmegitt I don't understand the second sentence in your initial description:
This is not about adding embedded image support to IMSC Text Profile - for that see #16.
@nigelmegitt also the following part in your issue description says:
Using an image profile IMSC document would allow pre-rendering but not allow for accessible rendering of the text.
Can you clarify why you think this would not be possible? Is it due to IMSC Image profile restrictions on TTML2 images?
In any case, this approach would require changing the restrictions in the IMSC Text Profile, and we'd have to be careful because we don't want to require complex image processing in the text profile.
Now about the second option, using fonts. My understanding is that with this approach, you would need to author the content with:
<span tts:fontFamily="TwitterLogoFont">
) and not for the others.It is by definition accessible and sizing also works fine using tts:fontSize
. This also would require change in IMSC, and we'd have to be careful too about the combination of features (font, embedding, WOFF, ...) that we want to have.
Also it should be noted that in both approaches (images or fonts), both raster or vector graphics images can be used.
Re: https://github.com/w3c/tt-reqs/issues/15#issuecomment-456515719 about sizing images with tts:fontSize
, this is incompatible with both CSS and TTML2 style semantics, so this is not going to happen.
- Sizing images with fontSize:
@nigelmegitt Could you clarify the need for this requirement? I can see that if your UI lets the user increase/decrease the font size you would want the Twitter logo to be resized. Any other use case? IIUC, the sizing of an image is done with tts:extent, which can specify a
including using the em unit. Would this solve this sizing issue?
The only way to do this is to put the image into a font (as spline curves), in which case font size already applies.
@cconcolato re scaling images with font size, that's the requirement, with the use case as you identified. I haven't tried specifying a height with em
units but it's an interesting idea.
From the accessibility point of view, another way to do this would be to make the content text by default and add a "replace with SVG" attribute to the span containing the text. For example:
`Great Brand and have the semantics of presentation of that replacement image set the height to 1em.
I think that kind of use of a font, where a sequence of letters is automatically replaced, is probably the hardest authoring and implementation option of all of them. It means that document authors will really not be sure what is likely to be displayed.
@skynavga I'd like to keep investigating, I'm not really convinced yet that it is incompatible with CSS.
The bit about it not being about Text Profile looks like a typo - I will update it.
I've updated the bit about Text Profile to say Image Profile @cconcolato .
On Thu, Jan 24, 2019 at 8:11 AM Nigel Megitt notifications@github.com wrote:
@skynavga https://github.com/skynavga I'd like to keep investigating, I'm not really convinced yet that it is incompatible with CSS.
I am (completely convinced). Font size cannot apply to an object that has no definition of EM square. We have
tts:extent
andtts:{bpd,ipd}
for sizing inline images and their generated areas.
@skynavga CSS has separated out values and units, so https://www.w3.org/TR/css-values/#font-relative-lengths for example shows the basis of em units as being the font size of the element. Any length can be specified in em
units even if it is not text.
By way of a proof, here's a very simple example that demonstrates sizing of an SVG by font size: https://codepen.io/nigelmegitt/pen/KJgmvp
There is no problem with respect to using em
units with any of the size related styles that apply to images. That is because em
is resolved into pixels by making reference to the current font size. So in this (indirect) respect, yes, tts:fontSize
may be employed for resolving em
units.
So, I guess you may be asking how em
can be used by an element for which tts:fontSize
is not applied, strictly speaking?
So, I guess you may be asking how
em
can be used by an element for whichtts:fontSize
is not applied, strictly speaking?
@skynavga I don't think I am asking that, no, because the request here is for an inline image to be sized with the text it is inline with, which by definition therefore does have a font size. I expect that using the parent element's font size is acceptable too, i.e. that there would be no need to try to "grab" the font size of a sibling element somehow.
@nigelmegitt keep in mind that an image
can appear as a child of div
, p
, and span
. In the first two of these cases, it has block formatting semantics; in the third case, it has inline semantics.
If tts:fontSize
is to be used to resolve em
unit usage with respect to, say, tts:extent
, then it would have be resolved with respect to the computed value of tts:fontSize
on any of these three elements. It is probably worth clarifying this case where one might possibly argue that tts:fontSize
is being applied to image
.
Indeed, and I see that although tts:fontSize
only applies to span
it has a computed value on ancestor elements including p
and div
which is used in font size computation.
The Timed Text Working Group just discussed Add embedded image support to IMSC Text Profile tt-reqs#15
, and agreed to the following:
SUMMARY: Solution options available, need more thought and investigation, overall requirement to find some way to present images like glyphs are presented, in an accessible way, is accepted.
See also the discussion at w3c/csswg-drafts#4116.
This issue relates to to w3c/imsc-vnext-reqs#4 for consideration by TTWG in 2019.
This is not about adding embedded image support to IMSC Image Profile - for that see #16.
Is your feature request related to a problem? Please describe.
Use case: We need to include small inline images alongside text, in SVG and possibly other image formats. Ideally those inline images would be embedded content.
Describe the solution you'd like
In IMSC Text Profile we would like to be able to include an inline image to be laid out as a grapheme cluster inline with text, whose size would be adjusted using
tts:fontSize
and whose image content would be embedded in the file either directly (locally in the file) or as a resource defined in thehead
and referenced from the content, or as a remote resource.This is likely to need some modification to TTML2 to support the sizing and referencing aspects, since it is asking for an image to be used like a glyph.
Describe alternatives you've considered
i
element with a relevant CSS class and a stylesheet such as provided by, e.g. fontawesome allows for automated insertion of content in place of thei
element. This is still an image but is easier to work in an inline, font size based way.State if you intend for this requirement to be met by a particular specification
Likely to need changes in both TTML and IMSC.
Does this requirement represent a change in scope
Could be considered a small increase in scope of IMSC, but more generally, no, within current scope.
Additional context
See https://github.com/w3c/tt-reqs/issues/15#issuecomment-454075897 for an example image.