< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m

Print this page

        

@@ -64,15 +64,36 @@
     fNativeCGFont = NULL;
     }
     [super finalize];
 }
 
+static NSString* uiName = nil;
+static NSString* uiBoldName = nil;
+
 + (AWTFont *) awtFontForName:(NSString *)name
                        style:(int)style
 {
     // create font with family & size
-    NSFont *nsFont = [NSFont fontWithName:name size:1.0];
+    NSFont *nsFont = nil;
+
+    if ((uiName != nil && [name isEqualTo:uiName]) ||
+        (uiBoldName != nil && [name isEqualTo:uiBoldName])) {
+        if (style & java_awt_Font_BOLD) {
+            nsFont = [NSFont boldSystemFontOfSize:1.0];
+        } else {
+            nsFont = [NSFont systemFontOfSize:1.0];
+        }
+#ifdef DEBUG
+        NSLog(@"nsFont-name is : %@", nsFont.familyName);
+        NSLog(@"nsFont-family is : %@", nsFont.fontName);
+        NSLog(@"nsFont-desc-name is : %@", nsFont.fontDescriptor.postscriptName);
+#endif
+        
+       
+    } else {
+           nsFont = [NSFont fontWithName:name size:1.0];
+    }
 
     if (nsFont == nil) {
         // if can't get font of that name, substitute system default font
         nsFont = [NSFont fontWithName:@"Lucida Grande" size:1.0];
 #ifdef DEBUG

@@ -186,10 +207,16 @@
             CFRelease(family);
             CFRelease(desc);
             CFRelease(font);
             return;
         }
+        if (uiType == kCTFontUIFontSystem) {
+            uiName = (NSString*)name;
+        }
+        if (uiType == kCTFontUIFontEmphasizedSystem) {
+            uiBoldName = (NSString*)name;
+        }
         [allFonts addObject:name];
         [fontFamilyTable setObject:family forKey:name];
 #ifdef DEBUG
         NSLog(@"name is : %@", (NSString*)name);
         NSLog(@"family is : %@", (NSString*)family);

@@ -240,11 +267,10 @@
          * although these may include fonts that are enumerated normally
          * they also demonstrably includes fonts that are not.
          */
         addFont(kCTFontUIFontSystem, allFonts, fontFamilyTable);
         addFont(kCTFontUIFontEmphasizedSystem, allFonts, fontFamilyTable);
-        addFont(kCTFontUIFontUserFixedPitch, allFonts, fontFamilyTable);
 
         sFilteredFonts = allFonts;
         sFontFamilyTable = fontFamilyTable;
     }
 
< prev index next >