1

Does anyone know of a solution for writing text to an image using an OTF? I know that GDI+ does not support OTF and that WPF does. I can load the font as a label in WPF, but still do not know how I can write this over an image, such as a watermark would do, and save that image.

I need this in an ASP.net page, so I won't actually be able to use WPF, but I figure that might be a start in building a class my page can import.

I appreciate all help!

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Anthony Greco
  • 2,885
  • 4
  • 27
  • 39

1 Answers1

1

It seems that ImageMagick supports OTF fonts. They have a tool to convert fonts to images which you could then use in a subsequent image draw operation.

Since there are wrappers for .NET, you could use them within your ASP.NET application.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • 1
    Already tried this. Unfortunately IMK is botching my OTF too. It looks close, but for some reason it is making my 'i's very bold. Good suggestion though, as that was what my first fix attempt was =) – Anthony Greco Jun 16 '12 at 05:50
  • I found [this discussion](http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=21067) from two weeks ago talking about OTF issues that seems to be resolved through a patch. Maybe you could fetch the very latest release and try again? – Uwe Keim Jun 16 '12 at 05:52
  • 1
    I am using a rather older build because its specifically needed for the .net wrapper, however I can easily call it via SHELL if that fixes it. Thanks, Uwe, I will see if it works any better! – Anthony Greco Jun 16 '12 at 05:54
  • compiling the source is dev out of my grasp however the most recent build has the same issue unfortunately – Anthony Greco Jun 16 '12 at 06:02
  • Sorry to hear that. I once used a website to convert OTF to TTF but the results look horrible; I guess that OTF contains more information than TTF is capable of handling. So this will probably be no option, either. – Uwe Keim Jun 16 '12 at 06:06
  • 1
    Tried that too, but was way to choppy. Unfortunately this is a branding requirement so crisp is a necessity. However [http://stackoverflow.com/questions/818544/using-wpf-on-a-dll-to-create-images-dynamically-instead-of-gdi] is getting me closer. Not perfect but I am working out the bugs. I am at least able to render with that. – Anthony Greco Jun 16 '12 at 06:21