No file magic for truetype files?

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
Wolfgang Woehl
Posts: 34
Joined: 2010-02-25T15:22:50-07:00
Authentication code: 8675308

No file magic for truetype files?

Post by Wolfgang Woehl »

$ display /usr/share/fonts/truetype/freefont/FreeMono.ttf (displays font summary)
$ cp /usr/share/fonts/truetype/freefont/FreeMono.ttf foo
$ display foo
display: no decode delegate for this image format `foo' @ constitute.c/ReadImage/530.
$ mv foo foo.ttf
$ display foo.ttf (displays font summary)

This -- somewhat -- matters when handling font resources for digital cinema. Those might have uuid filenames:

$ file 3dec6dc0-39d0-498d-97d0-928d2eb78391
3dec6dc0-39d0-498d-97d0-928d2eb78391: TrueType font data

This with ImageMagick 6.5.7-8 2009-11-26 Q16 (Ubuntu 10.04's default, unfortunately)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No file magic for truetype files?

Post by fmw42 »

I suspect IM looks to the file suffix to decide what delegate library to use to display the image. Since foo has no suffix, IM says it does not have the delegate library to handle this. Don't know if this helps you or not.
Wolfgang Woehl
Posts: 34
Joined: 2010-02-25T15:22:50-07:00
Authentication code: 8675308

Re: No file magic for truetype files?

Post by Wolfgang Woehl »

Fred, yes, obviously. I tend to think that IM's display of fonts should be aligned with the behaviour for image files (where suffixes are not relevant for finding the right delegate and file magic is used instead. But then again, maybe it's done differently?)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No file magic for truetype files?

Post by fmw42 »

I can only assume it has something to do with the X11 display. But I understand your thoughts.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: No file magic for truetype files?

Post by magick »

Add this to your magic.xml configuration file:
  • <magic name="TTF" offset="0" target="\000\001\000\000"/>
Wolfgang Woehl
Posts: 34
Joined: 2010-02-25T15:22:50-07:00
Authentication code: 8675308

Re: No file magic for truetype files?

Post by Wolfgang Woehl »

Thanks. Works. Should've RTFM.
Post Reply