Some fonts work and others dont in linux

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Some fonts work and others dont in linux

Post 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.
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Some fonts work and others dont in linux

Post 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.
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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?
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Some fonts work and others dont in linux

Post 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.
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

Re: Some fonts work and others dont in linux

Post 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
Post Reply