character set

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
xsearch

character set

Post by xsearch »

turkish character problem

convert -background lightblue -fill black -font comicbd.ttf -size 320x140 -pointsize 18 \ caption:"IiİıĞğÜüİiŞşÖöÇç" \ sample.jpg

Output sample :

Image

i want configure main charset turkish. but how?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

There is a section that may help you out part way down this page: http://www.cit.gu.edu.au/~anthony/graph ... ick6/text/

Edit :

I tried this and the output is below

Code: Select all

exec("/usr/local/bin/convert -background lightblue -fill black -font comicbd.ttf -size 320x140 -pointsize 20 caption:\"IiIiGgÜüIiSsÖöÇç\" sample.jpg ");
I wonder if it is partialy due to the font you use - if the character is not there it is replaced with something else ? Again I didn't get some of the letters in the code so I assume my PC is not setup for them ? Therfore they were not in the output image ?

Image
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Right after a further test I find that if I change the "Encode in ANSI" to "Encode in UTF-8" in my editor ( Notepad+++ ). I get all the characters in the code:

Code: Select all

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8" />
</head>
<body>
<?php
exec("/usr/local/bin/convert -background lightblue -fill black -font comicbd.ttf -size 320x140 -pointsize 20 caption:IiİıĞğÜüİiŞşÖöÇç sample.jpg ");
?>
<img src="sample.jpg">
</body>
</html>
I have also done things "properly" now and have added the <html> tags etc. and used the meta tag for UTF8; I may not need to have done this but I thought it would be a good idea.

Image

Note I had to remove the " around the text or else I had the "squares" instead of the characters.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You get squares if the font does not handle the specific UTF-8 characters.

This is a UTF-8 character string and few commandline handlers especially windows commandline, handles UTF-8 directly. I recommnd the UTF-8 string be piped into Im using a file or pipeline. This is the way I handle the chinese text in IM Examples
http://www.cit.gu.edu.au/~anthony/graph ... t/#unicode
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply