unicode characters with PerlMagick

G

guba

Hello,

I want to write unicode characters with the Annotate method
in ImageMagick/PerlMagick (Ubuntu)

$image->Annotate(font => $font_name,
text => $text,
pointsize => ...,
gravity => ...,
fill => ...);

How can I put a character code like U+0E84 in the variable $text
so that it is recognized and what font should I install/specify?
Thank you very much!!

guba
 
R

RedGrittyBrick

Hello,

I want to write unicode characters with the Annotate method
in ImageMagick/PerlMagick (Ubuntu)

$image->Annotate(font => $font_name,
text => $text,
pointsize => ...,
gravity => ...,
fill => ...);

How can I put a character code like U+0E84 in the variable $text

$text = "...\x{0E84}...";

See perldoc perlunicode
so that it is recognized

I'd check the docs for PerlMagick for Unicode support. I suspect it will
just work.
and what font should I install/specify?

Any font that contains the Lao characters you want to include.
I'd Google for "Lao Font". YMMV.
 
T

Torben

How can I put a character code like U+0E84 in the variable $text
so that it is recognized and what font should I install/specify?
Thank you very much!!

As someone else pointed out, it just plain works.. :)

Either use
$t = "\x{0E84}";
or just put the text directly in the quote, if your file is stored in UTF-8
format.

I have just completed a project where I did BMPs with hindi text.
This is what I had to do:

* use utf-8 in Perl
* store the perl source file as UTF-8
* I took the strings to annotate from a different file. This file was also
stored as UTF-8

It was not necessary to specify encode=>'UTF-8' in $image->Annotate

The nice thing about Perl is that UniCode and utf8 just works.
 
T

Torben

Hmmmmmm. You clearly haven't been following the interminable 'Unicode is
irrepairably broken, whatever are we to do??' threads on p5p... :)

No, honestly, I did not see that. Perhaps you could enlighten me with a
link ? :) Yes, I did Google for it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top