unicode characters with PerlMagick

Discussion in 'Perl Misc' started by guba@vi-anec.de, Aug 26, 2009.

  1. Guest

    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
    , Aug 26, 2009
    #1
    1. Advertising

  2. wrote:
    > 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.


    --
    RGB
    RedGrittyBrick, Aug 26, 2009
    #2
    1. Advertising

  3. Torben Guest

    "" <> wrote in news:f1134f0d-726b-4c33-9900-
    :

    > 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.
    Torben, Mar 1, 2010
    #3
  4. Torben Guest

    Ben Morrow <> wrote in news:ttgt57-aaj2.ln1
    @osiris.mauzo.dyndns.org:

    > 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.
    Torben, Mar 2, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Randell D.

    CPANing PerlMagick and it fails

    Randell D., Aug 25, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,202
    Randell D.
    Aug 25, 2003
  2. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    958
    Grzegorz ¦liwiñski
    Jan 19, 2011
  3. kenny
    Replies:
    7
    Views:
    168
    kenny
    Apr 19, 2004
  4. rossz

    perlmagick and image size

    rossz, May 18, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    326
    dan baker
    May 21, 2004
  5. Aaron Dalton

    PerlMagick, Annotate, and Webdings

    Aaron Dalton, Mar 5, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    258
    Ron Savage
    Mar 27, 2005
Loading...

Share This Page