W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2018

[csswg-drafts] [css-text-4] Propose 'text-spacing: space-first' (trim-start-except-first-line) as a normal behavior

From: Shinyu Murakami via GitHub <sysbot+gh@w3.org>
Date: Wed, 21 Mar 2018 16:47:39 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-307329056-1521650856-sysbot+gh@w3.org>
MurakamiShinyu has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-text-4] Propose 'text-spacing: space-first' (trim-start-except-first-line) as a normal behavior ==
## Ebook reader's default text-spacing behavior

The [text-spacing](https://drafts.csswg.org/css-text-4/#text-spacing-property) is not yet implemented in web browsers, but some part of this feature is already seen in ebook readers.
I put here two example screenshots (Kindle for PC, and Kinoppy for PC):

Kindle for PC screenshot:
<img width="340" alt="kindle-win-sample-1" src="https://user-images.githubusercontent.com/3324737/37723132-fed7863e-2d70-11e8-9c56-0cf464090d59.png">

Kinoppy for PC screenshot:
<img width="318" alt="kinoppy-win-sample-1" src="https://user-images.githubusercontent.com/3324737/37723240-37f69662-2d71-11e8-8553-a42ac9c35506.png">

In these examples, the **trim-adjacent** behavior is seen at "、『" in the middle of a line, and the **trim-start** behavior is seen in the lines starting with "「" or "『".

However, there is a difference between these two examples. In the Kindle case, all opening punctuations ("「" and "『") are set half-width at start of lines. On the other hand, in the Kinoppy case, only the opening punctuation ("『") after a soft wrap break is set half-width, and kept full-width at beginning of paragraphs.

While Kinoppy's behavior is a normal Japanese typesetting style, Kindle's behavior is not so. Setting opening punctuation half-width at beginning of  a paragraph with no indent is hard to recognized as beginning of a paragraph. I know Japanese publishing people asking Kindle dev to fix it.

## The preferable behavior not possible in current text-spacing spec

The problem here is that the Japanese ebook's preferable text-spacing behavior is not possible in the current [text-spacing](https://drafts.csswg.org/css-text-4/#text-spacing-property) spec.

We need **space-start** at the first line (or after forced line breaks) and **trim-start** at the rest lines.

I suggest the new value keyword **space-first** for such behavior, and it would be included in the baseline behavior (**normal**):

Specifies the baseline behavior, equivalent to ‘space-first allow-end trim-adjacent’.

Set fullwidth opening punctuation with full-width glyphs (spaced) at the start of the first line of each block container and each line after a forced line break, and set fullwidth opening punctuation with half-width glyphs (flush) at the start of other lines.

**Value**:	normal | none | [ trim-start | space-start | space-first ] || [ trim-end | space-end | allow-end ] || [ trim-adjacent | space-adjacent ] || no-compress || ideograph-alpha || ideograph-numeric || punctuation

## Rethinking “Japanese Paragraph-start Conventions in CSS”

There may be an opinion that the current text-spacing spec is sufficient because [Japanese Paragraph-start Conventions in CSS](https://drafts.csswg.org/css-text-4/#japanese-start-edges) shows the example that enables the preferable behavior:

- Brackets hang in indent, flush with other lines (third scheme):
p { /* Hanging alignment */
  margin: 0;
  text-indent: 1em;
  text-spacing: trim-start;
  hanging-punctuation: first;

Yes, it would be great if we can use this. But unfortunately, there is no way to apply this to the current Japanese ebooks (EPUB and Kindle formats).

Most Japanese publishers adopt the Japanese EPUB guideline, [EBPAJ EPUB 3 File Creation Guide](http://ebpaj.jp/counsel/guide), that includes XHTML templates and CSS stylesheets, such as:

<p> この文章はサンプルです。</p>

p {
    margin: 0;
    text-indent: 0;

That is, paragraphs start with an ideographic space (U+3000) unless starting with an opening punctuation such as "「".
Almost all Japanese EPUB (and Kindle) books are made with this way, and we must accept this reality even if using ideographic space instead of text-indent considered not very good.

The bigger concern with current spec is that the ebook reader implementation and the spec becoming inconsistent. The **space-first** (trim-start-except-first-line) behavior is implemented as default behavior in ebook readers, ignoring the CSS spec. So I believe the text-spacing **normal** should include the **space-first** behavior.

Also I believe the **space-first** behavior is good for general Web content, it improves readability and beauty of CJK text.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2462 using your GitHub account
Received on Wednesday, 21 March 2018 16:47:44 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:26 UTC