eol-spaces-bidi-002.html (3203B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Text 3 test: trailing pre-wrap spaces and bidi</title> 4 <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net/"> 5 <link rel="help" href="https://drafts.csswg.org/css-text-3/#white-space-phase-2"> 6 <link rel="help" href="https://www.w3.org/TR/css-writing-modes/#text-direction"> 7 <link rel="help" href="http://www.unicode.org/reports/tr9/#L1"> 8 <link rel="match" href="reference/eol-spaces-bidi-002-ref.html"> 9 <meta name="assert" content="Use UAX9L1 to determine which space is at the end of the line, taking into account that such spaces, when pre-wrap, must hang."> 10 11 <style> 12 @font-face { 13 font-family: "Hasubi Mono"; 14 src: url("/fonts/hasubi-mono/HasubiMono-Regular.woff2"); 15 } 16 17 div { 18 font-family: "Hasubi Mono", monospace; 19 border: solid blue; 20 font-size: 1.5em; 21 white-space: pre-wrap; 22 } 23 .ref { 24 border-color: orange; 25 white-space: pre; 26 } 27 .w6 { width: 6.01ch; } /* .01 to cover floating point errors */ 28 .w7 { width: 7.01ch; } 29 .w8 { width: 8.01ch; } 30 .w9 { width: 9.01ch; } 31 32 .blue { background: #aaaaff; } 33 .red { background: #ffaaaa; } 34 .green { background: #aaffaa; } 35 .pink { background: #ffaaff; } 36 .yellow { background: #ffffaa; } 37 </style> 38 39 <p>Test passes if each pair of blue / orange boxes are identical (except for the color of their border). 40 41 42 <!-- not coloring the space between ا and ب in this particular case, 43 because per UAX9 L1 and css-text-3 4.1.2 point 4 bullet 2: 44 this space MUST be at the end of the line and hang, 45 but also the UA MAY collapse it's advance width. 46 Not giving it a color lets the test pass either way. 47 --> 48 49 <div class="w6"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span> </span>ب<span class=yellow> </span></div> 50 <div class="w6 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<br>ب<span class=yellow> </span></div> 51 52 <hr> 53 54 <div class="w7"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div> 55 <div class="w7 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span><br>ب<span class=yellow> </span></div> 56 57 <hr> 58 59 <!-- not coloring the last space in this particular case, 60 because per 4.1.2 point 4 bullet 2: 61 this space MUST hang, 62 but also the UA MAY collapse it's advance width. 63 So we know for sure it won't cause a line break, 64 but it may or may not be visible at the end of the line. 65 Not giving it a color lets the test pass either way. 66 --> 67 68 <div class="w8"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span> </span></div> 69 <div class="w8 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب</div> 70 71 <hr> 72 73 <div class="w9"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div> 74 <div class="w9 ref"><span class=pink> </span>A<span class=blue> </span>B<span class=red> </span>ا<span class=green> </span>ب<span class=yellow> </span></div>