Commit 16f900fd authored by Alexandre Julliard's avatar Alexandre Julliard

wineps: Always escape Postscript reserved characters in font names.

parent 62e34022
...@@ -49,6 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -49,6 +49,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
*/ */
static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str) static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str)
{ {
static const char reserved_chars[] = " %/(){}[]<>\n\r\t\b\f";
int len; int len;
char *p; char *p;
DWORD size; DWORD size;
...@@ -92,7 +93,7 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str ...@@ -92,7 +93,7 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str
memcpy(*str, strings + name_record->offset, name_record->length); memcpy(*str, strings + name_record->offset, name_record->length);
*(*str + name_record->length) = '\0'; *(*str + name_record->length) = '\0';
HeapFree(GetProcessHeap(), 0, name); HeapFree(GetProcessHeap(), 0, name);
return; goto done;
} }
if(name_record->platform_id == 3 && name_record->encoding_id == 1 && if(name_record->platform_id == 3 && name_record->encoding_id == 1 &&
name_record->language_id == 0x409 && name_record->name_id == 6) name_record->language_id == 0x409 && name_record->name_id == 6)
...@@ -110,7 +111,7 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str ...@@ -110,7 +111,7 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str
WideCharToMultiByte(1252, 0, unicode, -1, *str, len, NULL, NULL); WideCharToMultiByte(1252, 0, unicode, -1, *str, len, NULL, NULL);
HeapFree(GetProcessHeap(), 0, unicode); HeapFree(GetProcessHeap(), 0, unicode);
HeapFree(GetProcessHeap(), 0, name); HeapFree(GetProcessHeap(), 0, name);
return; goto done;
} }
} }
TRACE("Unable to find PostScript name\n"); TRACE("Unable to find PostScript name\n");
...@@ -122,11 +123,8 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str ...@@ -122,11 +123,8 @@ static void get_download_name(PHYSDEV dev, LPOUTLINETEXTMETRICA potm, char **str
*str = HeapAlloc(GetProcessHeap(),0,len); *str = HeapAlloc(GetProcessHeap(),0,len);
strcpy(*str, (char*)potm + (ptrdiff_t)potm->otmpFaceName); strcpy(*str, (char*)potm + (ptrdiff_t)potm->otmpFaceName);
p = *str; done:
while((p = strchr(p, ' '))) for (p = *str; *p; p++) if (strchr( reserved_chars, *p )) *p = '_';
*p = '_';
return;
} }
/**************************************************************************** /****************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment