mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Standardize cache name to handle new Mac OS X display names
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26530 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5f24b337b5
commit
9bbb15310f
5 changed files with 33 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-05-16 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/XGCommonFont.m (XGFontCacheName): New function to standardize
|
||||
display name (and handle new Mac OS X display names).
|
||||
* Tools/font_cacher.m ([XFontCacher -getPathFor:display]): Use it.
|
||||
* Source/xlib/XGFontManager.m (cache_name): Use it.
|
||||
|
||||
2008-04-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/xlib/GSXftFontInfo.m (Ones): Correct the parameter name.
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
extern NSString *XGXFontName(NSString *fontName, float size);
|
||||
|
||||
/* Font functions (defined in XGCommonFont) */
|
||||
extern NSString *XGFontCacheName(Display *dpy);
|
||||
extern NSString *XGFontName(Display *dpy, XFontStruct *font_struct);
|
||||
extern NSString *XGFontFamily(Display *dpy, XFontStruct *font_struct);
|
||||
extern float XGFontPointSize(Display *dpy, XFontStruct *font_struct);
|
||||
|
|
|
@ -93,6 +93,26 @@ static BOOL XGInitAtoms(Display *dpy)
|
|||
return YES;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the name of the font cache file (used by font_cacher to write
|
||||
* the file and the backend to read the file
|
||||
*/
|
||||
extern NSString *XGFontCacheName(Display *dpy)
|
||||
{
|
||||
NSString *dname;
|
||||
dname = [NSString stringWithCString: XDisplayName(NULL)];
|
||||
if ([dname hasPrefix: @"/tmp"])
|
||||
{
|
||||
/* This is the new Mac OS X display server information, not a real
|
||||
host name. Use a more file-friendly name for the display */
|
||||
NSString *str = [dname lastPathComponent];
|
||||
dname = [dname stringByDeletingLastPathComponent];
|
||||
dname = [NSString stringWithFormat: @"%@%@",
|
||||
[dname lastPathComponent], str];
|
||||
}
|
||||
return dname;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read an X Font property of type unsigned long
|
||||
*/
|
||||
|
|
|
@ -76,12 +76,11 @@ cache_name()
|
|||
NSFileManager *mgr;
|
||||
BOOL flag;
|
||||
Display *dpy = [XGServer currentXDisplay];
|
||||
char *display_name = DisplayString(dpy);
|
||||
NSString *file_name;
|
||||
NSArray *paths;
|
||||
NSString *path = nil;
|
||||
|
||||
file_name = [NSString stringWithCString: XDisplayName(display_name)];
|
||||
file_name = XGFontCacheName(dpy);
|
||||
|
||||
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
|
||||
NSUserDomainMask, YES);
|
||||
|
|
|
@ -163,23 +163,19 @@
|
|||
NSArray *paths;
|
||||
NSFileManager *mgr;
|
||||
NSString *path;
|
||||
const char *display_name;
|
||||
BOOL flag;
|
||||
|
||||
if (display != nil)
|
||||
display_name = [display cString];
|
||||
dpy = XOpenDisplay([display cString]);
|
||||
else
|
||||
{
|
||||
display = [NSString stringWithCString: XDisplayName(0)];
|
||||
display_name = NULL;
|
||||
}
|
||||
|
||||
dpy = XOpenDisplay(display_name);
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (dpy == 0)
|
||||
{
|
||||
NSLog(@"Unable to open X display - no font information available");
|
||||
return nil;
|
||||
}
|
||||
/* Standardize the name */
|
||||
display = XGFontCacheName(dpy);
|
||||
|
||||
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
|
||||
NSUserDomainMask, YES);
|
||||
|
|
Loading…
Reference in a new issue