]> git.wh0rd.org Git - fontconfig.git/commitdiff
[win32] Expand "APPSHAREFONTDIR" to ../share/fonts relative to binary location
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 4 Feb 2009 01:35:10 +0000 (20:35 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 15 Feb 2009 21:40:24 +0000 (13:40 -0800)
Proposed by Diego Santa Cruz.

src/fcxml.c

index 15d4d30c936e02468c5190f91045b7e8d7ffede6..14da71376f958a9a89ca0b9aa3dff12a3592885a 100644 (file)
@@ -2081,6 +2081,27 @@ FcEndElement(void *userData, const XML_Char *name)
                if (p) *p = '\0';
                strcat (data, "\\fonts");
        }
+       else if (strcmp (data, "APPSHAREFONTDIR") == 0)
+       {
+               char *p;
+               FcStrFree (data);
+               data = malloc (1000);
+               if (!data)
+               {
+                       FcConfigMessage (parse, FcSevereError, "out of memory");
+                       break;
+               }
+               FcMemAlloc (FC_MEM_STRING, 1000);
+               if(!GetModuleFileName(NULL, data, 1000))
+               {
+                       FcConfigMessage (parse, FcSevereError, "GetModuleFileName failed");
+                       FcStrFree (data);
+                       break;
+               }
+               p = strrchr (data, '\\');
+               if (p) *p = '\0';
+               strcat (data, "\\..\\share\\fonts");
+       }
        else if (strcmp (data, "WINDOWSFONTDIR") == 0)
        {
            int rc;