fonts show up in fc-list but not convert -list fonts

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
kapauldo
Posts: 6
Joined: 2011-08-31T16:49:38-07:00
Authentication code: 8675308

fonts show up in fc-list but not convert -list fonts

Post by kapauldo »

Hi -

I am trying to get my fonts into ImageMagick. I have been working on this for days and cannot get it to work. I have downloaded ImageMagick source and run config with --with-gs-font-dir to my ghostscript font directory. The fonts I want are there and I can see them with fc-list. But, after I compile it, and do a convert -list font the fonts do not appear. There are some fonts that show up there, but a bunch are missing.

On another linux machine, I have the exact same fonts and do the exact same thing, and the fonts DO appear in convert -list font. In fact, I've copied the /usr/share/fonts/ghostscript from the working machine to the non-working machine and still, the fonts do not show up in convert -list font.

I have tried everything and cannot figure out why I can't get these fonts into imageMagick.

I am using ImageMagick 6.7.1-7 and Ubuntu 11.04.

Any ideas?

Thanks for any help,
Kevin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fonts show up in fc-list but not convert -list fonts

Post by fmw42 »

run Anthony's imagick_type_gen script at http://www.imagemagick.org/Usage/scripts/ to put your fonts into the type.xml file.

also be sure your type.xml file includes

<typemap>
<include file="type-ghostscript.xml" />
</typemap>
kapauldo
Posts: 6
Joined: 2011-08-31T16:49:38-07:00
Authentication code: 8675308

Re: fonts show up in fc-list but not convert -list fonts

Post by kapauldo »

Thanks for the reply.

I ran this, reconfigured and recompiled ImageMagick, no luck. Exact same problem. Fonts show up in fc-list but not IM. Any other ideas? Is my assumption correct that if the font can be seen with fc-list, it should be seen by convert -list font?

Thanks,
kevin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fonts show up in fc-list but not convert -list fonts

Post by fmw42 »

Kevin,

As I understand it, fonts only show up in IM, if they have properly been put in the type.xml file. see http://www.imagemagick.org/script/resources.php#fonts

But you can always reference the file by using its full path even if it does not show in the convert -list font.

Did you verify that your fonts got put into the type.xml file after running Anthony's script? You may have to move the file yourself depending upon the way you ran the script. On unix/mac they need to be at /usr/local/etc/ImageMagick/type.xml (at least that is where mine are located).

Did you check to see that

<typemap>
<include file="type-ghostscript.xml" />
</typemap>

Is in your type.xml file and that type-ghostscript is in the same directory, ie. /usr/local/etc/ImageMagick.

If that does not help, then you may have to wait for Anthony to respond as he knows more about this than I.
kapauldo
Posts: 6
Joined: 2011-08-31T16:49:38-07:00
Authentication code: 8675308

Re: fonts show up in fc-list but not convert -list fonts

Post by kapauldo »

Thanks again for the reply. My fonts did NOT make it into type.xml, but they are not in type.xml on the machine where the fonts are working. I verified this by renaming the type.xml file on both machines and convert threw and an error. Now, this may be a difference between CentOS and Ubuntu, on my CentOS machine, IM works fine with all of the fonts.

Another note, I have verified that both type.xml files do reference type-ghostscript.xml but both type-ghostscript.xml files are identical and look like this:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE typemap [
<!ELEMENT typemap (type)+>
<!ELEMENT type (#PCDATA)>
<!ELEMENT include (#PCDATA)>
<!ATTLIST type name CDATA #REQUIRED>
<!ATTLIST type fullname CDATA #IMPLIED>
<!ATTLIST type family CDATA #IMPLIED>
<!ATTLIST type foundry CDATA #IMPLIED>
<!ATTLIST type weight CDATA #IMPLIED>
<!ATTLIST type style CDATA #IMPLIED>
<!ATTLIST type stretch CDATA #IMPLIED>
<!ATTLIST type format CDATA #IMPLIED>
<!ATTLIST type metrics CDATA #IMPLIED>
<!ATTLIST type glyphs CDATA #REQUIRED>
<!ATTLIST type version CDATA #IMPLIED>
<!ATTLIST include file CDATA #REQUIRED>
]>


<typemap>
<type name="AvantGarde-Book" fullname="AvantGarde Book" family="AvantGarde" foundry="URW" weight="400" style="normal" stretch="normal" format="type1" metrics="/usr/share/fonts/default/Type1/a010013l.afm" glyphs="/usr/share/fonts/default/Type1/a010013l.pfb"/>
<type name="AvantGarde-BookOblique" fullname="AvantGarde Book Oblique" family="AvantGarde" foundry="URW" weight="400" style="oblique" stretch="normal" format="type1" metrics="/usr/share/fonts/default/Type1/a010033l.afm" glyphs="/usr/share/fonts/default/Type1/a010033l.pfb"/>

...

Again, the fonts I'm looking for are NOT in either type.xml nor type-ghostscript.xml on both machines, but they work fine in IM on one but not the other.

Also, to repeat, I did run Anthony's script and the script did not add the fonts I'm looking for to type.xml.

Is it possible that Ubuntu needs the fonts in type.xml while CentOS can infer them from fontconfig (or something else) AND that Anthony's script isn't finding the fonts? I haven't looked through his script, maybe I have to modify it to point to my directory. My fonts are in

/usr/share/fonts/type1/gsfonts

Would that make a difference?

Another thing I tried was to convert all of my pfa's to pfb's thinking that perhaps Ubuntu was struggling with pfas (just a long shot), but that didn't help.

Thanks again for your help,
Kevin
kapauldo
Posts: 6
Joined: 2011-08-31T16:49:38-07:00
Authentication code: 8675308

Re: fonts show up in fc-list but not convert -list fonts

Post by kapauldo »

Here's another clue- when i run a convert -list font on the machine where all of the fonts are available, there is a "Path: System Fonts" in the output. That section is totally missing from the machine where the fonts are not available. Does this mean that Image Magick is not properly hooked up to fontconfig?

I checked the output of the configure script in ImageMagick and it says:

FontConfig --with-fontconfig=yes no

On the machine where the fonts ARE working, the configure output is:

FontConfig --with-fontconfig=yes yes

this is a huge clue. FontConfig is installed on the broken machine, any ideas as to why it's not being detected by IM? Am i on the right track here?

thanks again,
Kevin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fonts show up in fc-list but not convert -list fonts

Post by fmw42 »

reinstall fontconfig and make sure it has no error messages, then reinstall IM. that is my best guess -- that it is not installed or installed correctly. If it is, then IM would see it and say yes.
kapauldo
Posts: 6
Joined: 2011-08-31T16:49:38-07:00
Authentication code: 8675308

Re: fonts show up in fc-list but not convert -list fonts

Post by kapauldo »

[SOLVED] I did exactly this and it worked. Thanks so much for your help, hope this helps someone else. It was a mystery because fc-list, etc. worked fine. Thanks again!

Kevin
Post Reply