imagemagick convert: japanese text broken in freebsd
Posted: 2008-12-13T21:08:14-07:00
Hi,
I know that IM support japanese text.
On Freebsd 7.0 with latest imagemagick built from port (6.4.7) and msgothic.ttc copied from windows partition,
imagick extension of PHP installed by pecl.
in terminal (zsh) I type:
================
convert origin.jpg -fill white -font /usr/X11R6/lib/X11/fonts/TrueType/msgothic.ttc -pointsize 125 -stroke blue -strokewidth 1 -draw "text 20,130 'がくせい'" straight.jpg
========
IM did not informed any error, but the result is japanese text broken (question marks).
However, if I ran PHp script (see below), japanese displayed in image fine.
What is the reason and how can I solve that?
thansk and regards,
Below is PHP script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja" dir="ltr">
<head>
<title>sample373</title>
</head>
<body>
<?php
/* ファイルはUTF-8で保存してね */
$im = new Imagick('sf.jpg');
$idraw = new ImagickDraw();
/* フォント設定 */
$idraw->setFont("/usr/X11R6/lib/X11/fonts/TrueType/msgothic.ttc");
/* フォントサイズ設定 */
$idraw->setFontSize(32);
/* gravity設定 */
$idraw->setGravity(Imagick::GRAVITY_CENTER);
$im->annotateImage($idraw, 0, 0, 0, "日本語");
$im->writeImage('sample373a.jpg');
/* $idraw->clear(); 2008/09/30追記:destroyと同様にClearDrawingWandを呼ぶので必要なし */
$idraw->destroy();
/* $im->clear(); 2008/09/30追記:destroyと同様にClearMagicWandを呼ぶので必要なし */
$im->destroy();
?>
<img src="sample373a.jpg" />
</body>
</html>
I know that IM support japanese text.
On Freebsd 7.0 with latest imagemagick built from port (6.4.7) and msgothic.ttc copied from windows partition,
imagick extension of PHP installed by pecl.
in terminal (zsh) I type:
================
convert origin.jpg -fill white -font /usr/X11R6/lib/X11/fonts/TrueType/msgothic.ttc -pointsize 125 -stroke blue -strokewidth 1 -draw "text 20,130 'がくせい'" straight.jpg
========
IM did not informed any error, but the result is japanese text broken (question marks).
However, if I ran PHp script (see below), japanese displayed in image fine.
What is the reason and how can I solve that?
thansk and regards,
Below is PHP script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja" dir="ltr">
<head>
<title>sample373</title>
</head>
<body>
<?php
/* ファイルはUTF-8で保存してね */
$im = new Imagick('sf.jpg');
$idraw = new ImagickDraw();
/* フォント設定 */
$idraw->setFont("/usr/X11R6/lib/X11/fonts/TrueType/msgothic.ttc");
/* フォントサイズ設定 */
$idraw->setFontSize(32);
/* gravity設定 */
$idraw->setGravity(Imagick::GRAVITY_CENTER);
$im->annotateImage($idraw, 0, 0, 0, "日本語");
$im->writeImage('sample373a.jpg');
/* $idraw->clear(); 2008/09/30追記:destroyと同様にClearDrawingWandを呼ぶので必要なし */
$idraw->destroy();
/* $im->clear(); 2008/09/30追記:destroyと同様にClearMagicWandを呼ぶので必要なし */
$im->destroy();
?>
<img src="sample373a.jpg" />
</body>
</html>