550 551 boolean platformFont = AccessController.doPrivileged( 552 new PrivilegedAction<Boolean>() { 553 public Boolean run() { 554 String prop = 555 System.getProperty("java2d.font.usePlatformFont"); 556 String env = System.getenv("JAVA2D_USEPLATFORMFONT"); 557 return "true".equals(prop) || env != null; 558 } 559 }); 560 561 if (platformFont) { 562 usePlatformFontMetrics = true; 563 System.out.println("Enabling platform font metrics for win32. This is an unsupported option."); 564 System.out.println("This yields incorrect composite font metrics as reported by 1.1.x releases."); 565 System.out.println("It is appropriate only for use by applications which do not use any Java 2"); 566 System.out.println("functionality. This property will be removed in a later release."); 567 } 568 } 569 570 /** 571 * This method is provided for internal and exclusive use by Swing. 572 * 573 * @param font representing a physical font. 574 * @return true if the underlying font is a TrueType or OpenType font 575 * that claims to support the Microsoft Windows encoding corresponding to 576 * the default file.encoding property of this JRE instance. 577 * This narrow value is useful for Swing to decide if the font is useful 578 * for the Windows Look and Feel, or, if a composite font should be 579 * used instead. 580 * The information used to make the decision is obtained from 581 * the ulCodePageRange fields in the font. 582 * A caller can use isLogicalFont(Font) in this class before calling 583 * this method and would not need to call this method if that 584 * returns true. 585 */ 586 // static boolean fontSupportsDefaultEncoding(Font font) { 587 // String encoding = 588 // (String) java.security.AccessController.doPrivileged( 589 // new sun.security.action.GetPropertyAction("file.encoding")); 590 591 // if (encoding == null || font == null) { 592 // return false; 593 // } 594 595 // encoding = encoding.toLowerCase(Locale.ENGLISH); 596 597 // return FontManager.fontSupportsEncoding(font, encoding); 598 // } 599 600 public Font2DHandle getNewComposite(String family, int style, 601 Font2DHandle handle) { 602 603 if (!(handle.font2D instanceof CompositeFont)) { 604 return handle; 605 } 606 607 CompositeFont oldComp = (CompositeFont)handle.font2D; 608 PhysicalFont oldFont = oldComp.getSlotFont(0); 609 610 if (family == null) { 611 family = oldFont.getFamilyName(null); 612 } 613 if (style == -1) { 614 style = oldComp.getStyle(); 615 } 616 617 Font2D newFont = findFont2D(family, style, NO_FALLBACK); 618 if (!(newFont instanceof PhysicalFont)) { 619 newFont = oldFont; | 550 551 boolean platformFont = AccessController.doPrivileged( 552 new PrivilegedAction<Boolean>() { 553 public Boolean run() { 554 String prop = 555 System.getProperty("java2d.font.usePlatformFont"); 556 String env = System.getenv("JAVA2D_USEPLATFORMFONT"); 557 return "true".equals(prop) || env != null; 558 } 559 }); 560 561 if (platformFont) { 562 usePlatformFontMetrics = true; 563 System.out.println("Enabling platform font metrics for win32. This is an unsupported option."); 564 System.out.println("This yields incorrect composite font metrics as reported by 1.1.x releases."); 565 System.out.println("It is appropriate only for use by applications which do not use any Java 2"); 566 System.out.println("functionality. This property will be removed in a later release."); 567 } 568 } 569 570 public Font2DHandle getNewComposite(String family, int style, 571 Font2DHandle handle) { 572 573 if (!(handle.font2D instanceof CompositeFont)) { 574 return handle; 575 } 576 577 CompositeFont oldComp = (CompositeFont)handle.font2D; 578 PhysicalFont oldFont = oldComp.getSlotFont(0); 579 580 if (family == null) { 581 family = oldFont.getFamilyName(null); 582 } 583 if (style == -1) { 584 style = oldComp.getStyle(); 585 } 586 587 Font2D newFont = findFont2D(family, style, NO_FALLBACK); 588 if (!(newFont instanceof PhysicalFont)) { 589 newFont = oldFont; |