home *** CD-ROM | disk | FTP | other *** search
- package sun.awt;
-
- import java.awt.GraphicsDevice;
- import java.awt.print.PrinterJob;
- import java.io.File;
- import java.util.NoSuchElementException;
- import java.util.StringTokenizer;
- import sun.awt.windows.WFontConfiguration;
- import sun.awt.windows.WPrinterJob;
- import sun.awt.windows.WToolkit;
- import sun.font.FontManager;
- import sun.java2d.SunGraphicsEnvironment;
- import sun.java2d.windows.WindowsFlags;
-
- public class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
- private static boolean displayInitialized;
- static String fontsForPrinting;
-
- public static void init() {
- }
-
- private static native void initDisplay();
-
- public static void initDisplayWrapper() {
- if (!displayInitialized) {
- displayInitialized = true;
- initDisplay();
- }
-
- }
-
- protected native int getNumScreens();
-
- protected native int getDefaultScreen();
-
- public GraphicsDevice getDefaultScreenDevice() {
- return this.getScreenDevices()[this.getDefaultScreen()];
- }
-
- public native int getXResolution();
-
- public native int getYResolution();
-
- public void displayChanged() {
- WToolkit.resetGC();
- super.displayChanged();
- }
-
- private static native String getEUDCFontFile();
-
- protected boolean useAbsoluteFontFileNames() {
- return false;
- }
-
- protected void registerFontFile(String var1, String[] var2, int var3, boolean var4) {
- if (!this.registeredFontFiles.contains(var1)) {
- this.registeredFontFiles.add(var1);
- byte var5;
- if (ttFilter.accept((File)null, var1)) {
- var5 = 0;
- } else {
- if (!t1Filter.accept((File)null, var1)) {
- return;
- }
-
- var5 = 1;
- }
-
- if (this.fontPath == null) {
- this.fontPath = this.getPlatformFontPath(noType1Font);
- }
-
- String var6 = jreFontDirName + File.pathSeparator + this.fontPath;
- StringTokenizer var7 = new StringTokenizer(var6, File.pathSeparator);
- boolean var8 = false;
-
- try {
- while(!var8 && var7.hasMoreTokens()) {
- String var9 = var7.nextToken();
- File var10 = new File(var9, var1);
- if (var10.canRead()) {
- var8 = true;
- String var11 = var10.getAbsolutePath();
- if (var4) {
- FontManager.registerDeferredFont(var1, var11, var2, var5, true, var3);
- } else {
- FontManager.registerFontFile(var11, var2, var5, true, var3);
- }
- break;
- }
- }
- } catch (NoSuchElementException var12) {
- System.err.println(var12);
- }
-
- if (!var8) {
- this.addToMissingFontFileList(var1);
- }
-
- }
- }
-
- protected void registerJREFontsWithPlatform(String var1) {
- fontsForPrinting = var1;
- }
-
- public static void registerJREFontsForPrinting() {
- Object var0 = null;
- String var6;
- synchronized(Win32GraphicsEnvironment.class) {
- if (fontsForPrinting == null) {
- return;
- }
-
- var6 = fontsForPrinting;
- fontsForPrinting = null;
- }
-
- File var7 = new File(var6);
- String[] var2 = var7.list(new SunGraphicsEnvironment.TTFilter());
- if (var2 != null) {
- for(int var3 = 0; var3 < var2.length; ++var3) {
- File var4 = new File(var7, var2[var3]);
- registerFontWithPlatform(var4.getAbsolutePath());
- }
-
- }
- }
-
- protected static native void registerFontWithPlatform(String var0);
-
- protected static native void deRegisterFontWithPlatform(String var0);
-
- protected GraphicsDevice makeScreenDevice(int var1) {
- return new Win32GraphicsDevice(var1);
- }
-
- public PrinterJob getPrinterJob() {
- SecurityManager var1 = System.getSecurityManager();
- if (var1 != null) {
- var1.checkPrintJobAccess();
- }
-
- return new WPrinterJob();
- }
-
- protected FontConfiguration createFontConfiguration() {
- return new WFontConfiguration(this);
- }
-
- public FontConfiguration createFontConfiguration(boolean var1, boolean var2) {
- return new WFontConfiguration(this, var1, var2);
- }
-
- static {
- WToolkit.loadLibraries();
- WindowsFlags.initFlags();
- initDisplayWrapper();
- eudcFontFileName = getEUDCFontFile();
- fontsForPrinting = null;
- }
- }
-