You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to create a piece of text with a stroke fill the tittles on i and j do not look correct.
What did you expect to happen?
I would expect that the stroke would fill all the way to the edge of the inner fill for the tittles.
What actually happened?
The tittles on the i and j look like they have a thin outline around them rather than filling to the tittle.
What are your OS, Python and Pillow versions?
OS: Windows
Python 3.11:
Pillow: 10.3.0
Pillow 10.3.0
Python 3.11.5 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:26:23) [MSC v.1916 64 bit (AMD64)]
Python executable is C:\Users\bradl\anaconda3\python.exe
System Python files loaded from C:\Users\bradl\anaconda3
--------------------------------------------------------------------
Python Pillow modules loaded from C:\Users\USER\anaconda3\Lib\site-packages\PIL
Binary Pillow modules loaded from C:\Users\USER\anaconda3\Lib\site-packages\PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.3.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
fromPILimportImage, ImageDraw, ImageFont# Create an image with a white backgroundwidth, height=2000, 400image=Image.new("RGB", (width, height), "white")
# Load a fontfont_size=100font=ImageFont.load_default(font_size)
# Create a drawing contextdraw=ImageDraw.Draw(image)
# Define text and positionstext='i j h o w'text_position= (100, 100) # Position of the textstroke_width=14# Width of the strokestroke_fill="black"# Color of the stroketext_fill="blue"# Color of the text# Draw text with strokedraw.text(
text_position,
text,
font=font,
fill=text_fill,
stroke_width=stroke_width,
stroke_fill=stroke_fill,
)
image.save("testing.png", dpi=(300, 300))
The text was updated successfully, but these errors were encountered:
Taking a look, the gap between the regular text and the stroked text is generated by FreeType. It's not unique to our default font - the same issue occurs with Times New Roman.ttf on my macOS machine.
I've contacted FreeType support to see if this is considered a bug.
We've received a response about how FreeType handles this - #8701 (comment)
The algorithms are rather complicated. I suspect the problem with the inside border arises when the stroker radius exceeds the stem width or the dot radius. The inside border is ill-defined in this case. I doubt this can be fixed. This could happen to the outside border too but much less frequently.
I've created #8701 to adjust Pillow to fix the result.
What did you do?
When trying to create a piece of text with a stroke fill the tittles on
i
andj
do not look correct.What did you expect to happen?
I would expect that the stroke would fill all the way to the edge of the inner fill for the tittles.
What actually happened?
The tittles on the
i
andj
look like they have a thin outline around them rather than filling to the tittle.What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: