How to draw bold/italic text with PIL? ImageFont.truetype(file, size) has an option to specify font size only.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Many fonts use different TTF files for their bold/italic versions, so I'd imagine if you just specify that file it would work.
A rather hacky solution to make a font bold if (for whatever reason) you don't have a separate bold version of the font is to print the same text several times with a slight offset.
Well, this is my first comment. Here we go.
I'll try to clarify the procedure. At first What I did was use the "name" of the font like this
but only got some errors like this:
Then I remembered that sometimes fonts has other "names" or "filenames", so, what I did was going to fonts folder, then opened the Arial Font wich displayed all the styles like negrita (bold], cursiva(italic), etc.
Did a right click on the "negrita" style, selected "properties" and then there was the "real name" of the font.
In my case, the name was "ariblk"
Then, finally, just used the name like this.
I know this post is old, but today helped me to get to the solution. So I hope to help anybody.
=)
Use the bold/italic version of the font