342 343 class OSXPlatformFont extends sun.awt.PlatformFont 344 { 345 OSXPlatformFont(String name, int style) 346 { 347 super(name, style); 348 } 349 @Override 350 protected char getMissingGlyphCharacter() 351 { 352 // Follow up for real implementation 353 return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/ 354 } 355 } 356 @Override 357 public FontPeer getFontPeer(String name, int style) { 358 return new OSXPlatformFont(name, style); 359 } 360 361 @Override 362 protected int getScreenHeight() { 363 return GraphicsEnvironment.getLocalGraphicsEnvironment() 364 .getDefaultScreenDevice().getDefaultConfiguration().getBounds().height; 365 } 366 367 @Override 368 protected int getScreenWidth() { 369 return GraphicsEnvironment.getLocalGraphicsEnvironment() 370 .getDefaultScreenDevice().getDefaultConfiguration().getBounds().width; 371 } 372 373 @Override 374 protected void initializeDesktopProperties() { 375 super.initializeDesktopProperties(); 376 Map <Object, Object> fontHints = new HashMap<>(); 377 fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); 378 desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints); 379 desktopProperties.put("awt.mouse.numButtons", BUTTONS); 380 381 // These DnD properties must be set, otherwise Swing ends up spewing NPEs 382 // all over the place. The values came straight off of MToolkit. 383 desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50)); 384 desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50)); 385 desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5)); 386 387 desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE); 388 389 // Register DnD cursors 390 desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop")); 391 desktopProperties.put("DnD.Cursor.MoveDrop", new NamedCursor("DnD.Cursor.MoveDrop")); 392 desktopProperties.put("DnD.Cursor.LinkDrop", new NamedCursor("DnD.Cursor.LinkDrop")); 393 desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop")); | 342 343 class OSXPlatformFont extends sun.awt.PlatformFont 344 { 345 OSXPlatformFont(String name, int style) 346 { 347 super(name, style); 348 } 349 @Override 350 protected char getMissingGlyphCharacter() 351 { 352 // Follow up for real implementation 353 return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/ 354 } 355 } 356 @Override 357 public FontPeer getFontPeer(String name, int style) { 358 return new OSXPlatformFont(name, style); 359 } 360 361 @Override 362 protected void initializeDesktopProperties() { 363 super.initializeDesktopProperties(); 364 Map <Object, Object> fontHints = new HashMap<>(); 365 fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); 366 desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints); 367 desktopProperties.put("awt.mouse.numButtons", BUTTONS); 368 369 // These DnD properties must be set, otherwise Swing ends up spewing NPEs 370 // all over the place. The values came straight off of MToolkit. 371 desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50)); 372 desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50)); 373 desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5)); 374 375 desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE); 376 377 // Register DnD cursors 378 desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop")); 379 desktopProperties.put("DnD.Cursor.MoveDrop", new NamedCursor("DnD.Cursor.MoveDrop")); 380 desktopProperties.put("DnD.Cursor.LinkDrop", new NamedCursor("DnD.Cursor.LinkDrop")); 381 desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop")); |