/
171.txt
180 lines (131 loc) · 9.33 KB
/
171.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
* 仕様書
[REFS[
- [11] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#requirements-relating-to-the-bidirectional-algorithm>
]REFS]
* Unicode bidi アルゴリズム
@@ [[UAX #9]]
* bidi 検査
[46] [[Stringprep]] には [[bidi]] 文字の検査があります。
[45] [[IDNA2008]] と一部の [[PRECIS]] [[プロファイル]]では [[Bidi Rule]]
が使われます。
;; [[Bidi Rule]] 参照。
* CSS における bidi
[19] [[CSS]] では [CODE(CSS)@en['[[unicode-bidi]]']] と [CODE(CSS)@en['[[direction]]']] の2つの[[特性]]が
[[bidi]] に関わります。 [[Unicode]] の [[bidi]] に関する[[文字]]と合わせて、 [[Unicode]]
の [[bidi]] アルゴリズムに従って[[レンダリング]]されます。
* HTML における bidi
** 双方向アルゴリズム書式付け文字
[21] [[HTML]] でいう[DFN[[RUBYB[双方向アルゴリズム書式付け文字]@en[bidirectional-algorithm formatting characters]]]]は、
[[Unicode]] の [CODE[[[Bidi_Char]]]] のうち [[Implicit Directional Formatting Characters]]
3文字を除いた9文字とされています [SRC[>>11]]。いずれも [[Unicode]] の [[bidi]] アルゴリズムで動作が定義されている[[文字]]です。
[REFS[
- [20] [CITE@en[Character set "$html:bidirectional-algorithm-formatting-characters"]] ([TIME[2014-01-13 09:06:21 +09:00]] 版) <http://chars.suikawiki.org/set?expr=%24html%3Abidirectional-algorithm-formatting-characters>
]REFS]
** 双方向アルゴリズム書式付け文字範囲
[22] [DFN[[RUBYB[[[双方向アルゴリズム書式付け文字範囲]]]@en[bidirectional-algorithm formatting character ranges]]]]とは、次の各範囲です [SRC[>>11]]。
[FIG[
- [23] [[HTML要素]]の[[null名前空間]]の[[属性]]それぞれ
- [24] [[HTML要素]]の[[子供]]の [CODE(DOMi)@en[[[Text]]]] を連結し次のように分割した範囲それぞれ
-- [25] [CODE(HTMLe)@en[[[br]]]] [[要素]]があればそこで範囲を分割する
-- [26] [[語句内容]]でない[[フロー内容]]である[[HTML要素]]があればそこで範囲を分割する
]FIG]
** 著者に対する要件
[27] [[双方向アルゴリズム書式付け文字範囲]]においては、[[双方向アルゴリズム書式付け文字]]は次のように対になっていなければ[['''なりません''']]
[SRC[>>11]]。
[FIG[
- [28] [CODE(charname)@en[[[LRE]]]] / [CODE(charname)@en[[[RLE]]]] があれば、対応する [CODE(charname)@en[[[PDF]]]] があること
- [29] [CODE(charname)@en[[[LRO]]]] / [CODE(charname)@en[[[RLO]]]] があれば、対応する [CODE(charname)@en[[[PDF]]]] があること
- [30] [CODE(charname)@en[[[LRI]]]] / [CODE(charname)@en[[[RLI]]]] / [CODE(charname)@en[[[FSI]]]]
があれば、対応する [CODE(charname)@en[[[PDI]]]] があること
]FIG]
[34] つまり [[CSS]] によって[[要素]]ごとに適用される規定 (>>18) と矛盾する形でこれらの[[文字]]を使うと[[レンダリング]]結果が予測しづらくなってしまいますから、
[[要素]]の入れ子関係とこれらの[[文字]]の入れ子関係が整合的でなければならないのです。
[31] しかしこれらの[[文字]]を直接使うよりは、 [CODE(HTMLa)@en[[[dir]]]] [[属性]]、
[CODE(HTMLe)@en[[[bdi]]]] [[要素]]、 [CODE(HTMLe)@en[[[bdo]]]] [[要素]]を使うことが[RUBYB[勧められています]@en[encouraged]]。
[SRC[>>11]]
;; [39] とはいえ[[属性値]]では[[文字]]を使うしかありません。
** 処理モデル
[13] [[HTML]] の[[レンダリング]]における [[bidi]] の扱いに関しては、 [CODE(CSS)@en['[[unicode-bidi]]']],
[CODE(CSS)@en['[[direction]]']], [CODE(CSS)@en['[[content]]']] といった [[CSS]] の[[特性]]を介して
[[Unicode]] の [[bidi]] アルゴリズムに従うものとして定義されています [SRC[>>11]]。
[14] [[利用者エージェント]]は、
- [15] [[CSS]] を実装し、 >>13 や[[著者]]による指定に従う
- [16] >>13 の[[利用者エージェントスタイルシート]]に対応しているかのように実装するものの、
[[著者]]による [[CSS]] の指定には対応しない
- [17] [[CSS]] 以外の[[スタイル言語]]で、同等のものを実装する
... のいずれかの形で実装することを求められています [SRC[>>11]]。
[18] [[HTML]] の中では、 [CODE(HTMLa)@en[[[dir]]]] [[属性]]、 [CODE(HTMLe)@en[[[bdi]]]] [[要素]]、
[CODE(HTMLe)@en[[[bdo]]]] [[要素]]、 [CODE(HTMLe)@en[[[br]]]] [[要素]]、[CODE(HTMLe)@en[[[pre]]]]
[[要素]]、[CODE(HTMLe)@en[[[textarea]]]] [[要素]]、 [CODE(HTMLe)@en[[[wbr]]]] [[要素]]について [[bidi]]
に関わる[[レンダリング]]の規定があります。
[REFS[
- [32] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#bidi-rendering>
- [33] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#br-wbr-content>
]REFS]
[35] [[CSS]] 以外で[[レンダリング]]される場面についても規定があります。
[REFS[
- [38] [CODE(DOMm)@en[[[drawText]]]]
-- [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#text-preparation-algorithm>
- [36] [CODE(HTMLe)@en[[[title]]]] [[要素]]
-- [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#the-title-element>
- [37] [[UI]] 要素各種
-- [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2014-01-09 07:29:06 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#text-rendered-in-native-user-interfaces>
]REFS]
* 歴史
[1]
[CITE[Authoring HTML for Middle Eastern Content]] <http://www.microsoft.com/globaldev/handson/dev/Mideast.mspx>
([[名無しさん]] [sage])
[2]
[CITE[Exploring Better Source Editing for Bidirectional XHTML and XML]] <http://www.sw.it.aoyama.ac.jp/2005/pub/IUC28-bidi/IUC28.html>
([[名無しさん]] [sage])
[3]
[CITE[Hebrew characters in XML and XHTML]] <http://www.nirdagan.com/hebrew/characters/#test>
([[名無しさん]])
[4]
[CITE[Authoring HTML for Middle Eastern Content]] <http://www.microsoft.com/globaldev/handson/dev/Mideast.mspx>
([[名無しさん]] [WEAK[2006-12-20 23:31:24 +00:00]])
[5]
[CITE@en-US[Internationalization Best Practices: Handling Right-to-left Scripts in XHTML and HTML Content -- (Editors' copy)]] ([TIME[2006-07-27 02:17:07 +09:00]] 版) <http://www.w3.org/International/geo/html-tech/tech-bidi.html>
[6] [CITE[Revision of UBA for improved display of URL/IRIs - Google Docs]]
( ([TIME[2011-07-23 14:30:01 +09:00]] 版))
<https://docs.google.com/document/d/1c8-svx7og0qBUfGBobw7LYfOcNeDVPYbNVMNpSqYCFo/edit?hl=en>
(cache <http://suika.fam.cx/gate/2007/schema/schema/6ab74bc21022f5cc9bfd95a62c76046a/prop.html>
[7] [CITE@en[Web Applications 1.0 r5754 Define conformance criteria around bidi formatting characters]]
( ([TIME[2011-01-10 18:55:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=5753&to=5754>
[8] [CITE@en[Web Applications 1.0 r7783 Update HTML in preparation for Unicode 6.3]]
( ([TIME[2013-03-30 08:20:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7782&to=7783>
[9] [CITE[Widget Interface]]
( ([TIME[2013-10-29 00:58:56 +09:00]] 版))
<http://www.w3.org/TR/widgets-apis/#getting-localizable-strings>
[10] [CITE@en-US[Additional Requirements for Bidi in HTML]]
([TIME[2010-03-05 16:28:54 +09:00]] 版)
<http://www.w3.org/TR/2010/WD-html-bidi-20100304/>
[12] [CITE[IRC logs: freenode / #whatwg / 20101111]]
( ([TIME[2010-11-19 23:02:05 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20101111#l-254>
[40] [CITE@en-US[Notifications API Standard]]
( ([TIME[2014-02-11 16:20:34 +09:00]] 版))
<http://notifications.spec.whatwg.org/#direction-0>
[41] [CITE@en[Additional Requirements for Bidi in HTML & CSS]]
( ([TIME[2015-07-16 21:26:45 +09:00]] 版))
<http://www.w3.org/TR/2015/NOTE-html-bidi-20150721/>
[42] [CITE@en[IRIs and bidirectional formatting characters]]
([[Anne van Kesteren]] 著, [TIME[2015-08-25 19:28:17 +09:00]] 版)
<https://lists.w3.org/Archives/Public/www-international/2015JulSep/0126.html>
[43] [CITE@en[Add a section on rendering URLs with some advice around bidirectional… · whatwg/url@d1152b9]]
([TIME[2015-08-27 11:53:08 +09:00]] 版)
<https://github.com/whatwg/url/commit/d1152b94a16ae91e1f72d128fd5ef589635f0e7c>
[44] [CITE@en[Tweak the bidirectional rendering note and add a dependency on UTS36.… · whatwg/url@e67f9dd]]
([TIME[2015-09-02 11:24:50 +09:00]] 版)
<https://github.com/whatwg/url/commit/e67f9dd7a1106d867862d3b5d9f044388f84909e>
[47] [CITE@en[CSV on the Web: Use Cases and Requirements]]
([TIME[2016-02-21 17:43:46 +09:00]] 版)
<https://www.w3.org/TR/2016/NOTE-csvw-ucr-20160225/#UC-SupportingRightToLeftDirectionality>
[48] [CITE@en[Remove document conformance requirements for bidi characters]]
([[zcorpan]]著, [TIME[2016-08-11 02:53:58 +09:00]])
<https://github.com/whatwg/html/commit/fe9dce390338a7f8941ba504d5aab7d56f2099f4>
[49] [CITE@en[Use of ZWJ · Issue #2 · w3c/i18n-discuss]]
([TIME[2017-04-12 23:36:37 +09:00]])
<https://github.com/w3c/i18n-discuss/issues/2>