src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java

Print this page




 630     @Override
 631     protected native int getScreenWidth();
 632     @Override
 633     protected native int getScreenHeight();
 634     private native Insets getScreenInsets(int screen);
 635 
 636 
 637     @Override
 638     public FontMetrics getFontMetrics(Font font) {
 639         // This is an unsupported hack, but left in for a customer.
 640         // Do not remove.
 641         FontManager fm = FontManagerFactory.getInstance();
 642         if (fm instanceof SunFontManager
 643             && ((SunFontManager) fm).usePlatformFontMetrics()) {
 644             return WFontMetrics.getFontMetrics(font);
 645         }
 646         return super.getFontMetrics(font);
 647     }
 648 
 649     @Override

 650     public FontPeer getFontPeer(String name, int style) {
 651         FontPeer retval = null;
 652         String lcName = name.toLowerCase();
 653         if (null != cacheFontPeer) {
 654             retval = cacheFontPeer.get(lcName + style);
 655             if (null != retval) {
 656                 return retval;
 657             }
 658         }
 659         retval = new WFontPeer(name, style);
 660         if (retval != null) {
 661             if (null == cacheFontPeer) {
 662                 cacheFontPeer = new Hashtable<>(5, 0.9f);
 663             }
 664             if (null != cacheFontPeer) {
 665                 cacheFontPeer.put(lcName + style, retval);
 666             }
 667         }
 668         return retval;
 669     }




 630     @Override
 631     protected native int getScreenWidth();
 632     @Override
 633     protected native int getScreenHeight();
 634     private native Insets getScreenInsets(int screen);
 635 
 636 
 637     @Override
 638     public FontMetrics getFontMetrics(Font font) {
 639         // This is an unsupported hack, but left in for a customer.
 640         // Do not remove.
 641         FontManager fm = FontManagerFactory.getInstance();
 642         if (fm instanceof SunFontManager
 643             && ((SunFontManager) fm).usePlatformFontMetrics()) {
 644             return WFontMetrics.getFontMetrics(font);
 645         }
 646         return super.getFontMetrics(font);
 647     }
 648 
 649     @Override
 650     @SuppressWarnings("deprecation")
 651     public FontPeer getFontPeer(String name, int style) {
 652         FontPeer retval = null;
 653         String lcName = name.toLowerCase();
 654         if (null != cacheFontPeer) {
 655             retval = cacheFontPeer.get(lcName + style);
 656             if (null != retval) {
 657                 return retval;
 658             }
 659         }
 660         retval = new WFontPeer(name, style);
 661         if (retval != null) {
 662             if (null == cacheFontPeer) {
 663                 cacheFontPeer = new Hashtable<>(5, 0.9f);
 664             }
 665             if (null != cacheFontPeer) {
 666                 cacheFontPeer.put(lcName + style, retval);
 667             }
 668         }
 669         return retval;
 670     }