Support for Thai UTF-8 fonts

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
rlp1938
Posts: 4
Joined: 2012-01-06T03:10:38-07:00
Authentication code: 8675308

Support for Thai UTF-8 fonts

Post by rlp1938 »

I am using Imagemagick as installed in Ubuntu 11.10. When try to annotate with Thai characters in UTF-8 format the font does not render. I just get question marks instead. The font I specify is known to support Thai script in other applications. Can I remedy this by building IM from source?

Thanks,
Bob Parker
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Support for Thai UTF-8 fonts

Post by anthony »

Perhaps IM is not seeing the font with the thai glyphs, or the Thai glyphs are not in UniCode positions
Use "-debug annotate" to see exact what font file is being used by IM.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rlp1938
Posts: 4
Joined: 2012-01-06T03:10:38-07:00
Authentication code: 8675308

Re: Support for Thai UTF-8 fonts

Post by rlp1938 »

./dropshadow.sh สร้อย สร้อย.jpg
2012-01-09T19:08:46+07:00 0:00.010 0.010u 6.6.0 Annotate convert[7962]: annotate.c/RenderFreetype/1140/Annotate
Font /home/bob/.fonts/tahoma.ttf; font-encoding none; text-encoding none; pointsize 72
2012-01-09T19:08:46+07:00 0:00.010 0.020u 6.6.0 Annotate convert[7962]: annotate.c/GetTypeMetrics/733/Annotate
Metrics: text: สร้อย; width: 165.172; height: 87; ascent: 73; descent: -15; max advance: 100; bounds: 3.82812,0 31.8594,53.4375; origin: 170,0; pixels per em: 72,72; underline position: -4.6875; underline thickness: 2.03125
2012-01-09T19:08:46+07:00 0:00.010 0.020u 6.6.0 Annotate convert[7962]: annotate.c/RenderFreetype/1140/Annotate
Font /home/bob/.fonts/tahoma.ttf; font-encoding none; text-encoding none; pointsize 72

I have replaced -annotate in the script with -debug annotate.
Tahoma font produces good results with Thai script in many applications.

Bob Parker
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Support for Thai UTF-8 fonts

Post by anthony »

Works fine for me!

Code: Select all

convert -font tahoma.ttf -pointsize 36 label:สร้อย thai.gif
Image

Not certain about the added funny squiggle above the second letter though.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rlp1938
Posts: 4
Joined: 2012-01-06T03:10:38-07:00
Authentication code: 8675308

Re: Support for Thai UTF-8 fonts

Post by rlp1938 »

Ok thanks. So it looks like something is wrong with the Ubuntu build of it then.
I have tried the:
./configure
make && make install
on the source. It builds ok but all I end up with is a program that does nothing at all.
I suppose missing delegates.
Is there a list of possible libraries I can check out and download?
I've googled on this a bit and come up with tales of failure only.
BTW the funny squiggle over the text on your result is required to be there. It's a tone mark

I tried your command literally and I still just get question marks. Also I had to fully specify the location of the font because this Ubuntu version seems to have no idea of a font path.

Bob
Last edited by rlp1938 on 2012-01-11T01:23:54-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Support for Thai UTF-8 fonts

Post by anthony »

There was a recent change where ImageMagick did some switch from using freetype libraries to pango But that should not effect things too much.

Have a look at the list of dependancies given on
http://www.imagemagick.org/Usage/api/#build

I do not have an understanding of the package management generation under ubuntu and no one with the appropriate knowlegde has stepped forward to define how to create ubuntu packages, as such I have not yet listed anything specific.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rlp1938
Posts: 4
Joined: 2012-01-06T03:10:38-07:00
Authentication code: 8675308

Re: Support for Thai UTF-8 fonts

Post by rlp1938 »

I followed your link to here
http://www.digitalsanctum.com/2009/03/1 ... buntu-804/
and installed the recommended packages.
I've now compiled and installed IM from source and at least it is able to render a gif but it still does not render the Thai script.
Nor does it have any idea of font path, I have to fully specify the path.

I think I'll file a bug report with Ubuntu.

Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Support for Thai UTF-8 fonts

Post by fmw42 »

to get IM to know where your fonts are so that you can just specify the name, you need to run Anthony's script imagick_type_gen at http://www.imagemagick.org/Usage/scripts/
Post Reply