diff options
author | Tor Lillqvist <tml@iki.fi> | 2000-11-30 21:04:52 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2000-11-30 21:04:52 +0000 |
commit | 86666507ded9c2dd4d89e21c8694d14eabe6c0d9 (patch) | |
tree | 237765b634b73f5e113830fa44d8f080188b9837 /pango/pango-utils.c | |
parent | 801c16be4a652441d34df85892621470fce58f28 (diff) | |
download | pango-86666507ded9c2dd4d89e21c8694d14eabe6c0d9.tar.gz |
Define PANGO_VERSION.
2000-11-30 Tor Lillqvist <tml@iki.fi>
* pango/makefile.mingw.in (DEFINES): Define PANGO_VERSION.
Changes by Hans Breuer:
* pango/pango-layout.c (shape_tab): Add a FIXME comment.
* pango/pango-markup.c (compare_xcolor_entries): Use g_strcasecmp.
* pango/pango-utils.c (pango_get_sysconf_subdirectory): Use second
fallback location if there is no pango subdir in the Windows
directory.
* pango/pangowin32-fontmap.c
(pango_win32_font_entry_get_coverage): Check if fopen succeeded.
* pango/pangowin32-private.h (DEBUGGING): Turn off.
* pango/pangowin32.c (pango_win32_unicode_classify): We can in
fact get out of the loop. Return invalid value in that case.
(subfont_has_glyph): Improve performance a bit.
* pango/querymodules.c: Small change for MSVC build.
* modules/basic/basic-win32.c (basic_engine_get_coverage):
Performance improvement.
* examples/viewer-win32.c (main): Disable double buffering on the
layout widget.
Diffstat (limited to 'pango/pango-utils.c')
-rw-r--r-- | pango/pango-utils.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index b243f7be..91b50d80 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -41,6 +41,12 @@ #ifdef G_OS_WIN32 +#include <sys/types.h> +#include <sys/stat.h> +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode)&_S_IFDIR) +#endif + #define STRICT #include <windows.h> @@ -618,7 +624,12 @@ pango_get_sysconf_subdirectory (void) /* On Windows we don't hardcode any paths (SYSCONFDIR) in the DLL, * but rely on an installation program to store the installation * directory in the registry. If no installation program has been - * used, punt and assume the Pango directory is %WINDIR%\Pango. + * used, assume the Pango directory is %WINDIR%\Pango. + * + * If the latter doesn't exist either, fall back to the directory + * the pango-$PANGO_VERSION.dll comes from, to stop polluting + * neither the Registry nor the windows directory (which may be + * write protected with Win2K anyway). */ static gboolean been_here = FALSE; @@ -627,6 +638,7 @@ pango_get_sysconf_subdirectory (void) HKEY reg_key = NULL; DWORD type; DWORD nbytes = sizeof (pango_sysconf_dir); + struct stat st; if (been_here) return pango_sysconf_dir; @@ -642,6 +654,26 @@ pango_get_sysconf_subdirectory (void) /* Uh oh. Use %WinDir%\Pango */ GetWindowsDirectory (win_dir, sizeof (win_dir)); sprintf (pango_sysconf_dir, "%s\\pango", win_dir); + + if (!stat (pango_sysconf_dir, &st) || !S_ISDIR (st.st_mode)) + { + /* Oops. %WinDir%\pango does not exist */ + HMODULE hm = NULL; + gchar* libname = g_strdup_printf ("pango-%s.dll", PANGO_VERSION); + hm = GetModuleHandle (libname); + if (!hm) + g_warning ("Can't find myself (%s)", libname); + else + { + GetModuleFileName (hm, + pango_sysconf_dir, + sizeof(pango_sysconf_dir)); + /* strip dll name */ + if (strrchr (pango_sysconf_dir, '\\')) + *strrchr (pango_sysconf_dir, '\\') = 0; + } + g_free (libname); + } } if (reg_key != NULL) |