mirror of https://github.com/GNOME/gimp.git
plug-ins: lookup WMF fonts on same prefix when relocatable bundle.
When ENABLE_RELOCATABLE_RESOURCES is set, override libwmf fontdir. This is actually an alternate version of MR !9 by Alex Samorukov assuming a bundled GIMP on a single prefix rather than depending on an environment variable. This especially makes the relocatable feature more discoverable (rather than some random environment variable for which you'd need to read the code to discover it then make some wrapper script for GIMP).
This commit is contained in:
parent
0084776002
commit
4ff856f68d
|
@ -310,6 +310,7 @@ load_wmf_size (const gchar *filename,
|
|||
guint width = -1;
|
||||
guint height = -1;
|
||||
gboolean success = TRUE;
|
||||
char* wmffontdirs[2] = { NULL, NULL };
|
||||
|
||||
file = g_mapped_file_new (filename, FALSE, NULL);
|
||||
if (! file)
|
||||
|
@ -318,7 +319,16 @@ load_wmf_size (const gchar *filename,
|
|||
flags = WMF_OPT_IGNORE_NONFATAL | WMF_OPT_FUNCTION;
|
||||
api_options.function = wmf_gd_function;
|
||||
|
||||
#ifdef ENABLE_RELOCATABLE_RESOURCES
|
||||
wmffontdirs[0] = g_build_filename (gimp_installation_directory (),
|
||||
"share/libwmf/fonts", NULL);
|
||||
flags |= WMF_OPT_FONTDIRS;
|
||||
api_options.fontdirs = wmffontdirs;
|
||||
#endif
|
||||
|
||||
err = wmf_api_create (&API, flags, &api_options);
|
||||
if (wmffontdirs[0])
|
||||
g_free (wmffontdirs[0]);
|
||||
if (err != wmf_E_None)
|
||||
success = FALSE;
|
||||
|
||||
|
@ -771,6 +781,7 @@ wmf_get_pixbuf (const gchar *filename,
|
|||
guint file_height;
|
||||
wmfD_Rect bbox;
|
||||
gint *gd_pixels = NULL;
|
||||
char* wmffontdirs[2] = { NULL, NULL };
|
||||
|
||||
file = g_mapped_file_new (filename, FALSE, NULL);
|
||||
if (! file)
|
||||
|
@ -779,7 +790,16 @@ wmf_get_pixbuf (const gchar *filename,
|
|||
flags = WMF_OPT_IGNORE_NONFATAL | WMF_OPT_FUNCTION;
|
||||
api_options.function = wmf_gd_function;
|
||||
|
||||
#ifdef ENABLE_RELOCATABLE_RESOURCES
|
||||
wmffontdirs[0] = g_build_filename (gimp_installation_directory (),
|
||||
"share/libwmf/fonts", NULL);
|
||||
flags |= WMF_OPT_FONTDIRS;
|
||||
api_options.fontdirs = wmffontdirs;
|
||||
#endif
|
||||
|
||||
err = wmf_api_create (&API, flags, &api_options);
|
||||
if (wmffontdirs[0])
|
||||
g_free (wmffontdirs[0]);
|
||||
if (err != wmf_E_None)
|
||||
goto _wmf_error;
|
||||
|
||||
|
@ -878,6 +898,7 @@ wmf_load_file (const gchar *filename,
|
|||
wmfAPI_Options api_options;
|
||||
wmfD_Rect bbox;
|
||||
gint *gd_pixels = NULL;
|
||||
char* wmffontdirs[2] = { NULL, NULL };
|
||||
|
||||
*width = *height = -1;
|
||||
|
||||
|
@ -888,7 +909,16 @@ wmf_load_file (const gchar *filename,
|
|||
flags = WMF_OPT_IGNORE_NONFATAL | WMF_OPT_FUNCTION;
|
||||
api_options.function = wmf_gd_function;
|
||||
|
||||
#ifdef ENABLE_RELOCATABLE_RESOURCES
|
||||
wmffontdirs[0] = g_build_filename (gimp_installation_directory (),
|
||||
"share/libwmf/fonts/", NULL);
|
||||
flags |= WMF_OPT_FONTDIRS;
|
||||
api_options.fontdirs = wmffontdirs;
|
||||
#endif
|
||||
|
||||
err = wmf_api_create (&API, flags, &api_options);
|
||||
if (wmffontdirs[0])
|
||||
g_free (wmffontdirs[0]);
|
||||
if (err != wmf_E_None)
|
||||
goto _wmf_error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue