src/windows/classes/sun/awt/windows/WPathGraphics.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  77 class WPathGraphics extends PathGraphics {
  78 
  79     /**
  80      * For a drawing application the initial user space
  81      * resolution is 72dpi.
  82      */
  83     private static final int DEFAULT_USER_RES = 72;
  84 
  85     private static final float MIN_DEVICE_LINEWIDTH = 1.2f;
  86     private static final float MAX_THINLINE_INCHES = 0.014f;
  87 
  88     /* Note that preferGDITextLayout implies useGDITextLayout.
  89      * "prefer" is used to override cases where would otherwise
  90      * choose not to use it. Note that non-layout factors may
  91      * still mean that GDI cannot be used.
  92      */
  93     private static boolean useGDITextLayout = true;
  94     private static boolean preferGDITextLayout = false;
  95     static {
  96         String textLayoutStr =
  97             (String)java.security.AccessController.doPrivileged(
  98                    new sun.security.action.GetPropertyAction(
  99                          "sun.java2d.print.enableGDITextLayout"));
 100 
 101         if (textLayoutStr != null) {
 102             useGDITextLayout = Boolean.getBoolean(textLayoutStr);
 103             if (!useGDITextLayout) {
 104                 if (textLayoutStr.equalsIgnoreCase("prefer")) {
 105                     useGDITextLayout = true;
 106                     preferGDITextLayout = true;
 107                 }
 108             }
 109         }
 110     }
 111 
 112     WPathGraphics(Graphics2D graphics, PrinterJob printerJob,
 113                   Printable painter, PageFormat pageFormat, int pageIndex,
 114                   boolean canRedraw) {
 115         super(graphics, printerJob, painter, pageFormat, pageIndex, canRedraw);
 116     }
 117 


   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  77 class WPathGraphics extends PathGraphics {
  78 
  79     /**
  80      * For a drawing application the initial user space
  81      * resolution is 72dpi.
  82      */
  83     private static final int DEFAULT_USER_RES = 72;
  84 
  85     private static final float MIN_DEVICE_LINEWIDTH = 1.2f;
  86     private static final float MAX_THINLINE_INCHES = 0.014f;
  87 
  88     /* Note that preferGDITextLayout implies useGDITextLayout.
  89      * "prefer" is used to override cases where would otherwise
  90      * choose not to use it. Note that non-layout factors may
  91      * still mean that GDI cannot be used.
  92      */
  93     private static boolean useGDITextLayout = true;
  94     private static boolean preferGDITextLayout = false;
  95     static {
  96         String textLayoutStr =
  97             java.security.AccessController.doPrivileged(
  98                    new sun.security.action.GetPropertyAction(
  99                          "sun.java2d.print.enableGDITextLayout"));
 100 
 101         if (textLayoutStr != null) {
 102             useGDITextLayout = Boolean.getBoolean(textLayoutStr);
 103             if (!useGDITextLayout) {
 104                 if (textLayoutStr.equalsIgnoreCase("prefer")) {
 105                     useGDITextLayout = true;
 106                     preferGDITextLayout = true;
 107                 }
 108             }
 109         }
 110     }
 111 
 112     WPathGraphics(Graphics2D graphics, PrinterJob printerJob,
 113                   Printable painter, PageFormat pageFormat, int pageIndex,
 114                   boolean canRedraw) {
 115         super(graphics, printerJob, painter, pageFormat, pageIndex, canRedraw);
 116     }
 117