Graphics drawing = Graphics.FromImage(img) first, create a dummy bitmap just to get a graphics object Var font= new Font(modernFont.Families, 12) //The second argument is the font size ModernFont.AddFontFile("NafeesNaskh.ttf") //Load font from the font file
![urdu fonts graphics urdu fonts graphics](https://dwnloadev380.weebly.com/uploads/1/2/4/8/124803594/780959380.png)
Var modernFont = new PrivateFontCollection()
![urdu fonts graphics urdu fonts graphics](https://fiverr-res.cloudinary.com/images/q_auto,f_auto/gigs/133390947/original/137e7be7238eaac386aec187820892c8247ad13d/do-calligraphy-and-font-development-english-urdu-arabic.png)
For someone who might face similar problem may use following to generate Urdu text images (all of the fonts supported): //Create the font using your font file However, I was able to find a work around for this using the good old. On further R&D found out that this is still an issue specifically for Urdu and no solution has been worked out for it yet: Text_string = get_display(reshape(text_string)) Text_string = u'نیدرلینڈز کی ملکہ پاکستان آ رہی ہیں'įont = uetype('./UrduFontsDirectory' + data.iloc, 25)ĭraw.text((25,40), text_string, fill='white', font=font)Īlso I tried using Arabic Reshaper which resolved the alignment on rendering issue but yet some characters never get rendered: from PIL import Image, ImageFont, ImageDraw
URDU FONTS GRAPHICS CODE
Text_string = u'Hello how are you doing?'ĭraw.text((25,40), text_string, fill='white')įollowing is the code and result when done with Urdu: from PIL import Image, ImageFont, ImageDraw Using the same code to generate normal English works like a charm but when I do the same with Urdu text things just does not go as smooth.įollowing is the code and result when done with English: from PIL import Image, ImageFont, ImageDraw
![urdu fonts graphics urdu fonts graphics](https://1.bp.blogspot.com/-Crx73ZZMMJA/Xd-9jIYRIGI/AAAAAAAAALE/Im_taUIrdwYSvfM23dsSI3vng_ABdh8lwCEwYBhgL/s1600/Best-Free-Download-Urdu-Fonts-Collection.jpg)
I am trying to generate image for some Urdu text using Pillow.