Skip to content

[css-sizing][css-align][css-text] Aligning an aligned block of text within its container #1975

@palemieux

Description

@palemieux

Per the 20171109 joint TTWG/CSS meeting

As illustrated at multiRowAlign.pdf and specified at https://tech.ebu.ch/docs/tech/tech3380.pdf, a common captioning style requires the author to control the alignment of lines relative to the longest line within a block. This styling capability is not currently supported by CSS.

See https://codepen.io/palemieux/pen/yVxZWm . Region 2 illustrate the intended result of centering the longest line and right-aligning other lines relative to the right edge of the longest line.

This capability mirrors the ebutts:multiRowAlign styling attribute at https://www.w3.org/TR/ttml-imsc1.0.1/#multiRowAlign, which is demonstrated in the following sample document, which can be rendered at http://sandflow.com/imsc1proc/index.html .

<?xml version="1.0" encoding="UTF-8"?>
<tt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
 xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ttm="http://www.w3.org/ns/ttml#metadata"
 xmlns:ebutts="urn:ebu:tt:style" xml:lang="en" ttp:timeBase="media" xmlns:ebuttm="urn:ebu:tt:metadata" >
	<head>
		<metadata>
			<ebuttm:documentMetadata>
				<ebuttm:conformsToStandard>urn:ebu:tt:distribution:2014-01</ebuttm:conformsToStandard>
				<ebuttm:conformsToStandard>http://www.w3.org/ns/ttml/profile/imsc1/text</ebuttm:conformsToStandard>
			</ebuttm:documentMetadata>
		</metadata>		
		<styling>
            <style xml:id="baseStyle" tts:color="#FFFFFF" tts:lineHeight="100%"/>
            <style xml:id="blackBackground" tts:backgroundColor="#000000"/>
            <style xml:id="greenBackground" tts:backgroundColor="#00FF00"/>
			<style xml:id="startEnd" tts:textAlign="start" ebutts:multiRowAlign="end"/>
			<style xml:id="centerStart" tts:textAlign="center" ebutts:multiRowAlign="start"/>
		</styling>
		<layout>
			<region xml:id="area1" tts:origin="15% 10%" tts:extent="70% 20%" style="greenBackground" tts:displayAlign="center"/>
			<region xml:id="area2" tts:origin="15% 70%" tts:extent="70% 20%" style="blackBackground" tts:displayAlign="center"/>
		</layout>
	</head>
	<body>
		<div style="baseStyle">			
			<p xml:id="s1" region="area1" style="startEnd" begin="00:00:01" end="00:00:09">
multiRowAlign="end"<br/>textAlign="start"
			</p>
			<p xml:id="s2" region="area2" style="centerStart" begin="00:00:01" end="00:00:09">
multiRowAlign="start"<br/>textAlign="center"
			</p>
		</div>
	</body>
</tt>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions