seg-break-transformation-004

Won and halfwidth 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 or H and neither side is Hangul, then the segment break is removed.

Source

 1 <!DOCTYPE html>
 2 <html lang="en"><head>
 3 <meta charset="utf-8">
 4 <title>Won and halfwidth 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 or H and neither side is Hangul, then the segment break is removed." 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 24</span></div>
20 <div class="test" id="test2"><span>21 24</span></div>
22 <div class="test" id="test3"><span>23         24</span></div>
24 <div class="test" id="test4"><span>25      24</span></div>
26 <div class="test" id="test5"><span>27 
28 
29 24</span></div>
30 <div class="test" id="test6"><span>31    
32    
33    24</span></div>
34 <div class="ref" id="ref1"><span>₩24</span></div>
35 <div class="test" id="test7"><span>24
36 </span></div>
37 <div class="test" id="test8"><span>24   
38 </span></div>
39 <div class="test" id="test9"><span>24
40 </span></div>
41 <div class="test" id="test10"><span>24   
42 </span></div>
43 <div class="test" id="test11"><span>24
44 
45 
46 </span></div>
47 <div class="test" id="test12"><span>24  
48    
49    
50 </span></div>
51 <div class="ref" id="ref2"><span>24₩</span></div>
52 <script>
53 test(function() {
54 assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
55 }, "linebreak only ₩24");
56 test(function() {
57 assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
58 }, "spaces linebreak ₩24");
59 test(function() {
60 assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
61 }, "linebreak spaces ₩24");
62 test(function() {
63 assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
64 }, "spaces linebreak spaces ₩24");
65 test(function() {
66 assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
67 }, "multiple linebreaks ₩24");
68 test(function() {
69 assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref1').firstChild.offsetWidth);
70 }, "multiple linebreaks + spaces ₩24");
71 test(function() {
72 assert_equals(document.getElementById('test7').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
73 }, "linebreak only 24₩");
74 test(function() {
75 assert_equals(document.getElementById('test8').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
76 }, "spaces linebreak 24₩");
77 test(function() {
78 assert_equals(document.getElementById('test9').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
79 }, "linebreak spaces 24₩");
80 test(function() {
81 assert_equals(document.getElementById('test10').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
82 }, "spaces linebreak spaces 24₩");
83 test(function() {
84 assert_equals(document.getElementById('test11').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
85 }, "multiple linebreaks 24₩");
86 test(function() {
87 assert_equals(document.getElementById('test12').firstChild.offsetWidth, document.getElementById('ref2').firstChild.offsetWidth);
88 }, "multiple linebreaks + spaces 24₩");
89 </script>
90 <!-- Notes:
91 The assertion will fail if space is produced for any line in the test paragraph.
92 -->
93 
94 
95 
96 
97 </body></html>