summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2002-09-30 21:48:31 +0000
committerTor Lillqvist <tml@src.gnome.org>2002-09-30 21:48:31 +0000
commit0ef97203efe749b3c8f938c5b8c2bccea3e5cee3 (patch)
tree674555a3676838ecefdb32af59ec7703800bed76
parentcafe79a607e379f6392778fffc83538ef550833e (diff)
downloadpango-0ef97203efe749b3c8f938c5b8c2bccea3e5cee3.tar.gz
Recognize a special marker directory name "WINDOWSFONTDIR", and look up
2002-10-01 Tor Lillqvist <tml@iki.fi> * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize a special marker directory name "WINDOWSFONTDIR", and look up the Windows fonts folder.
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-1-106
-rw-r--r--ChangeLog.pre-1-26
-rw-r--r--ChangeLog.pre-1-46
-rw-r--r--ChangeLog.pre-1-66
-rw-r--r--ChangeLog.pre-1-86
-rw-r--r--pango/mini-xft/minixftdir.c49
7 files changed, 85 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 38758a71..55792c66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 38758a71..55792c66 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 38758a71..55792c66 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 38758a71..55792c66 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 38758a71..55792c66 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 38758a71..55792c66 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,9 @@
+2002-10-01 Tor Lillqvist <tml@iki.fi>
+
+ * pango/mini-xft/minixftdir.c (MiniXftDirScan) [Win32]: Recognize
+ a special marker directory name "WINDOWSFONTDIR", and look up the
+ Windows fonts folder.
+
2002-09-28 Tor Lillqvist <tml@iki.fi>
* pango/pangowin32-fontmap.c (pango_win32_insert_font): Revert
diff --git a/pango/mini-xft/minixftdir.c b/pango/mini-xft/minixftdir.c
index f791b630..cce797a8 100644
--- a/pango/mini-xft/minixftdir.c
+++ b/pango/mini-xft/minixftdir.c
@@ -22,6 +22,13 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef _WIN32
+#include <windows.h>
+#include <shlobj.h>
+#ifndef SHGFP_TYPE_CURRENT
+#define SHGFP_TYPE_CURRENT 0
+#endif
+#endif
#include <sys/types.h>
#include <dirent.h>
#include <stdlib.h>
@@ -41,6 +48,48 @@ MiniXftDirScan (MiniXftFontSet *set, const char *dir, Bool force)
Bool ret = True;
int id;
+#ifdef _WIN32
+ char windows_font_folder[MAX_PATH];
+
+ /* Recognize the special marker WINDOWSFONTDIR */
+ if (strcmp (dir, "WINDOWSFONTDIR") == 0)
+ {
+ typedef HRESULT (_stdcall *PFN_SHGetFolderPathA) (HWND, int, HANDLE, DWORD, LPSTR);
+ PFN_SHGetFolderPathA sh_get_folder_path;
+ HMODULE shfolder_dll;
+
+ /* Try SHGetFolderPath if available */
+ if ((shfolder_dll = LoadLibrary ("shfolder.dll")) == NULL ||
+ (sh_get_folder_path = (PFN_SHGetFolderPathA) GetProcAddress (shfolder_dll, "SHGetFolderPathA")) == NULL ||
+ (*sh_get_folder_path) (NULL, CSIDL_FONTS, NULL,
+ SHGFP_TYPE_CURRENT,
+ windows_font_folder) != S_OK)
+ {
+ /* SHGetFolderPath not available, or failed. Use
+ * GetWindowsDirectory, append "fonts".
+ */
+ int maxlen = sizeof (windows_font_folder) - strlen ("\\fonts") - 1;
+ UINT n;
+ if ((n = GetWindowsDirectory (windows_font_folder, maxlen)) == 0 ||
+ n > maxlen)
+ {
+ /* Didn't work either. Guess. */
+ if (access ("C:\\winnt\fonts\\arial.ttf", 0))
+ strcpy (windows_font_folder, "C:\\winnt\fonts");
+ else
+ strcpy (windows_font_folder, "C:\\windows\fonts");
+ }
+ else
+ {
+ if (windows_font_folder[n-1] != '\\')
+ strcat (windows_font_folder, "\\");
+ strcat (windows_font_folder, "fonts");
+ }
+ }
+ dir = windows_font_folder;
+ }
+#endif
+
file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
if (!file)
return False;