@@ -21,9 +21,8 @@ use bevy_window::{PrimaryWindow, Window, WindowScaleFactorChanged};
21
21
use derive_more:: derive:: { Display , Error , From } ;
22
22
use ui_surface:: UiSurface ;
23
23
24
- #[ cfg( feature = "bevy_text" ) ]
25
24
use bevy_text:: ComputedTextBlock ;
26
- # [ cfg ( feature = "bevy_text" ) ]
25
+
27
26
use bevy_text:: CosmicFontSystem ;
28
27
29
28
mod convert;
@@ -135,8 +134,8 @@ pub fn ui_layout_system(
135
134
Option < & Outline > ,
136
135
Option < & ScrollPosition > ,
137
136
) > ,
138
- # [ cfg ( feature = "bevy_text" ) ] mut buffer_query : Query < & mut ComputedTextBlock > ,
139
- # [ cfg ( feature = "bevy_text" ) ] mut font_system : ResMut < CosmicFontSystem > ,
137
+ mut buffer_query : Query < & mut ComputedTextBlock > ,
138
+ mut font_system : ResMut < CosmicFontSystem > ,
140
139
) {
141
140
let UiLayoutSystemBuffers {
142
141
interned_root_nodes,
@@ -277,7 +276,6 @@ with UI components as a child of an entity without UI components, your UI layout
277
276
}
278
277
} ) ;
279
278
280
- #[ cfg( feature = "bevy_text" ) ]
281
279
let text_buffers = & mut buffer_query;
282
280
// clean up removed nodes after syncing children to avoid potential panic (invalid SlotMap key used)
283
281
ui_surface. remove_entities ( removed_components. removed_nodes . read ( ) ) ;
@@ -292,14 +290,7 @@ with UI components as a child of an entity without UI components, your UI layout
292
290
for ( camera_id, mut camera) in camera_layout_info. drain ( ) {
293
291
let inverse_target_scale_factor = camera. scale_factor . recip ( ) ;
294
292
295
- ui_surface. compute_camera_layout (
296
- camera_id,
297
- camera. size ,
298
- #[ cfg( feature = "bevy_text" ) ]
299
- text_buffers,
300
- #[ cfg( feature = "bevy_text" ) ]
301
- & mut font_system. 0 ,
302
- ) ;
293
+ ui_surface. compute_camera_layout ( camera_id, camera. size , text_buffers, & mut font_system. 0 ) ;
303
294
304
295
for root in & camera. root_nodes {
305
296
update_uinode_geometry_recursive (
@@ -549,11 +540,11 @@ mod tests {
549
540
world. init_resource :: < Events < AssetEvent < Image > > > ( ) ;
550
541
world. init_resource :: < Assets < Image > > ( ) ;
551
542
world. init_resource :: < ManualTextureViews > ( ) ;
552
- # [ cfg ( feature = "bevy_text" ) ]
543
+
553
544
world. init_resource :: < bevy_text:: TextPipeline > ( ) ;
554
- # [ cfg ( feature = "bevy_text" ) ]
545
+
555
546
world. init_resource :: < bevy_text:: CosmicFontSystem > ( ) ;
556
- # [ cfg ( feature = "bevy_text" ) ]
547
+
557
548
world. init_resource :: < bevy_text:: SwashCache > ( ) ;
558
549
559
550
// spawn a dummy primary window and camera
@@ -1190,11 +1181,11 @@ mod tests {
1190
1181
world. init_resource :: < Events < AssetEvent < Image > > > ( ) ;
1191
1182
world. init_resource :: < Assets < Image > > ( ) ;
1192
1183
world. init_resource :: < ManualTextureViews > ( ) ;
1193
- # [ cfg ( feature = "bevy_text" ) ]
1184
+
1194
1185
world. init_resource :: < bevy_text:: TextPipeline > ( ) ;
1195
- # [ cfg ( feature = "bevy_text" ) ]
1186
+
1196
1187
world. init_resource :: < bevy_text:: CosmicFontSystem > ( ) ;
1197
- # [ cfg ( feature = "bevy_text" ) ]
1188
+
1198
1189
world. init_resource :: < bevy_text:: SwashCache > ( ) ;
1199
1190
1200
1191
// spawn a dummy primary window and camera
@@ -1262,10 +1253,8 @@ mod tests {
1262
1253
fn test_system (
1263
1254
params : In < TestSystemParam > ,
1264
1255
mut ui_surface : ResMut < UiSurface > ,
1265
- #[ cfg( feature = "bevy_text" ) ] mut computed_text_block_query : Query <
1266
- & mut bevy_text:: ComputedTextBlock ,
1267
- > ,
1268
- #[ cfg( feature = "bevy_text" ) ] mut font_system : ResMut < bevy_text:: CosmicFontSystem > ,
1256
+ mut computed_text_block_query : Query < & mut bevy_text:: ComputedTextBlock > ,
1257
+ mut font_system : ResMut < bevy_text:: CosmicFontSystem > ,
1269
1258
) {
1270
1259
ui_surface. upsert_node (
1271
1260
& LayoutContext :: TEST_CONTEXT ,
@@ -1277,9 +1266,7 @@ mod tests {
1277
1266
ui_surface. compute_camera_layout (
1278
1267
params. camera_entity ,
1279
1268
UVec2 :: new ( 800 , 600 ) ,
1280
- #[ cfg( feature = "bevy_text" ) ]
1281
1269
& mut computed_text_block_query,
1282
- #[ cfg( feature = "bevy_text" ) ]
1283
1270
& mut font_system. 0 ,
1284
1271
) ;
1285
1272
}
0 commit comments