【发布时间】:2021-07-25 10:53:44
【问题描述】:
我正在尝试在搅拌机中正确渲染孟加拉语字体,但渲染不正确。我在尝试使用 python 在图像上绘制孟加拉语文本时遇到了同样的问题。我发现枕头可以做到这一点,但它不像英文文本那样简单。我能够通过下面的这两个链接使其工作,
How do I install 'libraqm' library in Google Colab?
How to install pre-built Pillow wheel with libraqm DLLs on Windows?
这些是 without 和 with libraqm 的结果,
不正确
正确
这是基本代码,
from PIL import ImageFont, ImageDraw, Image
import numpy as np
import matplotlib.pyplot as plt
image = np.zeros((200, 600, 3), np.uint8)
image = Image.fromarray(np.uint8(image * 255))
draw = ImageDraw.Draw(image)
# use a truetype font
font = ImageFont.truetype("/content/BalooDa2-Medium.ttf", 24)
draw.text((20, 25), "আমাদের দেশের ক্রিকেটাররা এখন টেস্ট খেলায় জিততে জানে", font=font)
draw.text((20, 50), "গরমে সুস্থ থাকুন", font=font)
plt.figure(figsize = (20,20))
plt.imshow(image)
在搅拌机中使用自定义孟加拉语字体会产生这样的错误结果
我想知道如何在带有文本的搅拌机中实现与 libraqm 相同的功能。有什么方法可以安装带有枕头的 libraqm 以在搅拌机或任何其他方式中正确渲染字体?
【问题讨论】:
标签: python graphics python-imaging-library rendering blender