Problem with Malayalam Font Glyphs

462 views
Skip to first unread message

RajKumar N R

unread,
Jan 24, 2021, 9:23:57 AM1/24/21
to reportlab-users
Hi,
I am trying to generate a PDF that contains text in Malayalam font. Everything is working fine but the text is not displaying correctly.
The font named Noto Sans Malayalam is used.
The input text is കോട്ടയം.
The following image shows the output from Reportlab.
unnamed.png
Using Google Docs, I have exported a PDF with the same content and it is displaying correctly.
The following image shows the output from Google Docs:
unnamed (1).png
While checking the fonts embedded in the PDF, both reportlab and Google embedded the fonts in different ways.
In reportlab, the font is embedded as WinAnsi format.
 unnamed (2).png
But in Google Docs, it is embedded as Identity-H
unnamed (3).png

How to make this work correctly using reportlab?
Here is the source code:-
# -*- coding: utf-8 -*- 
 from reportlab.pdfgen import canvas 
 from reportlab.pdfbase import pdfmetrics
 from reportlab.pdfbase.ttfonts import TTFont  
import reportlab.rl_config 
reportlab.rl_config.warnOnMissingFontGlyphs = 1 pdfmetrics.registerFont(TTFont('Malayalam', '/home/impressads/projects/reportlabtest/NotoSansMalayalam-Regular.ttf')) 
 c = canvas.Canvas("reportlab-malayalam.pdf") c.setFont("Malayalam", 14) c.setAuthor("raj")
c.setTitle("Reportlab Malayalam") 
c.drawString(10,800, u"കോട്ടയം".encode('utf-8')) 
 c.save()

Sreejith Das

unread,
Jul 25, 2023, 8:34:40 AM7/25/23
to reportlab-users
Hi,

I am facing the same problem. Is there a solution available as on date?

Sreejith P Das

Neelesh Nikam

unread,
Jul 29, 2023, 10:18:08 AM7/29/23
to reportlab-users
I am facing same font issue for Marathi language. Plz help

Sreejith Das

unread,
Aug 3, 2023, 3:15:54 AM8/3/23
to reportlab-users
No solution known to me as of now. I have posted in stack overflow: https://stackoverflow.com/questions/76788180/reportlab-is-not-properly-rendering-indian-text-malayalam

You may keep monitoring.
Reply all
Reply to author
Forward
0 new messages