---- On Thu, 30 Sep 2021 12:07:23 +0530 Abirami Moorthy
<mailto:mabirami8...@gmail.com> wrote ----
I have a sample certificate. I would like to write names in tamil on
certificate using python-pillow
here the program link
https://github.com/Abirami8799/python-project/blob/master/certificate.py
output showing like this
https://pasteboard.co/YDSNp6tADZIt.png
I used some fonts like Noto Sans Tamil Regular,
Sundaram-3811,TSCu_Paranar,TSCu_saiIndira,Latha, Nirmala- but could not get the
correct output.
Hi Abirami,
You need to use a text layout engine like Pango, for rendering the text
correctly. See https://pangocairocffi.readthedocs.io/en/latest/index.html
The example adapted from the pangocairocffi tutorial is provided below.
import cairocffi
import pangocffi
import pangocairocffi
# Create the surface and get the context
filename = 'test.png'
surface = cairocffi.ImageSurface.create_from_png(filename)
context = cairocffi.Context(surface)
context.translate(20, 20)
# Build the layout
layout = pangocairocffi.create_layout(context)
layout.set_markup('<span font="30">தேன்மொழி</span>')
# Render the layout
pangocairocffi.show_layout(context, layout)
# Output the surface
surface.write_to_png(filename)
surface.finish()
Regards,
Vijay
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy