From 1cdf7efb224867c41b2dea48884d87c5fb67bdaf Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 3 Feb 2009 20:35:10 -0500 Subject: [PATCH] [win32] Expand "APPSHAREFONTDIR" to ../share/fonts relative to binary location Proposed by Diego Santa Cruz. --- src/fcxml.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/fcxml.c b/src/fcxml.c index 15d4d30..14da713 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -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; -- 2.39.5