< prev index next >

modules/javafx.graphics/src/main/java/com/sun/javafx/font/directwrite/DWFactory.java

Print this page




  31 
  32 public class DWFactory extends PrismFontFactory {
  33 
  34     /* Factories (Singletons) */
  35     private static IDWriteFactory DWRITE_FACTORY = null;
  36     private static IDWriteFontCollection FONT_COLLECTION = null;
  37     private static IWICImagingFactory WIC_FACTORY = null;
  38     private static ID2D1Factory D2D_FACTORY = null;
  39     private static Thread d2dThread;
  40 
  41     public static PrismFontFactory getFactory() {
  42         /* DirectWrite is not available on Windows Vista SP2 (JFX minimal
  43          * requirement on Windows) without 'Platform Update'.
  44          * To workaround this limitation this method first checks if a
  45          * IDWriteFactory can be created. The DWriteCreateFactory is a dynamic
  46          * method which fails gracefully (returns NULL) when the system does
  47          * not support DirectWrite.
  48          */
  49         if (getDWriteFactory() == null) {
  50             /* Returning null here indicates to the PrismFontFactory
  51              * to fallback to T2K. */
  52             return null;
  53         }
  54         return new DWFactory();
  55     }
  56 
  57     private DWFactory() {
  58     }
  59 
  60     @Override
  61     protected PrismFontFile createFontFile(String name, String filename,
  62                                            int fIndex, boolean register,
  63                                            boolean embedded, boolean copy,
  64                                            boolean tracked) throws Exception {
  65         return new DWFontFile(name, filename, fIndex, register,
  66                               embedded, copy, tracked);
  67     }
  68 
  69     @Override public GlyphLayout createGlyphLayout() {
  70         return new DWGlyphLayout();
  71     }




  31 
  32 public class DWFactory extends PrismFontFactory {
  33 
  34     /* Factories (Singletons) */
  35     private static IDWriteFactory DWRITE_FACTORY = null;
  36     private static IDWriteFontCollection FONT_COLLECTION = null;
  37     private static IWICImagingFactory WIC_FACTORY = null;
  38     private static ID2D1Factory D2D_FACTORY = null;
  39     private static Thread d2dThread;
  40 
  41     public static PrismFontFactory getFactory() {
  42         /* DirectWrite is not available on Windows Vista SP2 (JFX minimal
  43          * requirement on Windows) without 'Platform Update'.
  44          * To workaround this limitation this method first checks if a
  45          * IDWriteFactory can be created. The DWriteCreateFactory is a dynamic
  46          * method which fails gracefully (returns NULL) when the system does
  47          * not support DirectWrite.
  48          */
  49         if (getDWriteFactory() == null) {
  50             /* Returning null here indicates to the PrismFontFactory
  51              * to throw an Error . */
  52             return null;
  53         }
  54         return new DWFactory();
  55     }
  56 
  57     private DWFactory() {
  58     }
  59 
  60     @Override
  61     protected PrismFontFile createFontFile(String name, String filename,
  62                                            int fIndex, boolean register,
  63                                            boolean embedded, boolean copy,
  64                                            boolean tracked) throws Exception {
  65         return new DWFontFile(name, filename, fIndex, register,
  66                               embedded, copy, tracked);
  67     }
  68 
  69     @Override public GlyphLayout createGlyphLayout() {
  70         return new DWGlyphLayout();
  71     }


< prev index next >