Re: PANGO_RC_FILE environment variable



I found an easy solution, since I'm on MacOs and using MacPorts as package manager : I can build pango using the following option:

sudo port -v install pango +no_x11 -x11 +quartz +builtin_modules

The "+builtin_modules" variant does what I want : It links the modules statically into pango, so no more worries about the modules path.

Thanks for your help.

Antoine



On 01 Mar 2012, at 11:26, John Emmas wrote:


On 1 Mar 2012, at 08:59, Antoine Baudoux wrote:

Hello,

Yes thats where pango was installed, but I want to repackage it in a bundled App. Is there a way to do that? The path to the modules file seems to be hardcoded in the library, and i was hoping to change it by setting the PANGO_RC_FILE env variable. Is there another way?


I can offer a solution for Windows but you'd need to be building the library yourself.  If so, you can modify 'pango_get_sysconf_subdirectory()' (in pango-utils.c).  I modified it to look for an environment variable called "PANGO_MODULE_PATH" (obviously, your main app would have to set up such an environment var for this to work).  Non-Windows versions simply return '[SYSCONFDIR]/pango' (where SYSCONFDIR is a path you define at compile time).  So again, you'd need to be building pango yourself is you wanted to change the behaviour.

If nobody knows of a better approach, I'd recommend that this mod should be considered for inclusion in the main code base (and preferably, a similar idea for the non-Windows platforms).  The reason I needed this on Windows was that our app needed to have write access for the relevant folder - but we had no way of guaranteeing that "etc\\pango" would be a writeable directory.  So I just copied the idea from some other gtk library (several other gtk libraries seem to employ the same strategy).  I've included the full code for that function below, so you can see what I needed to change (it only involved 3 extra lines!!)

John


G_CONST_RETURN char *
pango_get_sysconf_subdirectory (void)
{
#ifdef G_OS_WIN32
    char *env_path;
    static gchar *result = NULL;

    if (result == NULL)
    {
       /* This function changed by JE - 17-02-2012 to allow us
          to find pango.modules from an environment variable */
          env_path = g_getenv("PANGO_MODULE_PATH");
          if (env_path)
      result = g_strdup(env_path);

          if (result == NULL)
          {
              gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
              result = g_build_filename (root, "etc\\pango", NULL);
              g_free (root);
          }
    }
    return result;
#else
    return SYSCONFDIR "/pango";
#endif
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]