Special characters issue on Windows with any text function

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Oxygen3

Special characters issue on Windows with any text function

Post by Oxygen3 »

I feel like this is a bug, as i don't see what i've been doing wrong so far, and can't figure out why it's not working as it should.

Long story short, i'm trying to write special caracters with Image Magick and it strips everything after the special caracter.
Command line used is quite simple (and i think pretty straightforward):

Code: Select all

convert label:aéc test.gif
I could use a external file (UTF8 encoded or not), the result is the same, it creates an image with only "a" inside (the "é" and the "c" are missing).

I've tested with the latest build and the one before that:
Version: ImageMagick 6.5.5-5 2009-08-31 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
(although the installed version was ImageMagick-6.5.5-6-Q16-windows-static.exe or ImageMagick-6.5.5-6-Q16-windows-dll.exe, same results with both)

other version used was 6.5.4-6
Version: ImageMagick 6.5.4-6 2009-07-25 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
OS used is either Windows Seven or Windows XP, same results on both cases.

Here is the debug status of the specified command:

Code: Select all

convert -debug all label:aéc test.gif
2009-09-04T17:09:40+02:00 0:01 0.000u 6.5.5 Configure convert[5544]: nt-base.c/NTRegistryKeyLookup/1622/Configure
  SOFTWARE\ImageMagick\6.5.5\Q:16
2009-09-04T17:09:40+02:00 0:01 0.000u 6.5.5 Configure convert[5544]: nt-base.c/NTRegistryKeyLookup/1640/Configure
  ConfigurePath
2009-09-04T17:09:40+02:00 0:01 0.000u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\ImageMagick\ImageMagick-6.5.5-Q16\delegates.xml"
2009-09-04T17:09:40+02:00 0:01 0.016u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\Users\me\.magick\delegates.xml"
2009-09-04T17:09:40+02:00 0:01 0.016u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "delegates.xml"
2009-09-04T17:09:40+02:00 0:01 0.016u 6.5.5 Configure convert[5544]: delegate.c/LoadDelegateList/1194/Configure
  Loading delegate configuration file "C:\ImageMagick\ImageMagick-6.5.5-Q16\delegates.xml" ...
2009-09-04T17:09:40+02:00 0:01 0.047u 6.5.5 Configure convert[5544]: delegate.c/LoadDelegateList/1194/Configure
  Loading delegate configuration file "delegates.xml" ...
2009-09-04T17:09:40+02:00 0:01 0.062u 6.5.5 Configure convert[5544]: utility.c/ExpandFilenames/866/Configure
  Command line: convert {-debug} {all} {label:aéc} {test.gif}
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Policy convert[5544]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Coder; rights=Read; pattern="LABEL" ...
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: nt-base.c/NTRegistryKeyLookup/1622/Configure
  SOFTWARE\ImageMagick\6.5.5\Q:16
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: nt-base.c/NTRegistryKeyLookup/1640/Configure
  ConfigurePath
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\ImageMagick\ImageMagick-6.5.5-Q16\type.xml"
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\Users\jean-baptiste.dancre\.magick\type.xml"
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "type.xml"
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: type.c/LoadTypeList/985/Configure
  Loading type configure file "C:\ImageMagick\ImageMagick-6.5.5-Q16\type.xml" ...
2009-09-04T17:09:40+02:00 0:01 0.078u 6.5.5 Configure convert[5544]: type.c/LoadTypeList/985/Configure
  Loading type configure file "C:\ImageMagick\ImageMagick-6.5.5-Q16\type-ghostscript.xml" ...
2009-09-04T17:09:40+02:00 0:01 0.109u 6.5.5 Configure convert[5544]: type.c/LoadTypeList/985/Configure
  Loading type configure file "type.xml" ...
2009-09-04T17:09:40+02:00 0:01 0.109u 6.5.5 Exception convert[5544]: blob.c/FileToBlob/829/Exception
  unable to open file `type-ghostscript.xml': No such file or directory
2009-09-04T17:09:40+02:00 0:01 0.140u 6.5.5 Annotate convert[5544]: annotate.c/RenderFreetype/1141/Annotate
  Font c:\windows\fonts\arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T17:09:40+02:00 0:01 0.140u 6.5.5 Annotate convert[5544]: annotate.c/GetTypeMetrics/735/Annotate
  Metrics: text: aéc; width: 6; height: 14; ascent: 11; descent: -3; max advance: 24; bounds: 1,0  6,7; origin: 7,0; pixels per em: 12,12; underline position: -3.39063; underline thickness: 2.34375
2009-09-04T17:09:40+02:00 0:01 0.140u 6.5.5 Resource convert[5544]: resource.c/AcquireMagickResource/257/Resource
  Area: 960b/960b/5.996gb
2009-09-04T17:09:41+02:00 0:01 0.140u 6.5.5 Resource convert[5544]: resource.c/AcquireMagickResource/257/Resource
  Memory: 960b/960b/4.497gb
2009-09-04T17:09:41+02:00 0:01 0.140u 6.5.5 Cache convert[5544]: cache.c/OpenPixelCache/3867/Cache
  open aéc[0] (heap memory, 8x15 960b)
2009-09-04T17:09:41+02:00 0:01 0.140u 6.5.5 Annotate convert[5544]: annotate.c/RenderFreetype/1141/Annotate
  Font c:\windows\fonts\arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T17:09:41+02:00 0:01 0.140u 6.5.5 Annotate convert[5544]: annotate.c/GetTypeMetrics/735/Annotate
  Metrics: text: aéc; width: 6; height: 14; ascent: 11; descent: -3; max advance: 24; bounds: 1,0  6,7; origin: 7,0; pixels per em: 12,12; underline position: -3.39063; underline thickness: 2.34375
2009-09-04T17:09:41+02:00 0:01 0.172u 6.5.5 Annotate convert[5544]: annotate.c/RenderFreetype/1141/Annotate
  Font c:\windows\fonts\arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T17:09:41+02:00 0:01 0.187u 6.5.5 Policy convert[5544]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Coder; rights=Write; pattern="GIF" ...
2009-09-04T17:09:41+02:00 0:01 0.187u 6.5.5 Policy convert[5544]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Path; rights=Write; pattern="test.gif" ...
2009-09-04T17:09:41+02:00 0:02 0.281u 6.5.5 Resource convert[5544]: resource.c/AcquireMagickResource/257/Resource
  Area: 1.17kb/1.17kb/5.996gb
2009-09-04T17:09:41+02:00 0:02 0.281u 6.5.5 Resource convert[5544]: resource.c/AcquireMagickResource/257/Resource
  Memory: 1.17kb/2.11kb/4.497gb
2009-09-04T17:09:41+02:00 0:02 0.281u 6.5.5 Cache convert[5544]: cache.c/OpenPixelCache/3867/Cache
  open test.gif[0] (heap memory, 8x15 1.17kb)
2009-09-04T17:09:41+02:00 0:02 0.296u 6.5.5 Cache convert[5544]: cache.c/CloneMemoryToMemoryPixelCache/1207/Cache
  memory => memory
2009-09-04T17:09:41+02:00 0:02 0.296u 6.5.5 Resource convert[5544]: resource.c/RelinquishMagickResource/957/Resource
  Memory: 960b/1.17kb/4.497gb
2009-09-04T17:09:41+02:00 0:02 0.312u 6.5.5 Resource convert[5544]: resource.c/RelinquishMagickResource/957/Resource
  Memory: 1.17kb/0b/4.497gb
2009-09-04T17:09:41+02:00 0:02 0.312u 6.5.5 Cache convert[5544]: cache.c/DestroyPixelCache/1504/Cache
  destroy test.gif[0]
Freetype is there and should be properly recognized:

Code: Select all

convert -list format
   Format  Mode  Description
-------------------------------------------------------------------------------
...
      TTF* r--   TrueType font (Freetype 2.1.5)
...
So, here i am, stucked with this, and not understanding what's going on exactly.

I'm willing to dig if required, but i'm out of ideas/solutions
Last edited by Oxygen3 on 2009-09-04T09:32:09-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Special characters issue on Windows with any text function

Post by magick »

Use a Truetype font, something like
  • convert -font arial.ttf label:aéc test.gif
Oxygen3

Re: Special characters issue on Windows with any text function

Post by Oxygen3 »

Well, i did try that without success.
It's not a surprise i think considering it did find arial.ttf before (as it says in the debug log anyway)

But thanks for the idea, it feels like it's either a stupid incompatibility issue or a small bug, any idea seems like a good way to start :)

If i don't copy the ttf file into the current working directory, i do get an error:
convert -font arial.ttf label:aéc test.gif
convert: unable to read font `arial.ttf' @ annotate.c/RenderType/809.

convert -font C:\windows\font\arial.ttf label:aéc test.gif
convert: unable to read font `C:\windows\font\arial.ttf' @ annotate.c/RenderType/809.
If i copy the ttf file into the working directory, here is what i get:

Code: Select all

D:\99-Perso\Metropole>convert -debug all -font arial.ttf label:aéc test.gif
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: nt-base.c/NTRegistryKeyLookup/1622/Configure
  SOFTWARE\ImageMagick\6.5.5\Q:16
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: nt-base.c/NTRegistryKeyLookup/1640/Configure
  ConfigurePath
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\ImageMagick\ImageMagick-6.5.5-Q16\delegates.xml"
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "C:\Users\me\.magick\delegates.xml"
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: configure.c/GetConfigureOptions/528/Configure
  Searching for configure file: "delegates.xml"
2009-09-04T18:28:54+02:00 0:01 0.000u 6.5.5 Configure convert[1860]: delegate.c/LoadDelegateList/1194/Configure
  Loading delegate configuration file "C:\ImageMagick\ImageMagick-6.5.5-Q16\delegates.xml" ...
2009-09-04T18:28:54+02:00 0:01 0.016u 6.5.5 Configure convert[1860]: delegate.c/LoadDelegateList/1194/Configure
  Loading delegate configuration file "delegates.xml" ...
2009-09-04T18:28:54+02:00 0:01 0.031u 6.5.5 Configure convert[1860]: utility.c/ExpandFilenames/866/Configure
  Command line: convert {-debug} {all} {-font} {arial.ttf} {label:aéc} {test.gif}
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Policy convert[1860]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Coder; rights=Read; pattern="LABEL" ...
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Annotate convert[1860]: annotate.c/RenderFreetype/1141/Annotate
  Font arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Annotate convert[1860]: annotate.c/GetTypeMetrics/735/Annotate
  Metrics: text: aéc; width: 6; height: 14; ascent: 11; descent: -3; max advance: 24; bounds: 1,0  6,7; origin: 7,0; pixels per em: 12,12; underline p
osition: -3.39063; underline thickness: 2.34375
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Resource convert[1860]: resource.c/AcquireMagickResource/257/Resource
  Area: 960b/960b/5.996gb
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Resource convert[1860]: resource.c/AcquireMagickResource/257/Resource
  Memory: 960b/960b/4.497gb
2009-09-04T18:28:55+02:00 0:01 0.031u 6.5.5 Cache convert[1860]: cache.c/OpenPixelCache/3867/Cache
  open aéc[0] (heap memory, 8x15 960b)
2009-09-04T18:28:55+02:00 0:01 0.047u 6.5.5 Annotate convert[1860]: annotate.c/RenderFreetype/1141/Annotate
  Font arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T18:28:55+02:00 0:01 0.047u 6.5.5 Annotate convert[1860]: annotate.c/GetTypeMetrics/735/Annotate
  Metrics: text: aéc; width: 6; height: 14; ascent: 11; descent: -3; max advance: 24; bounds: 1,0  6,7; origin: 7,0; pixels per em: 12,12; underline p
osition: -3.39063; underline thickness: 2.34375
2009-09-04T18:28:55+02:00 0:01 0.047u 6.5.5 Annotate convert[1860]: annotate.c/RenderFreetype/1141/Annotate
  Font arial.ttf; font-encoding none; text-encoding none; pointsize 12
2009-09-04T18:28:55+02:00 0:01 0.062u 6.5.5 Policy convert[1860]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Coder; rights=Write; pattern="GIF" ...
2009-09-04T18:28:55+02:00 0:01 0.062u 6.5.5 Policy convert[1860]: policy.c/IsRightsAuthorized/520/Policy
  Domain: Path; rights=Write; pattern="test.gif" ...
2009-09-04T18:28:55+02:00 0:01 0.172u 6.5.5 Resource convert[1860]: resource.c/AcquireMagickResource/257/Resource
  Area: 1.17kb/1.17kb/5.996gb
2009-09-04T18:28:55+02:00 0:01 0.172u 6.5.5 Resource convert[1860]: resource.c/AcquireMagickResource/257/Resource
  Memory: 1.17kb/2.11kb/4.497gb
2009-09-04T18:28:55+02:00 0:01 0.172u 6.5.5 Cache convert[1860]: cache.c/OpenPixelCache/3867/Cache
  open test.gif[0] (heap memory, 8x15 1.17kb)
2009-09-04T18:28:55+02:00 0:01 0.172u 6.5.5 Cache convert[1860]: cache.c/CloneMemoryToMemoryPixelCache/1207/Cache
  memory => memory
2009-09-04T18:28:55+02:00 0:01 0.172u 6.5.5 Resource convert[1860]: resource.c/RelinquishMagickResource/957/Resource
  Memory: 960b/1.17kb/4.497gb
2009-09-04T18:28:55+02:00 0:01 0.203u 6.5.5 Resource convert[1860]: resource.c/RelinquishMagickResource/957/Resource
  Memory: 1.17kb/0b/4.497gb
2009-09-04T18:28:55+02:00 0:01 0.203u 6.5.5 Cache convert[1860]: cache.c/DestroyPixelCache/1504/Cache
  destroy test.gif[0]
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Special characters issue on Windows with any text function

Post by fmw42 »

works perfectly fine for me (IM 6.5.5.6 Q16 Mac OSX Tiger) if you put the characters in a file that saves text encoding as UTF-8 (used BBEdit)

convert -font arial -pointsize 48 label:@testchars.txt test.gif

Image
Oxygen3

Re: Special characters issue on Windows with any text function

Post by Oxygen3 »

I do feel like stupid, because i did test exactly that and it didn't work.
I guess Scite went nuts with UTF8 :?

Btw, considering it's definitively not a bug, can anyone move this to the "User" section ? :D
Thanks a lot to everyone :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Special characters issue on Windows with any text function

Post by fmw42 »

No need to feel stupid. It is a common problem that many do not realize. I had the same problem a while ago. The text editor must be able to handle and save text encodings as UTF-8 or your system needs to be able to handle copying and pasting to a terminal and preserve the utf-8 encoding. The latter seems to be a harder thing to do. For those interested or with the same problem see Anthony's comments at http://www.imagemagick.org/Usage/text/#unicode
Post Reply