# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1300242134 0 # Node ID bb3b2d804f0e89da743edae70215f90782caa221 # Parent a0aec9a56914afc7c757c9438138393762fe37c7 Working on fonts some more.... setting a default label font that is smaller. diff -r a0aec9a56914 -r bb3b2d804f0e mac/dw.m --- a/mac/dw.m Wed Mar 16 01:34:36 2011 +0000 +++ b/mac/dw.m Wed Mar 16 02:22:14 2011 +0000 @@ -335,6 +335,7 @@ NSApplication *DWApp; NSMenu *DWMainMenu; +NSFont *DWDefaultFont; DWTimerHandler *DWHandler; #if !defined(GARBAGE_COLLECT) NSAutoreleasePool *pool; @@ -3636,6 +3637,7 @@ [textfield setDrawsBackground:NO]; [textfield setStringValue:[ NSString stringWithUTF8String:text ]]; [textfield setTag:cid]; + [[textfield cell] setFont:DWDefaultFont]; return textfield; } @@ -5845,6 +5847,13 @@ [window setStyleMask:tmp]; #endif } + else if([object isKindOfClass:[NSTextField class]]) + { + NSTextField *tf = object; + + /* TODO: See if we need to switch to a bitmask */ + [[tf cell] setAlignment:style]; + } else if([object isMemberOfClass:[NSTextView class]]) { NSTextView *tv = handle; @@ -5964,14 +5973,14 @@ */ int API dw_window_set_font(HWND handle, char *fontname) { - char *fontcopy = strdup(fontname); - char *name = strchr(fontcopy, '.'); - if(name) - { - int size = atoi(fontcopy); - *name = 0; - name++; - NSFont *font = [NSFont fontWithName:[ NSString stringWithUTF8String:name ] size:(float)size]; + char *fontcopy = strdup(fontname); + char *name = strchr(fontcopy, '.'); + if(name) + { + int size = atoi(fontcopy); + *name = 0; + name++; + NSFont *font = [NSFont fontWithName:[ NSString stringWithUTF8String:name ] size:(float)size]; if(font) { id object = handle; @@ -5984,11 +5993,12 @@ if([object isKindOfClass:[NSControl class]]) { [object setFont:font]; + [[object cell] setFont:font]; } } - } - free(fontcopy); - return 0; + } + free(fontcopy); + return 0; } /* @@ -7489,6 +7499,7 @@ [DWMainMenu retain]; [DWApp setMainMenu:DWMainMenu]; DWObj = [[DWObject alloc] init]; + DWDefaultFont = [[NSFont fontWithName:@"Geneva" size:10.0] retain]; /* Create mutexes for thread safety */ DWRunMutex = dw_mutex_new(); DWThreadMutex = dw_mutex_new();