如何为heroku和django准备FreeType PIL / Pillow包?

时间:2021-01-20 00:25:06

I know that this question has probably being asked several times, but so far none of the answers was addressing my specific problem.

我知道这个问题可能已被问过几次,但到目前为止,没有一个答案能解决我的具体问题。

I'm going to deploy a django application on Heroku; it needs to draw some text on an image and then display it to the user. The text will be in italian, meaning that unicode support is mandatory.

我将在Heroku上部署一个django应用程序;它需要在图像上绘制一些文本然后将其显示给用户。该文本将是意大利语,意味着unicode支持是强制性的。

I'm encountering several problems:

我遇到了几个问题:

  • To use a ttf font i would need to provide the freetype library before installing PIL/Pillow
  • 要使用ttf字体,我需要在安装PIL / Pillow之前提供freetype库

  • If i use a pil font file (otf -> bdf -> pil), when PIL draws a non-ascii text i get a UnicodeEncodeError
  • 如果我使用pil字体文件(otf - > bdf - > pil),当PIL绘制非ascii文本时,我得到一个UnicodeEncodeError

A solution to one (or both) problem will resolve my issue:

一个(或两个)问题的解决方案将解决我的问题:

  • How to deploy PIL/Pillow on heroku with FreeType support
  • 如何使用FreeType支持在Heroku上部署PIL / Pillow

  • How to draw non-ascii chars using PIL fonts
  • 如何使用PIL字体绘制非ascii字符

Many thanks

1 个解决方案

#1


1  

You can use this PIL fork at your requirements.txt on heroku with FreeType support:

您可以使用FreeType支持在heroku上的requirements.txt中使用此PIL分支:

-e git://github.com/errkk/gitpil.git#egg=PIL
Pillow==1.7.8

#1


1  

You can use this PIL fork at your requirements.txt on heroku with FreeType support:

您可以使用FreeType支持在heroku上的requirements.txt中使用此PIL分支:

-e git://github.com/errkk/gitpil.git#egg=PIL
Pillow==1.7.8