Page 1 of 2

Some fonts work and others dont in linux

Posted: 2011-03-18T15:28:09-07:00
by javismiles
hi my friends
after a lot of desperation i found out that all the problems i had when moving to linux where not in the commands themselves, they are all related
to the fonts, in my web app i use different types of fonts, some are TTF , others are PFB,
they are all in a subdirectory fonts/font1/itsfiles
what i have found is that my imagemagick commands always work with some of the fonts i have in those subdirectories but not with others

of course in the windows server they were all working so i know they all work, but now in the linux server only some work

at the beginning i thought only the TTF were working and the PFB were not
but now i found out that some of the TTF also dont work, so i am totally confused,
some TTF ones work, but some TTF ones dont work, and most or all the PFB ones dont work

any ideas? how do i make sure that all the font files i have work in linux
thank you very much
jav

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T15:48:19-07:00
by javismiles
i just found that the windows PFB fonts have to be translated it seems to PFA
"The .pfa and .afm for Linux are ASCII text versions of the Windows .pfb and .pfm files."

thats ok i will try that, but what worries me now mainly are the TTF fonts, because TTF ones should work in
linux, however some of them work and some dont, and i dont get why,
some of the TTF work great in the imagemagick commands, but the more unusual TTF fonts fail to work, i dont get it
any ideas

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T15:50:39-07:00
by javismiles
im reading through this
viewtopic.php?f=2&t=6103

where is that type.xml file, where can i find it?
am i supposed to add all my fonts to that xml file?
if so, how? i heard there is a Perl script but i dont know how to execute perl in linux,
can i add them manually myself, as they are only 10 or so fonts

thank you for your help
jav

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T15:59:32-07:00
by javismiles
i see that i need to add the fonts in the type.xml file,
i found the file, and i only need to add 10 fonts, can i add them manually? and if so
whats the format, can you write an example for me for 1 of them? TTF or PFB?

type.xml
Configure fonts.
Define the font name, family, foundry, style, format, metrics, and glyphs for any font you want to use within ImageMagick.

thank u so much

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:17:10-07:00
by javismiles
would this be correct to add a ttf font to the type.xml file?

<type name="Palace" fullname="Palace" family="Palace" foundry="URW" weight="400" style="normal" stretch="normal" format="type1" glyphs="/var/www/vhosts/mywebsite/httpdocs/type/palace/palace_normal.TTF"/>

and if so, once i add it what else do i do, is it supposed to work just by adding to the file? do i need to restart anything?

how do i know the name, fullname, family foundry weight and stretch of the font?

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:18:58-07:00
by fmw42
sorry, I have only used Anthony's script to create the new type.xml file and then installed fontconfig to read the type.xml file. that is what his script does -- search for all your fonts and add them to the type.xml file.

see http://www.freedesktop.org/wiki/Software/fontconfig

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:22:54-07:00
by javismiles
thank you
- can i download and install fontconfig now, after having imagemagick already installed?
if so, how? in linux

- where can i get anthonys script and how do you run it from linux?

thank u
jav

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:26:36-07:00
by javismiles
but for what im reading it looks like type.xml is only made so that you can call the fonts with just the name instead of having to put
all the path, is that right? if thats the case then its not solving my problem anyway,
my problem is that many of my fonts , TTF and PFB are not being recognized by imagemagick, even when i put the entire path to them in the command,
so the question is, do i still need to put them in type.xml even when im specifying their entire path in the command?
is type.xml essential condition for any font to be used in imagemagick?


# Instead of using the command...
convert -font $HOME/lib/font/truetype/favorite/candice.ttf \
-pointsize 72 label:Anthony anthony.gif

# I can use the simpler font label...
convert -font Candice -pointsize 72 label:Anthony anthony.gif

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:27:50-07:00
by fmw42
javismiles wrote:thank you
- can i download and install fontconfig now, after having imagemagick already installed?
if so, how? in linux

