@@ -47,11 +47,7 @@ fn test_fixed_page_text_box_uses_padding_and_center_vertical_align() {
4747 . source
4848 . contains( "inset: (top: 3.6pt, right: 7.2pt, bottom: 3.6pt, left: 7.2pt)" )
4949 ) ;
50- assert ! (
51- output
52- . source
53- . contains( "width: 285.6pt" )
54- ) ;
50+ assert ! ( output. source. contains( "width: 285.6pt" ) ) ;
5551 assert ! ( output. source. contains(
5652 "#context {\n let text_box_slack_0 = calc.max(42.8pt - measure(text_box_content_0).height, 0pt)"
5753 ) ) ;
@@ -337,7 +333,9 @@ fn test_fixed_page_text_box_compact_list_preserves_hanging_indent() {
337333 let output = generate_typst ( & doc) . unwrap ( ) ;
338334
339335 assert ! (
340- output. source. contains( "#grid(columns: (36pt, 1fr), gutter: 0pt," ) ,
336+ output
337+ . source
338+ . contains( "#grid(columns: (36pt, 1fr), gutter: 0pt," ) ,
341339 "Expected ordered hanging-indent list to use a marker/body grid, got:\n {}" ,
342340 output. source,
343341 ) ;
@@ -410,7 +408,11 @@ fn test_fixed_page_text_box_compact_list_preserves_marker_origin_offset() {
410408 . source
411409 . contains( "inset: (top: 0pt, right: 0pt, bottom: 0pt, left: 18pt)" )
412410 ) ;
413- assert ! ( output. source. contains( "#grid(columns: (36pt, 1fr), gutter: 0pt," ) ) ;
411+ assert ! (
412+ output
413+ . source
414+ . contains( "#grid(columns: (36pt, 1fr), gutter: 0pt," )
415+ ) ;
414416}
415417
416418#[ test]
@@ -987,6 +989,56 @@ fn test_fixed_page_text_box_no_wrap_inserts_word_joiners_for_cjk_titles() {
987989 ) ;
988990}
989991
992+ #[ test]
993+ fn test_fixed_page_text_box_no_wrap_keeps_latin_text_extractable ( ) {
994+ let doc = make_doc ( vec ! [ make_fixed_page(
995+ 960.0 ,
996+ 540.0 ,
997+ vec![ FixedElement {
998+ x: 100.0 ,
999+ y: 120.0 ,
1000+ width: 180.0 ,
1001+ height: 40.0 ,
1002+ kind: FixedElementKind :: TextBox ( crate :: ir:: TextBoxData {
1003+ content: vec![ Block :: Paragraph ( Paragraph {
1004+ style: ParagraphStyle {
1005+ alignment: Some ( Alignment :: Center ) ,
1006+ ..ParagraphStyle :: default ( )
1007+ } ,
1008+ runs: vec![ Run {
1009+ text: "Test text" . to_string( ) ,
1010+ style: TextStyle {
1011+ font_size: Some ( 28.0 ) ,
1012+ ..TextStyle :: default ( )
1013+ } ,
1014+ href: None ,
1015+ footnote: None ,
1016+ } ] ,
1017+ } ) ] ,
1018+ padding: Insets :: default ( ) ,
1019+ vertical_align: crate :: ir:: TextBoxVerticalAlign :: Top ,
1020+ fill: None ,
1021+ opacity: None ,
1022+ stroke: None ,
1023+ shape_kind: None ,
1024+ no_wrap: true ,
1025+ auto_fit: false ,
1026+ } ) ,
1027+ } ] ,
1028+ ) ] ) ;
1029+ let output = generate_typst ( & doc) . unwrap ( ) ;
1030+ assert ! (
1031+ output. source. contains( "Test text" ) ,
1032+ "Expected plain Latin no-wrap text to remain extractable, got:\n {}" ,
1033+ output. source,
1034+ ) ;
1035+ assert ! (
1036+ !output. source. contains( '\u{2060}' ) && !output. source. contains( '\u{00A0}' ) ,
1037+ "Expected no invisible joiners or non-breaking spaces for Latin no-wrap text, got:\n {}" ,
1038+ output. source,
1039+ ) ;
1040+ }
1041+
9901042#[ test]
9911043fn test_fixed_page_text_box_auto_fit_short_text_uses_scale_to_fit ( ) {
9921044 let doc = make_doc ( vec ! [ make_fixed_page(
@@ -1031,7 +1083,9 @@ fn test_fixed_page_text_box_auto_fit_short_text_uses_scale_to_fit() {
10311083 output. source,
10321084 ) ;
10331085 assert ! (
1034- output. source. contains( "let text_box_scale_height_0 = (12pt / 21.599999999999998pt) * 100%" ) ,
1086+ output
1087+ . source
1088+ . contains( "let text_box_scale_height_0 = (12pt / 21.599999999999998pt) * 100%" ) ,
10351089 "Expected estimated line-height scale calculation, got:\n {}" ,
10361090 output. source,
10371091 ) ;
@@ -1041,9 +1095,9 @@ fn test_fixed_page_text_box_auto_fit_short_text_uses_scale_to_fit() {
10411095 output. source,
10421096 ) ;
10431097 assert ! (
1044- output
1045- . source
1046- . contains ( "#scale(x: text_box_scale_0, y: text_box_scale_0, origin: top + left, reflow: true)[" ) ,
1098+ output. source . contains (
1099+ "#scale(x: text_box_scale_0, y: text_box_scale_0, origin: top + left, reflow: true)["
1100+ ) ,
10471101 "Expected scale-to-fit wrapper, got:\n {}" ,
10481102 output. source,
10491103 ) ;
@@ -1106,9 +1160,9 @@ fn test_fixed_page_text_box_mixed_font_header_uses_scale_to_fit() {
11061160 output. source,
11071161 ) ;
11081162 assert ! (
1109- output
1110- . source
1111- . contains ( "#scale(x: text_box_scale_0, y: text_box_scale_0, origin: top + left, reflow: true)[" ) ,
1163+ output. source . contains (
1164+ "#scale(x: text_box_scale_0, y: text_box_scale_0, origin: top + left, reflow: true)["
1165+ ) ,
11121166 "Expected mixed-font header to use scale-to-fit, got:\n {}" ,
11131167 output. source,
11141168 ) ;
0 commit comments