I want to install Ghostscript fonts along with ImageMagick, but I do
not want hard-coded pathnames in "type-ghostscript.xml". This will
allow our software installation to be placed in any arbitrary location
without requiring reconfiguration.
To accomplish this, I suggest allowing "LoadTypeList()" in "type.c" to
find glyph and metric files relative to the "type.xml" location. I
propose this patch:
----------------------------------------
--- ImageMagick-6.3.6/magick/type.c-orig 2007-10-15 10:00:46.502532508
-0400
+++ ImageMagick-6.3.6/magick/type.c 2007-10-15 10:00:19.937219116 -0400
@@ -1075,6 +1075,22 @@
if (strchr(path,'@') != (char *) NULL)
(void) SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
+ if (IsAccessible(path) == MagickFalse)
+ {
+ /*
+ If path is not accessible, try prepending filename's directory.
+ */
+ char newpath[MaxTextExtent];
+ GetPathComponent(filename,HeadPath,newpath);
+ if (*newpath != '\0')
+ {
+ (void) ConcatenateMagickString(newpath,DirectorySeparator,
+ MaxTextExtent);
+ (void) ConcatenateMagickString(newpath,path,MaxTextExtent);
+ path=(char *) RelinquishMagickMemory(path);
+ path=ConstantString(newpath);
+ }
+ }
type_info->glyphs=path;
}
attribute=GetXMLTreeAttribute(type,"metrics");
@@ -1088,6 +1104,22 @@
if (strchr(path,'@') != (char *) NULL)
(void) SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
+ if (IsAccessible(path) == MagickFalse)
+ {
+ /*
+ If path is not accessible, try prepending filename's directory.
+ */
+ char newpath[MaxTextExtent];
+ GetPathComponent(filename,HeadPath,newpath);
+ if (*newpath != '\0')
+ {
+ (void) ConcatenateMagickString(newpath,DirectorySeparator,
+ MaxTextExtent);
+ (void) ConcatenateMagickString(newpath,path,MaxTextExtent);
+ path=(char *) RelinquishMagickMemory(path);
+ path=ConstantString(newpath);
+ }
+ }
type_info->metrics=path;
}
attribute=GetXMLTreeAttribute(type,"name");
----------------------------------------
--
Ken Laprade Email: [EMAIL PROTECTED]
Harris Corporation Voice: (321)984-5727
PO Box 9800, MS W3/31G
Melbourne, FL 32902
_______________________________________________
Magick-bugs mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-bugs