On 09/02/2012 03:41 AM, Raimund Steger wrote:
Helmut Tessarek wrote:
How can I make fontconfig look for the config files in the local directory?
After going through the entire mail thread again...
Don't you think, it might be a good idea to give fontconfig the option to
search in ./fontconfig/ first, before looking in PREFIX/etc or --sysconfdir?
Having objects make any assumptions about the location in the file system
they're stored in would be very uncommon on Unix. I. e. there is no POSIX
equivalent of Win32's GetModuleFileName.
It's common on OSX (some QuickTime plug-ins do this), and it can be done on
Linux. I have some sample C++ code in case you are interested.
bool GetCurrentExecutableAbsoluteFileName(std::string & exePathUTF8)
{
bool ok = false;
#ifdef _WIN32
wchar_t path[_MAX_PATH] = { 0 };
unsigned long pathLen = sizeof(path) / sizeof(wchar_t);
if (GetModuleFileNameW(0, path, pathLen) != 0)
{
exePathUTF8 = utf16_to_utf8(std::wstring(path));
ok = true;
}
#elif defined(__APPLE__)
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle)
{
CFURLRef cfUrl = CFBundleCopyExecutableURL(mainBundle);
if (cfUrl)
{
CFStringRef cfStr = CFURLCopyFileSystemPath(cfUrl, kCFURLPOSIXPathStyle);
char txt[1024] = { 0 };
if (cfStr)
{
if (CFStringGetCString(cfStr, txt, sizeof(txt), kCFStringEncodingUTF8))
{
exePathUTF8.assign(txt);
ok = true;
}
CFRelease(cfStr);
}
CFRelease(cfUrl);
}
}
#else
char path[PATH_MAX + 1] = { 0 };
if (readlink("/proc/self/exe", path, sizeof(path)) > 0)
{
exePathUTF8.assign(path);
ok = true;
}
#endif
assert(!exePathUTF8.empty());
return ok;
}
I've seen this issue brought up on the ffmpeg-devel mailing list, and here. I
hope there will be a positive resolution. If relative-to-exe fontconfig search
path is not possible perhaps ffmpeg developers will be more amiable to adding a
fontconfig configuration parameter to the drawtext filter (so it can pass
correct fonts.conf file path to libass, which will in turn initialize fontconfig).
Hope this helps,
Pavel.
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig