mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:52:44 +00:00 
			
		
		
		
	 e1eb882b1c
			
		
	
	
		e1eb882b1c
		
	
	
	
	
		
			
			In the common case of text rendering rather than getting the emoji bitmap for a fixed number of code points, we don't know how many code points make one emoji. As far as I can tell, the longest ones are up to ten code points, so we try to consume all of them and do a lookup during each iteration, and return the emoji for the longest chain of code points. Quite basic and definitely room for improvement, but it works!
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			522 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			522 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
 | |
|  * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Forward.h>
 | |
| #include <AK/Types.h>
 | |
| 
 | |
| namespace Gfx {
 | |
| 
 | |
| class Bitmap;
 | |
| 
 | |
| class Emoji {
 | |
| public:
 | |
|     static Gfx::Bitmap const* emoji_for_code_point(u32 code_point);
 | |
|     static Gfx::Bitmap const* emoji_for_code_points(Span<u32> const&);
 | |
|     static Gfx::Bitmap const* emoji_for_code_point_iterator(Utf8CodePointIterator&);
 | |
| };
 | |
| 
 | |
| }
 |