| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/AKString.h>
 | 
					
						
							|  |  |  | #include <AK/Function.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  | #include <AK/HashMap.h>
 | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Font; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-25 16:43:15 -07:00
										 |  |  | struct Metadata { | 
					
						
							|  |  |  |     String path; | 
					
						
							|  |  |  |     bool is_fixed_width; | 
					
						
							|  |  |  |     int glyph_height; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | class GFontDatabase { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     static GFontDatabase& the(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     RetainPtr<Font> get_by_name(const String&); | 
					
						
							|  |  |  |     void for_each_font(Function<void(const String&)>); | 
					
						
							| 
									
										
										
										
											2019-03-06 14:06:40 +01:00
										 |  |  |     void for_each_fixed_width_font(Function<void(const String&)>); | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |     Metadata get_metadata_by_name(const String& name) const | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-05-25 16:43:15 -07:00
										 |  |  |         return m_name_to_metadata.get(name); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-04-05 05:10:18 +02:00
										 |  |  |     GFontDatabase(); | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  |     ~GFontDatabase(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-06 14:06:40 +01:00
										 |  |  |     HashMap<String, Metadata> m_name_to_metadata; | 
					
						
							| 
									
										
										
										
											2019-02-12 14:35:33 +01:00
										 |  |  | }; |