Hi Doing a "./configure --prefix=/usr" will generate a fonts.conf that searches for fonts in /usr/share/fonts and some X11 fonts directory, but completely ignores /usr/local/share/fonts. Any software that installs itself to /usr/local and installs some custom fonts won''t be able to even find them unless the user is aware of the problem and edits fonts.conf to include it (http://lists.freedesktop.org/pipermail/fontconfig/2003-October/000690.html). Man and info look for documents in /usr/local, gcc and binutils look for headers and libraries in /usr/local, the freedesktop specs support menus/icons/MIME types in /usr/local, and yet fontconfig completely ignores /usr/local. I am aware that some Linux distributions provide fonts.conf with <dir>/usr/local/share/fonts</dir> included, but many don''t, and not only is it better for you to support this as a matter of policy, but it''s also easier to fix the problem at the core than to run tests on every distribution and persuade them all to do this. Here (and attached) is a proposed patch for fontconfig-2.4.2 that adds /usr/local/share/fonts to the font search paths. Changes to ./configure are not included. --- a/configure.in 2006-12-03 01:24:39.000000000 +0200 +++ b/configure.in 2007-07-26 07:56:31.000000000 +0200 @@ -426,6 +426,14 @@ ;; esac done + case x"$FC_ADD_FONTS" in + x) + FC_ADD_FONTS="/usr/local/share/fonts" + ;; + *) + FC_ADD_FONTS="/usr/local/share/fonts,$FC_ADD_FONTS" + ;; + esac AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories]) ;; no) Please let me know if this is okay or if there is a better way. Thank you Damjan Jovanovic -------------- next part -------------- A non-text attachment was scrubbed... Name: fontconfig-usr-local.diff Type: text/x-diff Size: 392 bytes Desc: not available Url : http://lists.freedesktop.org/archives/fontconfig/attachments/20070726/e4a043eb/attachment.diff
On 7/26/07, Damjan Jovanovic <damjan.jov at gmail.com> wrote:> Hi > > Doing a "./configure --prefix=/usr" will generate a fonts.conf that > searches for fonts in /usr/share/fonts and some X11 fonts directory, > but completely ignores /usr/local/share/fonts. Any software that > installs itself to /usr/local and installs some custom fonts won''t be > able to even find them unless the user is aware of the problem and > edits fonts.conf to include it > (http://lists.freedesktop.org/pipermail/fontconfig/2003-October/000690.html). > > Man and info look for documents in /usr/local, gcc and binutils look for > headers and libraries in /usr/local, the freedesktop specs support > menus/icons/MIME types in /usr/local, and yet fontconfig completely > ignores /usr/local. I am aware that some Linux distributions provide > fonts.conf with <dir>/usr/local/share/fonts</dir> included, but many > don''t, and not only is it better for you to support this as a matter > of policy, but it''s also easier to fix the problem at the core than to > run tests on every distribution and persuade them all to do this. > > Here (and attached) is a proposed patch for fontconfig-2.4.2 that adds > /usr/local/share/fonts to the font search paths. Changes to > ./configure are not included. > > --- a/configure.in 2006-12-03 01:24:39.000000000 +0200 > +++ b/configure.in 2007-07-26 07:56:31.000000000 +0200 > @@ -426,6 +426,14 @@ > ;; > esac > done > + case x"$FC_ADD_FONTS" in > + x) > + FC_ADD_FONTS="/usr/local/share/fonts" > + ;; > + *) > + FC_ADD_FONTS="/usr/local/share/fonts,$FC_ADD_FONTS" > + ;; > + esac > AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories]) > ;; > no) > > Please let me know if this is okay or if there is a better way. > > Thank you > Damjan Jovanovic > >You know, some feedback would be nice. Is this the right place to send patches? Is my patch okay? Damjan Jovanovic
On Fri, 3 Aug 2007, Damjan Jovanovic wrote:> On 7/26/07, Damjan Jovanovic <damjan.jov at gmail.com> wrote: > > Hi > > > > Doing a "./configure --prefix=/usr" will generate a fonts.conf that > > searches for fonts in /usr/share/fonts and some X11 fonts directory, > > but completely ignores /usr/local/share/fonts. Any software that > > installs itself to /usr/local and installs some custom fonts won''t be > > able to even find them unless the user is aware of the problem and > > edits fonts.conf to include it > > (http://lists.freedesktop.org/pipermail/fontconfig/2003-October/000690.html). > > > > Man and info look for documents in /usr/local, gcc and binutils look for > > headers and libraries in /usr/local, the freedesktop specs support > > menus/icons/MIME types in /usr/local, and yet fontconfig completely > > ignores /usr/local. I am aware that some Linux distributions provide > > fonts.conf with <dir>/usr/local/share/fonts</dir> included, but many > > don''t, and not only is it better for you to support this as a matter > > of policy, but it''s also easier to fix the problem at the core than to > > run tests on every distribution and persuade them all to do this. > > > > Here (and attached) is a proposed patch for fontconfig-2.4.2 that adds > > /usr/local/share/fonts to the font search paths. Changes to > > ./configure are not included. > > > > --- a/configure.in 2006-12-03 01:24:39.000000000 +0200 > > +++ b/configure.in 2007-07-26 07:56:31.000000000 +0200 > > @@ -426,6 +426,14 @@ > > ;; > > esac > > done > > + case x"$FC_ADD_FONTS" in > > + x) > > + FC_ADD_FONTS="/usr/local/share/fonts" > > + ;; > > + *) > > + FC_ADD_FONTS="/usr/local/share/fonts,$FC_ADD_FONTS" > > + ;; > > + esac > > AC_DEFINE_UNQUOTED(FC_ADD_FONTS,"$add_fonts",[Additional font directories]) > > ;; > > no) > > > > Please let me know if this is okay or if there is a better way. > > > > Thank you > > Damjan Jovanovic > > > > > > You know, some feedback would be nice. Is this the right place to send > patches? Is my patch okay?Seems fine to me. I didn''t look at most recent source, but it also already looks at /usr/X11R6/lib/X11/fonts /usr/X11/lib/X11/fonts /usr/lib/X11/fonts and adds them if exists. Why not just use the configure switches? --with-default-fonts--with-add-fonts Jeremy C. Reed
> > You know, some feedback would be nice. Is this the right place to send > > patches? Is my patch okay? > > Seems fine to me. I didn''t look at most recent source, but it also already > looks at /usr/X11R6/lib/X11/fonts /usr/X11/lib/X11/fonts > /usr/lib/X11/fonts and adds them if exists.Ok thank you.> Why not just use the configure switches? > > --with-default-fonts> --with-add-fontsThat''s the whole point: you''d have to persuade *every* distro to use those flags if you want consistent support for /usr/local/share/fonts. Earlier this week someone asked where to put fonts so his application can find them and got many different answers - I would have said "just install your application into /usr/local and everything will work", but it won''t work on every distro without this patch. Installing into /usr is bad practice, and the suggestions that were given (install them into a custom directory and copy to ~/.fonts at runtime, call some fontconfig function that adds a custom search directory, ...) seem wasteful/ugly.> Jeremy C. Reed >Damjan Jovanovic
>>>>> "Damjan" == Damjan Jovanovic <damjan.jov at gmail.com> writes:Damjan> the suggestions that were given (install them into a custom Damjan> directory and copy to ~/.fonts at runtime, call some fontconfig Damjan> function that adds a custom search directory, ...) seem Damjan> wasteful/ugly. While I agree completely that the first is inelegant, that latter is the proper way to handle application-specific fonts. What you are shooting for is better handling of fonts bundled with apps, which is a different problem. Some apps want to use some fonts which are of no value to (most) other apps, or which have restrictive licensing which prohibits system-wide installation. That is what the app-specific support in fontconfig is for. Those fonts should go in ${prefix}/share/${app}/fonts if prefix is eg /usr or /usr/local, or ${prefix}/share/fonts if prefix has the app''s name in it, such as /opt/${app}, /pkg/${app}, /usr/pkg/${app}, et cetera. OTOH, fonts which are simply bundled should go in a subdir of ${prefix}/share/fonts specific to the package, as per your proposal. -JimC -- James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6