-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSError when opening a font file whose name is not in English #3480
Comments
I get something different (Pillow 5.3.0, macOS High Sierra) for both Chinese and English characters:
Instead, use >>> ImageFont.truetype("arial.ttf", 15)
<PIL.ImageFont.FreeTypeFont object at 0x1096e5f60>
>>> ImageFont.truetype("方正黄草简体.ttf", 15)
<PIL.ImageFont.FreeTypeFont object at 0x1096ea080>
>>>
>>> font = ImageFont.truetype("方正黄草简体.ttf", 15)
>>>
>>> from PIL import Image, ImageDraw
>>> im = Image.new("RGB", (200, 100), "white")
>>> draw = ImageDraw.Draw(im)
>>> draw.text((10, 10), "abc", font=font, fill="black")
>>> im.show() Produces: See https://pillow.readthedocs.io/en/5.3.x/reference/ImageFont.html Do you get the same OSError with |
@hugovk , sorry, I have pasted the wrong code. The code to produce has been corrected. I am getting this error using |
This looks like a duplicate of #3145 |
Issue description
When I tried to open a font using
ImageFont.truetype()
method (the font file name is in Chinese):I encountered an error:
When I change the font name to English name, for example,
fzhcjt.tff
, I can open the same font file without any error.What are your OS, Python and Pillow versions?
I have also tested on my CentOS machine and this issue does not exist.
The text was updated successfully, but these errors were encountered: