Page 1 of 1

Windows font support

Posted: 2009-10-03T06:05:24-07:00
by udayakumar
Hi,
I have created an application using ImageMagick .NET wrapper libraries. One of the things that I like to do is to call a Windows font dialog and allow the user to choose the font and the style. Then Apply this font and style on a text as annotation. I find when I pass the font name appended in the format (font-Bold-Italic) it seems to crash. What am I doing wrong?

Re: Windows font support

Posted: 2009-10-03T07:17:12-07:00
by magick
We do not write nor do we support the ImageMagick .NET wrapper. However, if you can create an ImageMagick command line that shows the problem is within ImageMagick and not the ImageMagick .NET wrapper, we will investigate further.

Re: Windows font support

Posted: 2009-10-03T08:03:07-07:00
by udayakumar
Well my question is not related to .NET wrapper.

What I need to do is to be able to pass a true type font name selected from Windows font dialogs. I get the font name resulting from the Font selection. Then pass that font name in as image->Font(fontname); Then call image->Annotate(text, gm);
When the selection is Bold and/or italic I tried to append bold and italic to the fontname as fontname-Bold-Italic expecting that imagemagick could locate the font. But that did not happen.
May be this is not the correct approach. Just any hints on how I can let the user choose a font and style and then apply it to the image would be very appreciated.

Re: Windows font support

Posted: 2009-10-03T08:41:33-07:00
by magick
Our response was in regards to your comment about a crash. We cannot investigate unless we can reproduce the problem with ImageMagick.

From the command line you can specify a font family, style, stretch, and weight. ImageMagick searches the font list to find a best match. If the .Net wrapper does not provide the same functionality you can either choose a font that ImageMagick knows about or you can specify a filename, something like c:\Windows\font\arial.ttf, for example. You can see which fonts ImageMagick knows about like this:
  • identify -list font

Re: Windows font support

Posted: 2009-10-03T11:35:45-07:00
by el_supremo
I tried to append bold and italic to the fontname as fontname-Bold-Italic expecting that imagemagick could locate the font
That will only work if the bold-italic font actually exists. For example, on my system (WinXP Pro) there is a Verdana font and Verdana-Bold-Italic also exists. But the only variation on the Tahoma font is Tahoma-Bold so asking for Tahoma-Bold-Italic will fail.

Pete