Problem with just three non-ASCII characters

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
mkochano

Problem with just three non-ASCII characters

Post by mkochano »

Hi

I've tried to render some text using such command:

Code: Select all

convert \
        /tmp/black.png \
        -font $1 \
        -draw 'encoding "Latin 2" font-size 40 fill white gravity Center text 0,0 "aącćeęlłnńoósśzżxź
AĄCĆEĘLŁNŃOÓSŚZŻXŹ"' \
        /tmp/font_$1.png
It comes that most of characters are rendered correctly, but three - both lower and upper case - are not. These are:
- "a with ogonek";
- "s with accent";
- "z with accent.

It happens with all fonts that should contain iso-8859-2 characters. Here is an example:
Image

And here is the same text rendered with GIMP:
Image

Do you have any idea what's going on?

Regards
Michał
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Problem with just three non-ASCII characters

Post by Bonzo »

I have just tried this on my server and it works OK. I made sure when I wrote the code my editor was in UTF-8 not ANSI as that is its standard setting. I presume your standard font has those characters ?

I seem to remember annotate is better for this sort of thing.
Image

Code: Select all

<?php
exec("convert -size 900x100 xc:black -draw 'encoding \"Latin 2\" font-size 40 fill white gravity Center text 0,0 \"aącćeęlłnńoósśzżxź
AĄCĆEĘLŁNŃOÓSŚZŻXŹ\"' font.png");
?>
Image

Code: Select all

<?php
exec("convert -size 900x100 xc:black  -pointsize 40 -fill white -gravity Center -annotate +0+0 \"aącćeęlłnńoósśzżxź
AĄCĆEĘLŁNŃOÓSŚZŻXŹ\" font1.png");
?>
mkochano

Re: Problem with just three non-ASCII characters

Post by mkochano »

Bonzo wrote:I have just tried this on my server and it works OK. I made sure when I wrote the code my editor was in UTF-8 not ANSI as that is its standard setting.
From what you wrote about encoding I guess you tried this on Windows. I encountered this problem on Linux. The file was written in ISO-8859-2 (Latin 2) encoding as it is specified in "convert" arguments.
I presume your standard font has those characters ?
I didn't use the standard font. I tried all 479 fonts "convert" can see. These fonts can be divieded in two groups:
  1. fonts that do not render correctly any character from my test - they don't contain polish glyphs;
  2. fonts that render correctly all but these three characters from my test - they do contan polish glyphs and other programs - like GIMP - have no problems with them.
This particular font which I used as an example in my original posting (Adelaide-Normal) has all needed glyphs, this is why I shown the same text rendered by GIMP.

Can anybody try this on Linux?

Michał
Jaclaw

Re: Problem with just three non-ASCII characters

Post by Jaclaw »

Bonzo wrote:

Code: Select all

<?php
exec("convert -size 900x100 xc:black -draw 'encoding \"Latin 2\" font-size 40 fill white gravity Center text 0,0 \"aącćeęlłnńoósśzżxź
AĄCĆEĘLŁNŃOÓSŚZŻXŹ\"' font.png");
?>

Code: Select all

<?php
exec("convert -size 900x100 xc:black  -pointsize 40 -fill white -gravity Center -annotate +0+0 \"aącćeęlłnńoósśzżxź
AĄCĆEĘLŁNŃOÓSŚZŻXŹ\" font1.png");
?>
My case is even worse.
Both commands provided by you produce:
Image

Anyone has an idea what might be wrong with my IM (version 6.4.1 on Linux)?
Post Reply