简体   繁体   中英

Using fonts in PIL without freetype

Hy, i'm using PIL (Python Image Library) without the lib-freetype.

Is there a possibility to use fonts (i just have to resize a text, not more!) without installing the freetype?

Or is there a possibility to set the size of a font, without setting the truetype of the font, so using the default truetype?

It's for a project on a server, where i can just install pure PIL, without any extensions for supporting truetypes!

If you read the manual for the ImageFont module you'll see that the Python Imaging Library supports the PILFont format for bitmap fonts.

So on your own computer, render your TrueType font, at the size you want, save the bitmap in the PILFont format, and then use the PILFont on the server. You can do this using otf2bdf to convert the TrueType font to BDF ( Bitmap Distribution Format ), and then PIL's pilfont utility to convert BDF to PILFont. See this question and its answers .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM