{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/ttml1/issues/235","repository_url":"https://api.github.com/repos/w3c/ttml1","labels_url":"https://api.github.com/repos/w3c/ttml1/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/w3c/ttml1/issues/235/comments","events_url":"https://api.github.com/repos/w3c/ttml1/issues/235/events","html_url":"https://github.com/w3c/ttml1/issues/235","id":218675902,"number":235,"title":"Ambiguity regarding tab (U+0009) processing in significant whitespace.","user":{"login":"skynavga","id":377455,"avatar_url":"https://avatars3.githubusercontent.com/u/377455?v=3","gravatar_id":"","url":"https://api.github.com/users/skynavga","html_url":"https://github.com/skynavga","followers_url":"https://api.github.com/users/skynavga/followers","following_url":"https://api.github.com/users/skynavga/following{/other_user}","gists_url":"https://api.github.com/users/skynavga/gists{/gist_id}","starred_url":"https://api.github.com/users/skynavga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skynavga/subscriptions","organizations_url":"https://api.github.com/users/skynavga/orgs","repos_url":"https://api.github.com/users/skynavga/repos","events_url":"https://api.github.com/users/skynavga/events{/privacy}","received_events_url":"https://api.github.com/users/skynavga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-01T07:02:56Z","updated_at":"2017-04-20T16:09:16Z","closed_at":null,"body":"The processing of \"significant\" whitespace by an XML application requires [1] that all non-markup characters be passed to the application, and, further, that the ``xml:space`` attribute, if declared, may be used by an author to signal the application as to whether (1) default application whitespace processing applies or (2) that whitespace should be preserved (by the application, as defined by the application).\r\n\r\nIn TTML the attribute ``xml:space`` is \"declared\", and its semantics are mapped [2] to XSL-FO style properties [3], specifically: ``suppress-at-line-break``, ``linefeed-treatment``, ``white-space-collapse``, and ``white-space-treatment``.  These properties are intended to reflect the semantics of the CSS2 ``white-space`` property [4], but at a finer level of functional granularity.\r\n\r\nNow, in the course of TTML implementation activity, it has been asked what the behavior should be regarding an element to which ``xml:space=\"default\"`` applies and which content is, for example:\r\n\r\n<pre>&lt;span&gt;&amp;#x0009;X&lt;/span&gt;</pre>\r\n\r\nnamely, a single HORIZONTAL TAB (U+0009) character followed by a single 'X' character.\r\n\r\nThe particular question is whether the HORIZONTAL TAB (U+0009) character should:\r\n\r\n1. be mapped to the SPACE (U+0020) character;\r\n2. not be mapped to the SPACE (U+0020) character, but in all other ways be treated as if it were a SPACE (U+0020) character;\r\n3. be neither mapped to nor treated as a SPACE (U+0020) character, e.g., be retained throughout presentation processing and eventually be mapped to a glyph in the applicable font, e.g., by using the font's CMAP (or equivalent) to map HORIZONTAL TAB (U+0009) to a glyph the specifies a definite width (advance)?\r\n \r\nIf the answer to this question is that it should be mapped to the SPACE (U+0020) character, then a secondary question arises as to when, i.e., during which processing step, should this mapping take place?\r\n\r\nTo untangle this subject, we will need to look at the original specification of CSS2 which defines the (default) initial ``normal`` value for the ``white-space`` property [5] as:\r\n\r\n>This value directs user agents to collapse sequences of whitespace, and break lines as necessary to fill line boxes.\r\n\r\nand which, further, defines *whitespace* [6] as:\r\n\r\n>The token S in the grammar above stands for whitespace. Only the characters \"space\" (Unicode code 32), \"tab\" (9), \"line feed\" (10), \"carriage return\" (13), and \"form feed\" (12) can occur in whitespace. Other space-like characters, such as \"em-space\" (8195) and \"ideographic space\" (12288), are never part of whitespace.\r\n\r\nNow, while *whitespace* is well defined here, and corresponds precisely with the definition given in XML 1.1 [7], the phrase \"collapse sequences of whitespace\" is not well defined. In CSS2.1, this latter phrase is given more substance by defining a *whitespace processing model* [8], which does define an operational model that provides greater detail, including:\r\n\r\n> 4. If 'white-space' is set to 'normal', 'nowrap', or 'pre-line',\r\n> (1) every tab (U+0009) is converted to a space (U+0020)\r\n> (2) any space (U+0020) following another space (U+0020) — even a space before the inline, if that space also has 'white-space' set to 'normal', 'nowrap' or 'pre-line' — is removed.\r\n\r\nSo, what is the problem with respect to TTML? TTML bases its definition of ``xml:space=\"default\"`` semantics on XSL-FO 1.1, published in 2006, which is based on the original CSS2 that does not include the above clarifications found in CSS2.1. Furthermore, TTML bases the definition of ``xml:space=\"default\"`` semantics on the XSL-FO definitions of the newly minted XSL-FO (but not CSS2) properties:\r\n\r\n* ``suppress-at-line-break=\"auto\"``\r\n* ``linefeed-treatment=\"treat-as-space\"``\r\n* ``white-space-collapse=\"true\"``\r\n* ``white-space-treatment=\"ignore-if-surrounding-linefeed\"``\r\n\r\nwhere these values also happen to be the (default) initial values for these properties when they are not otherwise specified.\r\n\r\nIn contrast, XSL-FO defines ``white-space=\"normal\"`` as\r\n\r\n* ``linefeed-treatment=\"treat-as-space\"``\r\n* ``white-space-collapse=\"true\"``\r\n* ``white-space-treatment=\"ignore-if-surrounding-linefeed\"``\r\n* ``wrap-option=\"wrap\"``\r\n\r\na definition which also happens to be implicitly dependent upon the ``suppress-at-line-break`` property, since the interpretation of ``white-space-treatment=\"ignore-if-surrounding-linefeed\"`` depends upon the value of the ``suppress-at-line-break`` property.\r\n\r\nCombining the default initial values of these properties with the definition of ``white-space=\"normal\"``, we surmise that the default whitespace processing behavior for XSL-FO is intended to align with the default whitespace processing behavior of CSS2. However, a detailed reading of the semantics of this behavior raises a number of possible problems:\r\n\r\n1. the ``suppress-at-line-break``  property defines ``auto`` to suppress only the SPACE (U+0020) but not HORIZONTAL TAB (U+0009), and, further, explicitly states that all other characters are to be treated as if the value ``retain`` applies;\r\n2. nowhere in XSL-FO is there explicit language that would cause HORIZONTAL TAB (U+0009) to be mapped to SPACE (U+0020), although there is a vague reference to the possibility of such mapping taking place during refinement processing found under the definition of the ``white-space-collapse`` property where it is stated that:\r\n>after refinement, where some white space characters may have been discarded or turned into space characters, all remaining runs of two or more consecutive spaces are replaced by a single space, then any remaining space immediately adjacent to a remaining linefeed is also discarded.\r\n\r\nTo return to the example fragment of TTML cited above, absent a mapping from HORIZONTAL TAB (U+0009) to SPACE (U+0020), the whitespace processing behavior that applies to this fragment would seem to retain the HORIZONTAL TAB (U+0009) in\r\n\r\n<pre>&lt;span&gt;&amp;#x0009;X&lt;/span&gt;</pre>\r\n\r\nsince, according to ``white-space-collapse=\"true\"``, we have\r\n\r\n* ``&#x0009;`` is classified as white space in XML, **and**\r\n* ``&#x0009;`` is not ``&#x000A``, **but**\r\n* the immediately preceding flow object (before ``<fo:character character=\"&#x0009;\"/>``) is **not** a character flow object **and** the immediate following flow object is **not** a linefeed, i.e.,``<fo:character character=\"&#x000A;\"/>``\r\n\r\nso the ``&#x0009;`` is not collapsed, i.e., it does generate a glyph area.\r\n\r\nBut now, we have a problem since the (now elaborated) definition of *normal* whitespace processing behavior in CSS2.1 appears to call for every ``&#x0009;`` to be mapped to ``&#x0020;`` **prior** to performing white space collapsing behavior.\r\n\r\nSo, where does this leave us with respect to TTML? I believe we have two questions to resolve:\r\n\r\n1. Is ``&#x0009;`` mapped to ``&#x0020;``? If so, then in what context and during which processing step?\r\n2. If there are contexts where ``&#x0009;`` is not mapped to ``&#x0020;``, then what are the intended presentation semantics?\r\n\r\nMy answers to these questions are as follows:\r\n\r\n* When ``xml:space=\"default\"`` applies, then ``&#x0009;`` is mapped to ``&#x0020;`` prior to performing any other white space processing. This mapping would ideally occur during or immediately after constructing the reduced xml infoset of a TTML abstract document instance.\r\n* When ``xml:space=\"preserve\"`` applies, then ``&#x0009;`` is not mapped to ``&#x0020;``, in which case the CSS2.1 semantics would apply, namely:\r\n\r\n>All tabs (U+0009) are rendered as a horizontal shift that lines up the start edge of the next glyph with the next tab stop. Tab stops occur at points that are multiples of 8 times the width of a space (U+0020) rendered in the block's font from the block's starting content edge. \r\n\r\nSpecification text that implements the above could easily be added to both TTML1 and TTML2, ideally under the definition of ``xml:space`` [9] (and its TTML2 counterpart).\r\n\r\nI don't have a strong opinion about whether we should adopt the CSS2.1 presentation semantics for HORIZONTAL TAB in cases where ``xml:space=\"preserve\"`` applies. Alternative semantics could be to ignore entirely (i.e., treat like ZERO WIDTH SPACE) or treat as SPACE.\r\n\r\n[1] https://www.w3.org/TR/REC-xml/#sec-white-space\r\n[2] https://www.w3.org/TR/ttml1/#content-attribute-space\r\n[3] https://www.w3.org/TR/xsl/\r\n[4] https://www.w3.org/TR/xsl/#d0e297\r\n[5] https://www.w3.org/TR/1998/REC-CSS2-19980512/text.html#white-space-prop\r\n[6] https://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#whitespace\r\n[7] https://www.w3.org/TR/REC-xml/#NT-S\r\n[8] https://www.w3.org/TR/2011/REC-CSS2-20110607/text.html#white-space-model\r\n[9] https://www.w3.org/TR/ttml1/#content-attribute-space\r\n"},"comment":{"url":"https://api.github.com/repos/w3c/ttml1/issues/comments/295795022","html_url":"https://github.com/w3c/ttml1/issues/235#issuecomment-295795022","issue_url":"https://api.github.com/repos/w3c/ttml1/issues/235","id":295795022,"user":{"login":"skynavga","id":377455,"avatar_url":"https://avatars3.githubusercontent.com/u/377455?v=3","gravatar_id":"","url":"https://api.github.com/users/skynavga","html_url":"https://github.com/skynavga","followers_url":"https://api.github.com/users/skynavga/followers","following_url":"https://api.github.com/users/skynavga/following{/other_user}","gists_url":"https://api.github.com/users/skynavga/gists{/gist_id}","starred_url":"https://api.github.com/users/skynavga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skynavga/subscriptions","organizations_url":"https://api.github.com/users/skynavga/orgs","repos_url":"https://api.github.com/users/skynavga/repos","events_url":"https://api.github.com/users/skynavga/events{/privacy}","received_events_url":"https://api.github.com/users/skynavga/received_events","type":"User","site_admin":false},"created_at":"2017-04-20T16:09:16Z","updated_at":"2017-04-20T16:09:16Z","body":"I posted the following question to Steve Zilles and Tony Graham on 2017-03-31:\r\n\r\n>A question recently came up in the TTWG regarding XSL-FO whitespace handling semantics, upon which TTML is based. The specific question has to do with whether an HT (horizontal tab) character (U+0009) is mapped to SPACE (U+0020) during the XSL-FO refinement processing when xsl:space=\"default\" and, when it is not so mapped, i.e., when xsl:space=\"preserve\", then what are the intended formatting semantics.\r\n>\r\n>Assuming that the following properties apply:\r\n>\r\n>linefeed-treatment=\"treat-as-space\"\r\n>suppreses-at-line-break=\"auto\"\r\n>white-space-collapse=\"true\"\r\n>white-space-treatment=\"ignore-if-surrounding-linefeed\"\r\n>\r\n>and given an XSL-FO fragment\r\n>\r\n>&lt;fo:block>&lt;fo:inline>&amp;#x0009;X</fo:inline></fo:block>\r\n>\r\n>then\r\n>\r\n>(1) is &amp;#x0009; mapped to SPACE by the refinement process? if so, then where does XSL-FO specify this mapping occurs in refinement?\r\n>\r\n>(2) if it is not mapped to SPACE, but the above properties apply, then is retained or ignored before a line feed (line break)?\r\n"}}
{"actor":{"display_login":"skynavga"}}