mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[font] Add support for "glyphsets" (#7429)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										2
									
								
								tests/components/font/.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								tests/components/font/.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| *.pcf        -text | ||||
|  | ||||
							
								
								
									
										7461
									
								
								tests/components/font/MatrixChunky8X.bdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7461
									
								
								tests/components/font/MatrixChunky8X.bdf
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,4 +1,12 @@ | ||||
| font: | ||||
|   - file: | ||||
|       type: gfonts | ||||
|       family: "Roboto" | ||||
|       weight: bold | ||||
|       italic: true | ||||
|     size: 32 | ||||
|     id: roboto32 | ||||
|  | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto | ||||
|     size: 20 | ||||
| @@ -9,6 +17,10 @@ font: | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto_web | ||||
|     size: 20 | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto_greek | ||||
|     size: 20 | ||||
|     glyphs: ["\u0300", "\u00C5", "\U000000C7"] | ||||
|   - file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf" | ||||
|     id: monocraft | ||||
|     size: 20 | ||||
| @@ -20,6 +32,17 @@ font: | ||||
|   - file: $component_dir/Monocraft.ttf | ||||
|     id: monocraft3 | ||||
|     size: 28 | ||||
|   - file: $component_dir/MatrixChunky8X.bdf | ||||
|     id: special_font | ||||
|     glyphs: | ||||
|       - '"' | ||||
|       - "'" | ||||
|       - '#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°' | ||||
|  | ||||
|   - file: $component_dir/MatrixChunky8X.bdf | ||||
|     id: default_font | ||||
|   - file: $component_dir/x11.pcf | ||||
|     id: pcf_font | ||||
|  | ||||
| i2c: | ||||
|   scl: ${i2c_scl} | ||||
| @@ -36,3 +59,4 @@ display: | ||||
|       it.print(0, 40, id(monocraft), "Hello, World!"); | ||||
|       it.print(0, 60, id(monocraft2), "Hello, World!"); | ||||
|       it.print(0, 80, id(monocraft3), "Hello, World!"); | ||||
|       it.print(0, 100, id(roboto_greek), "Hello κόσμε!"); | ||||
|   | ||||
| @@ -1,4 +1,12 @@ | ||||
| font: | ||||
|   - file: | ||||
|       type: gfonts | ||||
|       family: "Roboto" | ||||
|       weight: bold | ||||
|       italic: true | ||||
|     size: 32 | ||||
|     id: roboto32 | ||||
|  | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto | ||||
|     size: 20 | ||||
| @@ -9,6 +17,10 @@ font: | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto_web | ||||
|     size: 20 | ||||
|   - file: "gfonts://Roboto" | ||||
|     id: roboto_greek | ||||
|     size: 20 | ||||
|     glyphs: ["\u0300", "\u00C5", "\U000000C7"] | ||||
|   - file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf" | ||||
|     id: monocraft | ||||
|     size: 20 | ||||
| @@ -20,4 +32,26 @@ font: | ||||
|   - file: $component_dir/Monocraft.ttf | ||||
|     id: monocraft3 | ||||
|     size: 28 | ||||
|   - file: $component_dir/MatrixChunky8X.bdf | ||||
|     id: special_font | ||||
|     glyphs: | ||||
|       - '"' | ||||
|       - "'" | ||||
|       - '#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°' | ||||
|  | ||||
|   - file: $component_dir/MatrixChunky8X.bdf | ||||
|     id: default_font | ||||
|  | ||||
| display: | ||||
|   - platform: sdl | ||||
|     id: sdl_display | ||||
|     dimensions: | ||||
|       width: 800 | ||||
|       height: 600 | ||||
|     lambda: |- | ||||
|       it.print(0, 0, id(roboto), "Hello, World!"); | ||||
|       it.print(0, 20, id(roboto_web), "Hello, World!"); | ||||
|       it.print(0, 40, id(roboto_greek), "Hello κόσμε!"); | ||||
|       it.print(0, 60, id(monocraft), "Hello, World!"); | ||||
|       it.print(0, 80, id(monocraft2), "Hello, World!"); | ||||
|       it.print(0, 100, id(monocraft3), "Hello, World!"); | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								tests/components/font/x11.pcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/components/font/x11.pcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user