I have trouble using multilingual text using PIL. Suppose I want to draw text - "a ?? ² a ???? a ???? a ??" - Hiragana, "?????" ¼ ° ?? But PIL's image draw.Text () function only takes one font at a time, so I can not drag this text correctly, because it is all inclusive of English, Japanese and Korean fonts.
By now, I had no luck to find a simple solution like PIL to pass several fonts, so that they can choose suitable fonts for each Unicode character (like the modern SDK or web browsers).
What I'm thinking, I should be repeated over each character, and determine which font I want to use for each character. But I can not help thinking that there should be an easy way to do this.
Am I going in the right direction? Is there no easy way?
PS) If it is a better solution then it is ok to use another language or other imaging library.
All you have to do is choose Unicode font Example:
Import Image Import Image , Image image = image. New ("RGB", [320320]) = Draw the image. (Image) a = u "a ?? ² a ?? a ???? a ?? - hiragana, ???? ???? ¼ ° ° ?? font = ImageFont.truetype ( "/ Library / Fonts / Aerial UnicodeTTF", 14) Draw Text ((50, 50), A, font = font) image.save ("a.png")
Comments
Post a Comment