@@ -739,9 +739,6 @@ pub fn extract_text_sections(
739739 let transform = global_transform. affine ( )
740740 * bevy_math:: Affine3A :: from_translation ( ( -0.5 * uinode. size ( ) ) . extend ( 0. ) ) ;
741741
742- let mut color = LinearRgba :: WHITE ;
743- let mut current_span = usize:: MAX ;
744-
745742 for (
746743 i,
747744 PositionedGlyph {
@@ -752,20 +749,6 @@ pub fn extract_text_sections(
752749 } ,
753750 ) in text_layout_info. glyphs . iter ( ) . enumerate ( )
754751 {
755- if * span_index != current_span {
756- color = text_styles
757- . get (
758- computed_block
759- . entities ( )
760- . get ( * span_index)
761- . map ( |t| t. entity )
762- . unwrap_or ( Entity :: PLACEHOLDER ) ,
763- )
764- . map ( |text_color| LinearRgba :: from ( text_color. 0 ) )
765- . unwrap_or_default ( ) ;
766- current_span = * span_index;
767- }
768-
769752 let rect = texture_atlases
770753 . get ( & atlas_info. texture_atlas )
771754 . unwrap ( )
@@ -777,8 +760,18 @@ pub fn extract_text_sections(
777760 } ) ;
778761
779762 if text_layout_info. glyphs . get ( i + 1 ) . is_none_or ( |info| {
780- info. span_index != current_span || info. atlas_info . texture != atlas_info. texture
763+ info. span_index != * span_index || info. atlas_info . texture != atlas_info. texture
781764 } ) {
765+ let color = text_styles
766+ . get (
767+ computed_block
768+ . entities ( )
769+ . get ( * span_index)
770+ . map ( |t| t. entity )
771+ . unwrap_or ( Entity :: PLACEHOLDER ) ,
772+ )
773+ . map ( |text_color| LinearRgba :: from ( text_color. 0 ) )
774+ . unwrap_or_default ( ) ;
782775 extracted_uinodes. uinodes . push ( ExtractedUiNode {
783776 render_entity : commands. spawn ( TemporaryRenderEntity ) . id ( ) ,
784777 stack_index : uinode. stack_index ,
@@ -850,7 +843,6 @@ pub fn extract_text_shadows(
850843 ( -0.5 * uinode. size ( ) + shadow. offset / uinode. inverse_scale_factor ( ) ) . extend ( 0. ) ,
851844 ) ;
852845
853- let mut current_span = usize:: MAX ;
854846 for (
855847 i,
856848 PositionedGlyph {
@@ -861,10 +853,6 @@ pub fn extract_text_shadows(
861853 } ,
862854 ) in text_layout_info. glyphs . iter ( ) . enumerate ( )
863855 {
864- if * span_index != current_span {
865- current_span = * span_index;
866- }
867-
868856 let rect = texture_atlases
869857 . get ( & atlas_info. texture_atlas )
870858 . unwrap ( )
@@ -876,7 +864,7 @@ pub fn extract_text_shadows(
876864 } ) ;
877865
878866 if text_layout_info. glyphs . get ( i + 1 ) . is_none_or ( |info| {
879- info. span_index != current_span || info. atlas_info . texture != atlas_info. texture
867+ info. span_index != * span_index || info. atlas_info . texture != atlas_info. texture
880868 } ) {
881869 extracted_uinodes. uinodes . push ( ExtractedUiNode {
882870 render_entity : commands. spawn ( TemporaryRenderEntity ) . id ( ) ,
0 commit comments