changeset 740:bb3b2d804f0e

Working on fonts some more.... setting a default label font that is smaller.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 16 Mar 2011 02:22:14 +0000
parents a0aec9a56914
children d2de18d4ea50
files mac/dw.m
diffstat 1 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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();