Page 1 of 1

WITHDRAWN: possible bug with directories for type.xml

Posted: 2011-03-30T15:20:55-07:00
by fmw42
IM 6.6.9.1 Q16 Mac OSX Tiger

I am unable to get fontconfig to read my fonts from the type.xml file after replacing it.

Seems like over the last couple of releases, the location of the type.xml file has been moving. Now I only see it in one place. Here is a list of the type.xml files on my Mac:

The only location for ImageMagick-6.6.9 is in blue below. Previously it appeared in two or more locations.

find /usr | grep "type.xml"
/usr/local/etc/ImageMagick/type.xml
/usr/local/etc/ImageMagick-6.6.8/type.xml
/usr/local/lib/ImageMagick-6.6.8/config/type.xml
/usr/local/share/doc/ImageMagick-6.6.8/www/source/type.xml
/usr/local/share/doc/ImageMagick-6.6.9/www/source/type.xml
/usr/local/var/ImageMagick-6.6.8/type.xml
/usr/local/var/lib/ImageMagick-6.6.8/type.xml


I edited the type.xml file to include my personal font file created by Anthony's script imagick_type_gen.pl. I did this successfully in previous releases, but then it was located in either /usr/local/lib/ImageMagick-6.6.8/config/type.xml or /usr/local/var/lib/ImageMagick-6.6.8/type.xml. But there is no copy of it in either of those locations for ImageMagick-6.6.9

Is there a directory missing now that should contain the type.xml file that needs to be edited?


WITHDRAWN: I see now that it needs to be edited in /usr/local/etc/ImageMagick/type.xml

Re: possible bug with directories for type.xml

Posted: 2011-03-30T20:16:31-07:00
by anthony
There should be a 'home directory' on Mac's where you can create your own personal ".magick" sub-directory.

You can add a personal "type.xml" file in that directory, and you will then not need to change the system installed version.

I myself use $HOME/.magick/type.xml to load two personal font lists. One from a scan of the computer I am using (with entries for my personal font directory removed), and a second with entries of that personal font directory only. That way when my home transfers from one machine to another, my personal directory fonts transfers, but the discovered system fonts don't update.

EG: Personal .magick/type.xml file..

Code: Select all

<typemap>
   <include file="type-system.xml" />
   <include file="type-myfonts.xml" />
</typemap>
Then I create my other two included files like this...

My personal fonts...

Code: Select all

      find ~/lib/fonts/ \( -name '*.ttf' -o -name '*.otf' \) |\
           imagick_type_gen -f - > ~/.magick/type-myfonts.xml
and System fonts (excluding personal fonts)

Code: Select all

    imagick_type_gen > ~/.magick/type-system.xml
    perl -00 -i -ne "m%glyphs=\"/home/% || print" ~/.magick/type-system.xml
This is what I do. And it is completely independent on the 'installed' "type.xml" files, which I don't touch or modify.

None of the above requires system access either!

Re: possible bug with directories for type.xml

Posted: 2011-03-30T21:13:09-07:00
by fmw42
anthony wrote:There should be a 'home directory' on Mac's where you can create your own personal ".magick" sub-directory.

You can add a personal "type.xml" file in that directory, and you will then not need to change the system installed version.

I myself use $HOME/.magick/type.xml to load two personal font lists. One from a scan of the computer I am using (with entries for my personal font directory removed), and a second with entries of that personal font directory only. That way when my home transfers from one machine to another, my personal directory fonts transfers, but the discovered system fonts don't update.

EG: Personal .magick/type.xml file..

Code: Select all

<typemap>
   <include file="type-system.xml" />
   <include file="type-myfonts.xml" />
</typemap>
Then I create my other two included files like this...

My personal fonts...

Code: Select all

      find ~/lib/fonts/ \( -name '*.ttf' -o -name '*.otf' \) |\
           imagick_type_gen -f - > ~/.magick/type-myfonts.xml
and System fonts (excluding personal fonts)

Code: Select all

    imagick_type_gen > ~/.magick/type-system.xml
    perl -00 -i -ne "m%glyphs=\"/home/% || print" ~/.magick/type-system.xml
This is what I do. And it is completely independent on the 'installed' "type.xml" files, which I don't touch or modify.

None of the above requires system access either!
Anthony,

A little clarification, please.

1) I don't know what permissions to assign to a ".magick" directory when/if I can create it.

2) I don't understand how IM then finds the type.xml files that are now in this .magick directory rather than in its current location at /usr/local/etc/ImageMagick/type.xml, which looks now to be independent of the IM version so should not have to change it but once to reference type-fred.xlm in the type.xml file and put type-fred.xml in the same /usr/local/etc/ImageMagick/ directory.

Fred

Fred

Re: possible bug with directories for type.xml

Posted: 2011-03-30T22:31:36-07:00
by anthony
fmw42 wrote:A little clarification, please.
1) I don't know what permissions to assign to a ".magick" directory when/if I can create it.
Just not normal permissions. As long as you can read your .magick subdirectory and files as the person that is running Imagemagick, it will be read.

This will not work for PHP however as that runs as the webserver user which has a different home, and permsssions.
But your your own commands and scripts, as long as you can read it and it is in your defined home (As per the HOME environment variable), no problems.

You can see if IM reading the files using

Code: Select all

  convert -list font | grep ^Path:
2) I don't understand how IM then finds the type.xml files that are now in this .magick directory rather than in its current location at /usr/local/etc/ImageMagick/type.xml, which looks now to be independent of the IM version so should not have to change it but once to reference type-fred.xlm in the type.xml file and put type-fred.xml in the same /usr/local/etc/ImageMagick/ directory.
IM reads multiple files. The order is defined in the 'Resources' document.
http://www.imagemagick.org/script/resources.php

For a system installed IM (normal installs) this is..

Code: Select all

    $MAGICK_CONFIGURE_PATH
    <prefix>/lib/ImageMagick-<version>/config
    <prefix>/share/ImageMagick-<version>/config
    <prefix>/share/ImageMagick-<version>/
    $HOME/.magick/
    <client_path>/lib/ImageMagick-<version>/
    <current_directory>/
Where <prefix> is the compile time installation prefix. (typically /usr or /usr/local)
The <client_path> is the location of the binary (EG: "convert") that was run.

Note that it will even look for a "type.xml" in the current directory, though that is not usually very useful.

Note that the FIRST definition for a font (or whatever), is the one that will typically be used.

this is NOT just for fonts (type.xml" but just about anything, from ordered dither patterns "thresholds.xml", to color names "colors.xml", as well as specific format conversion commands "delegates.xml" and so on.

You can add your own personal configured items, completely separate to ones installed by your version of ImageMagick, as long as they don't conflict (system overrules if they do).

Re: WITHDRAWN: possible bug with directories for type.xml

Posted: 2011-03-30T22:34:20-07:00
by anthony
NOTE the reason for the change to "etc" for some configuration items was due to a requirement by debian linux.
I don't personally agree with the debian developers reasons, but it is better do comply.

I have yet to learn how "etc' configuration directories get added to the search path for XML files, but I would assume that if you move the config back to where you want it, it will still work as expected ;-)