- where can i get anthonys script and how do you run it from linux?

thank u
jav
You have to install fontconfig then recompile IM. The fontconfig folder has installation instructions, see INSTALL. Open Anthony's script in a text editor and read the top about how to run it and place the type.xml file where it resides now.

find /usr | grep "type.xml"

will tell you where it resides.

Anthony can give you much more information than I. I am not on Linux and so don't know exactly how to do that there.

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:29:07-07:00
by javismiles
i can see the script : http://www.imagemagick.org/Usage/script ... k_type_gen
but this is not what i thought,
that seems just to make it easier to write the name of the font by not having to specify the entire path,
ok great but its not about that my issue

my issue is that many fonts are not being recognized by imagemagick when i do specify the entire path to them, some yes, some not,
why is that?

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:32:22-07:00
by fmw42
javismiles wrote:but for what im reading it looks like type.xml is only made so that you can call the fonts with just the name instead of having to put
all the path, is that right? if thats the case then its not solving my problem anyway,
my problem is that many of my fonts , TTF and PFB are not being recognized by imagemagick, even when i put the entire path to them in the command,
so the question is, do i still need to put them in type.xml even when im specifying their entire path in the command?
is type.xml essential condition for any font to be used in imagemagick?


# Instead of using the command...
convert -font $HOME/lib/font/truetype/favorite/candice.ttf \
-pointsize 72 label:Anthony anthony.gif

# I can use the simpler font label...
convert -font Candice -pointsize 72 label:Anthony anthony.gif

That is correct. If you provide the full path, then fontconfig and the type.xml file are not needed as far as I know. I can provide the full path and things work fine so long as I use .ttf files. I have not tried other types of fonts. So perhaps you need to find similar ttf fonts to the others. Right now I cannot get fontconfig to work on my system and so cannot just use the font name. I have to use the full path. I used to be able to do that, but when I upgraded some of my delegates, it stopped working with only the font name.

This is from Anthony's script about the types of fonts that you can use:


| Usage: $prog > ~/.magick/type.xml
| $prog [-d] font1.ttf font2.ttf ... > type.xml
| $prog -f ttf_font_file_list > type.xml
|
| Generate an ImageMagick font list "type.xml" file for ALL fonts
| currently on the local linux system. This includes
| True Type Fonts (ttf)
| Ghostscript Fonts (afm)
| Open Type Fonts (otf)


I do not see your type of windows font. So I would look around for ttf fonts of the same name.

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:32:52-07:00
by javismiles
what im trying to say here is

if the only point of the type.xml + fontconfig,
is to make it easier to type the font name by not having to specify the entire path
then i am not interested

i dont mind writing the entire path to the font, its ok, no probs

but still writing the whole path some of the fonts work for me and some dont

so im just asking, is that because even when i specify the entire path i still need to declare the fonts in type.xml mandatorily in order to imagemagick
to recognize them at all?

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:34:04-07:00
by javismiles
thats the problem

some TTF fonts also Dont work
i know that i can translate the PFB to linux fonts thats no prob i read it

but TTF should work
and some of the TTF dont work

thats what puzzles me

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:34:18-07:00
by fmw42
javismiles wrote:what im trying to say here is

if the only point of the type.xml + fontconfig,
is to make it easier to type the font name by not having to specify the entire path
then i am not interested

i dont mind writing the entire path to the font, its ok, no probs

but still writing the whole path some of the fonts work for me and some dont

so im just asking, is that because even when i specify the entire path i still need to declare the fonts in type.xml mandatorily in order to imagemagick
to recognize them at all?
No you don't, but you have to use fonts that work on Unix and apparently your windows fonts will not work on unix. So find ttf fonts of the same name and use those on Unix.

Re: Some fonts work and others dont in linux

Posted: 2011-03-18T16:34:49-07:00
by javismiles
i thought all TTF fonts would work
but they dont
many TTF donts dont work
at least for me
and thats what im trying to find out, why