[Fontconfig] Portable apps and fontconfig

Raimund Steger rs at mytum.de
Mon Jun 23 08:57:28 PDT 2014


On Mon, June 23, 2014 14:47, Dan Kegel wrote:
> On Mon, Jun 23, 2014 at 3:45 AM, Akira TAGOH <akira at tagoh.org> wrote:
>>> But it's annoying to have to put
>>> the absolute path to the fonts in fonts.conf.
>>
>> You mean the place to load fonts, i.e. <dir> elements?
>
> Yes.
>
>>> Furthermore, I think at the moment the location of the fonts.conf
>>> file is hard-coded (right?).  It'd be nice if it could be looked for
>>> via a dll-relative path.
>>
>> Well, yes, it is determined at the build time. but can be replaced by
>> FONTCONFIG_FILE env var at the run time.
>
> That's still absolute, one more thing to be fixed up by the installer,
> and I'm trying to get to an app that can be relocated to a different
> directory without an installer.

I think there's special logic in place to support DLL-relative locations
of fonts.conf on Win32, if the DLL is found to be in a subfolder called
bin/ or lib/. Check DllMain in fccfg.c.

About the <dir> elements I'm not sure, I suppose you might have to use a
runtime-generated configuration file for that, although it should
certainly be possible to devise a patch for FcParseDir that adds
DLL-relative variants of the CUSTOMFONTDIR and APPSHAREFONTDIR stuff.. I
suppose we'd have to store the location we get in DllMain somewhere...

Although I'd have to ask, the current APPSHAREFONTDIR value of module-dir
+ "\\..\\share\\fonts" doesn't seem too far off for most use cases, even
if it's exe-relative?

Raimund

-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>



More information about the Fontconfig mailing list