imagemagick convert: japanese text broken in freebsd
Nikola Lečić
nikola.lecic at anthesphoria.net
Sun Dec 14 11:00:26 PST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
On Sat, 13 Dec 2008 20:20:23 -0800 (PST)
cuongvt <freebsd at vuhanhnhu.com> wrote:
> 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).
Hello,
It works for me with ImageMagick-6.4.5.5 and ImageMagick-6.4.7.5.
First, please make sure that the cause of the problem is not something
simple, i.e. make sure that
a) you don't have a wrong /non-UTF-8/ locale (not very likely since
you wouldn't get question marks);
b) you compiled ImageMagick with IMAGEMAGICK_TTF and
IMAGEMAGICK_FONTCONFIG.
If these are the case, then it's almost certain that fontconfig is
somehow confused with that Microsoft font. For example, see this
thread on XeTeX mailing list about Microsoft YaHei font:
http://www.tug.org/pipermail/xetex/2007-May/006539.html
If you use -text directive without -font specified, ImageMagick will
use the fonts from
/usr/local/lib/ImageMagick-6.4.7/config/type-ghostscript.xml
and this will produce question marks with Japanese UTF-8 string, which
seems to be the case. So, if you don't want to use some free
non-Microsoft font, you can try to do this:
1) Regenerate fontconfig cache ('fc-cache -f -v' as root).
2) Check if MS Gothic is visible to ImageMagick, i.e. try
%convert -list font
The output should contain
Font: MS-ゴシック-標準
family: MS ゴシック
style: Normal
stretch: Normal
weight: 400
glyphs: /path/to/msgothic.ttc
in ja_JP.UTF-8, or
Font: MS-Gothic-Regular
family: MS Gothic
in en_US.UTF-8 locale.
3) Then try
%convert orig.jpg -font MS-ゴシック-標準 -verbose -fill white \
-pointsize 125 -stroke blue -strokewidth 1 \
-draw "text 20,130 'がくせい'" straight.jpg
if you use ja_JP.* locale (-font MS-Gothic-Regular if you use
en_US.UTF-8 -- note that the command is locale-sensitive) and see
if this makes any difference.
Best regards.
- --
Nikola Lečić = Никола Лечић
fingerprint : FEF3 66AF C90E EDC3 D878 7CDC 956D F4AB A377 1C9B
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)
iJwEAQEDAAYFAklFVtMACgkQ/MM/0rYIoZin4wP/Zhlf++1GS8jWitrcT0wq0Rkr
cROjjb0DOusXnZnq9LdWac3kjOv5mAUENu7jVy+9rGqvmGhDFkgBi4/mBrcSePGv
cTzSMqsWAeeF+JTizyqJCyRjaz2iOuEjQ1y6zvkOj5D9EE+udXmR6BE7u3HdgZKL
mknYg8Y4ARyu1N+tiOw=
=W84X
-----END PGP SIGNATURE-----
More information about the freebsd-questions
mailing list