mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	LibWeb: Allow font-size as an SVG attribute and handle font scaling
This commit is contained in:
		
							parent
							
								
									21ace4f90b
								
							
						
					
					
						commit
						48d03a68e9
					
				
					 2 changed files with 15 additions and 2 deletions
				
			
		|  | @ -59,9 +59,16 @@ void SVGTextPaintable::paint(PaintContext& context, PaintPhase phase) const | |||
|     auto child_text_content = dom_node.child_text_content(); | ||||
| 
 | ||||
|     auto transform = layout_box().layout_transform(); | ||||
|     auto& scaled_font = layout_node().scaled_font(context); | ||||
|     if (!transform.has_value()) | ||||
|         return; | ||||
| 
 | ||||
|     // FIXME: Support arbitrary path transforms for fonts.
 | ||||
|     // FIMXE: This assumes transform->x_scale() == transform->y_scale().
 | ||||
|     auto& scaled_font = layout_node().scaled_font(static_cast<float>(context.device_pixels_per_css_pixel()) * transform->x_scale()); | ||||
| 
 | ||||
|     Utf8View text_content { child_text_content }; | ||||
|     auto text_offset = context.floored_device_point(dom_node.get_offset().transformed(*transform).to_type<CSSPixels>()); | ||||
|     painter.draw_text_run(text_offset.to_type<int>(), Utf8View { child_text_content }, scaled_font, layout_node().computed_values().fill()->as_color()); | ||||
|     painter.draw_text_run(text_offset.to_type<int>(), text_content, scaled_font, layout_node().computed_values().fill()->as_color()); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 MacDue
						MacDue