seg-break-transformation-015

Thai and Latin characters around line break

WeasyPrint

This browser

Flags
script
Assertion
If the East Asian Width property of both the character before and after the line feed is F, W or H and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space.

Source

 1 <!DOCTYPE html>
 2 <html lang="en"><head>
 3 <meta charset="utf-8">
 4 <title>Thai and Latin characters around line break</title>
 5 <link href="mailto:ishida@w3.org" rel="author" title="Richard Ishida">
 6 <link href="https://drafts.csswg.org/css-text-3/#line-break-transform" rel="help">
 7 <meta content="If the East Asian Width property of both the character before and after the line feed is F, W or H  and neither side is Hangul, then the segment break is removed. Otherwise, the segment break is converted to a space." name="assert">
 8 <style type="text/css">
 9 /* the CSS below is not part of the test */
10 .test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
11 .ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
12 </style>
13 <script src="/resources/testharness.js"></script>
14 <script src="/resources/testharnessreport.js"></script>
15 </head>
16 <body>
17 <div id="log"></div>
18 <div class="test" id="test1"><span>ภาษา
19 latin</span></div>
20 <div class="test" id="test2"><span>ภาษา   
21 latin</span></div>
22 <div class="test" id="test3"><span>ภาษา
23         latin</span></div>
24 <div class="test" id="test4"><span>ภาษา   
25      latin</span></div>
26 <div class="test" id="test5"><span>ภาษา
27 
28 
29 latin</span></div>
30 <div class="test" id="test6"><span>ภาษา  
31    
32    
33    latin</span></div>
34 <div class="ref" id="ref1"><span>ภาษา latin</span></div>
35 
36 <div class="test" id="test7"><span>latin
37 ภาษา</span></div>
38 <div class="test" id="test8"><span>latin   
39 ภาษา</span></div>
40 <div class="test" id="test9"><span>latin
41         ภาษา</span></div>
42 <div class="test" id="test10"><span>latin   
43      ภาษา</span></div>
44 <div class="test" id="test11"><span>latin
45 
46 
47 ภาษา</span></div>
48 <div class="test" id="test12"><span>latin  
49    
50    
51    ภาษา</span></div>
52 <div class="ref" id="ref2"><span>latin ภาษา</span></div>
53 <script>
54 test(function() {
55 assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
56 }, "linebreak only thai latin");
57 test(function() {
58 assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
59 }, "spaces linebreak thai latin");
60 test(function() {
61 assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
62 }, "linebreak spaces thai latin");
63 test(function() {
64 assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
65 }, "spaces linebreak spaces thai latin");
66 test(function() {
67 assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
68 }, "multiple linebreaks thai latin");
69 test(function() {
70 assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
71 }, "multiple linebreaks + spaces thai latin");
72 test(function() {
73 assert_equals(document.getElementById('test7').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
74 }, "linebreak only latin thai");
75 test(function() {
76 assert_equals(document.getElementById('test8').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
77 }, "spaces linebreak latin thai");
78 test(function() {
79 assert_equals(document.getElementById('test9').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
80 }, "linebreak spaces latin thai");
81 test(function() {
82 assert_equals(document.getElementById('test10').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
83 }, "spaces linebreak spaces latin thai");
84 test(function() {
85 assert_equals(document.getElementById('test11').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
86 }, "multiple linebreaks latin thai");
87 test(function() {
88 assert_equals(document.getElementById('test12').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
89 }, "multiple linebreaks + spaces latin thai");
90 </script>
91 <!-- Notes:
92 The assertion will fail if space is produced for any line in the test paragraph.
93 -->
94 
95 
96 
97 
98 </body></html>