mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:22:43 +00:00 
			
		
		
		
	 9121cc7cae
			
		
	
	
		9121cc7cae
		
	
	
	
	
		
			
			This requires an implementation of the "text preparation algorithm" as specified here: html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm However, we're missing a lot of things such as the CanvasTextDrawingStyles interface, so most of the algorithm was not implemented. Additionally, we also are not able to use a LineBox like the algorithm suggests, because our layouting infra is not up to the task yet. The prepare_text function does nothing other than figuring out the width of the given text and return glyphs with offsets at the moment.
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			248 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			248 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "TextMetrics.h"
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| RefPtr<TextMetrics> TextMetrics::create()
 | |
| {
 | |
|     return adopt_ref(*new TextMetrics());
 | |
| }
 | |
| 
 | |
| }
 |