Windows font support

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
udayakumar

Windows font support

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Windows font support

Post 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.
udayakumar

Re: Windows font support

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Windows font support

Post 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
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Windows font support

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply