mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +03:00 
			
		
		
		
	don't use bitmap glyphs when drawing text with stroker
This commit is contained in:
		
							parent
							
								
									b34430b402
								
							
						
					
					
						commit
						19f4c6fd23
					
				
							
								
								
									
										
											BIN
										
									
								
								Tests/images/bitmap_font_stroke_basic.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/bitmap_font_stroke_basic.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.6 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Tests/images/bitmap_font_stroke_raqm.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Tests/images/bitmap_font_stroke_raqm.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.6 KiB | 
|  | @ -867,6 +867,22 @@ class TestImageFont: | |||
| 
 | ||||
|         assert_image_equal_tofile(im, target) | ||||
| 
 | ||||
|     def test_bitmap_font_stroke(self): | ||||
|         text = "Bitmap Font" | ||||
|         layout_name = ["basic", "raqm"][self.LAYOUT_ENGINE] | ||||
|         target = f"Tests/images/bitmap_font_stroke_{layout_name}.png" | ||||
|         font = ImageFont.truetype( | ||||
|             "Tests/fonts/DejaVuSans/DejaVuSans-24-8-stripped.ttf", | ||||
|             24, | ||||
|             layout_engine=self.LAYOUT_ENGINE, | ||||
|         ) | ||||
| 
 | ||||
|         im = Image.new("RGB", (160, 35), "white") | ||||
|         draw = ImageDraw.Draw(im) | ||||
|         draw.text((2, 2), text, "black", font, stroke_width=2, stroke_fill="red") | ||||
| 
 | ||||
|         assert_image_similar_tofile(im, target, 0.03) | ||||
| 
 | ||||
|     def test_standard_embedded_color(self): | ||||
|         txt = "Hello World!" | ||||
|         ttf = ImageFont.truetype(FONT_PATH, 40, layout_engine=self.LAYOUT_ENGINE) | ||||
|  |  | |||
|  | @ -833,7 +833,7 @@ font_render(FontObject *self, PyObject *args) { | |||
|     } | ||||
| 
 | ||||
|     im = (Imaging)id; | ||||
|     load_flags = FT_LOAD_DEFAULT; | ||||
|     load_flags = stroke_width ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT; | ||||
|     if (mask) { | ||||
|         load_flags |= FT_LOAD_TARGET_MONO; | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user