Fix buffer size issue
This commit is contained in:
		
					parent
					
						
							
								a0b301e422
							
						
					
				
			
			
				commit
				
					
						f6c85b5238
					
				
			
		
					 1 changed files with 13 additions and 11 deletions
				
			
		
							
								
								
									
										24
									
								
								src/lib.rs
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/lib.rs
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -359,17 +359,19 @@ pub fn resolve_paragraphs<'a>(
 | 
			
		|||
        size.y += image_size.y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    paragraphs.iter_mut().for_each(|paragraph| {
 | 
			
		||||
        if paragraph.image_urls.is_none() {
 | 
			
		||||
            paragraph
 | 
			
		||||
                .relative_bounds
 | 
			
		||||
                .set_width(size.x - paragraph.indent.indent);
 | 
			
		||||
            paragraph
 | 
			
		||||
                .buffer
 | 
			
		||||
                .set_size(font_system, size.x - paragraph.indent.indent, f32::MAX);
 | 
			
		||||
            paragraph.buffer.shape_until_scroll(font_system, false);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    if align.is_some() {
 | 
			
		||||
        paragraphs.iter_mut().for_each(|paragraph| {
 | 
			
		||||
            if paragraph.image_urls.is_none() {
 | 
			
		||||
                paragraph
 | 
			
		||||
                    .relative_bounds
 | 
			
		||||
                    .set_width(size.x - paragraph.indent.indent);
 | 
			
		||||
                paragraph
 | 
			
		||||
                    .buffer
 | 
			
		||||
                    .set_size(font_system, size.x - paragraph.indent.indent, f32::MAX);
 | 
			
		||||
                paragraph.buffer.shape_until_scroll(font_system, false);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    (size, paragraphs)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue