| Method from sun.awt.Win32GraphicsEnvironment Detail: |
protected FontConfiguration createFontConfiguration() {
return new WFontConfiguration(this);
}
|
public FontConfiguration createFontConfiguration(boolean preferLocaleFonts,
boolean preferPropFonts) {
return new WFontConfiguration(this, preferLocaleFonts,preferPropFonts);
}
|
protected static native void deRegisterFontWithPlatform(String fontName)
|
public void displayChanged() {
// getNumScreens() will return the correct current number of screens
GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
GraphicsDevice oldScreens[] = screens;
// go through the list of current devices and determine if they
// could be reused, or will have to be replaced
if (oldScreens != null) {
for (int i = 0; i < oldScreens.length; i++) {
if (!(screens[i] instanceof Win32GraphicsDevice)) {
// REMIND: can we ever have anything other than Win32GD?
assert (false) : oldScreens[i];
continue;
}
Win32GraphicsDevice gd = (Win32GraphicsDevice)oldScreens[i];
// devices may be invalidated from the native code when the
// display change happens (device add/removal also causes a
// display change)
if (!gd.isValid()) {
if (oldDevices == null) {
oldDevices =
new ArrayList< WeakReference< Win32GraphicsDevice > >();
}
oldDevices.add(new WeakReference< Win32GraphicsDevice >(gd));
} else if (i < newDevices.length) {
// reuse the device
newDevices[i] = gd;
}
}
oldScreens = null;
}
// create the new devices (those that weren't reused)
for (int i = 0; i < newDevices.length; i++) {
if (newDevices[i] == null) {
newDevices[i] = makeScreenDevice(i);
}
}
// install the new array of devices
// Note: no synchronization here, it doesn't matter if a thread gets
// a new or an old array this time around
screens = newDevices;
for (GraphicsDevice gd : screens) {
if (gd instanceof DisplayChangedListener) {
((DisplayChangedListener)gd).displayChanged();
}
}
// re-invalidate all old devices. It's needed because those in the list
// may become "invalid" again - if the current default device is removed,
// for example. Also, they need to be notified about display
// changes as well.
if (oldDevices != null) {
int defScreen = getDefaultScreen();
for (ListIterator< WeakReference< Win32GraphicsDevice > > it =
oldDevices.listIterator(); it.hasNext();)
{
Win32GraphicsDevice gd = it.next().get();
if (gd != null) {
gd.invalidate(defScreen);
gd.displayChanged();
} else {
// no more references to this device, remove it
it.remove();
}
}
}
// Reset the static GC for the (possibly new) default screen
WToolkit.resetGC();
// notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
// CachingSurfaceManagers) about the display change event
displayChanger.notifyListeners();
// note: do not call super.displayChanged, we've already done everything
}
|
protected native int getDefaultScreen()
|
public GraphicsDevice getDefaultScreenDevice() {
return getScreenDevices()[getDefaultScreen()];
}
|
protected native int getNumScreens()
|
public native int getXResolution()
Returns the number of pixels per logical inch along the screen width.
In a system with multiple display monitors, this value is the same for
all monitors. |
public native int getYResolution()
Returns the number of pixels per logical inch along the screen height.
In a system with multiple display monitors, this value is the same for
all monitors. |
public static void init() {
// Ensure awt is loaded already. Also, this forces static init
// of WToolkit and Toolkit, which we depend upon
WToolkit.loadLibraries();
// setup flags before initializing native layer
WindowsFlags.initFlags();
initDisplayWrapper();
eudcFontFileName = getEUDCFontFile();
// Install correct surface manager factory.
SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory());
}
Noop function that just acts as an entry point for someone to force
a static initialization of this class. |
public static void initDisplayWrapper() {
if (!displayInitialized) {
displayInitialized = true;
initDisplay();
}
}
|
protected GraphicsDevice makeScreenDevice(int screennum) {
return new Win32GraphicsDevice(screennum);
}
|
protected void registerFontFile(String fontFileName,
String[] nativeNames,
int fontRank,
boolean defer) {
// REMIND: case compare depends on platform
if (registeredFontFiles.contains(fontFileName)) {
return;
}
registeredFontFiles.add(fontFileName);
int fontFormat;
if (ttFilter.accept(null, fontFileName)) {
fontFormat = FontManager.FONTFORMAT_TRUETYPE;
} else if (t1Filter.accept(null, fontFileName)) {
fontFormat = FontManager.FONTFORMAT_TYPE1;
} else {
/* on windows we don't use/register native fonts */
return;
}
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
}
/* Look in the JRE font directory first.
* This is playing it safe as we would want to find fonts in the
* JRE font directory ahead of those in the system directory
*/
String tmpFontPath = jreFontDirName+File.pathSeparator+fontPath;
StringTokenizer parser = new StringTokenizer(tmpFontPath,
File.pathSeparator);
boolean found = false;
try {
while (!found && parser.hasMoreTokens()) {
String newPath = parser.nextToken();
boolean ujr = newPath.equals(jreFontDirName);
File theFile = new File(newPath, fontFileName);
if (theFile.canRead()) {
found = true;
String path = theFile.getAbsolutePath();
if (defer) {
FontManager.registerDeferredFont(fontFileName, path,
nativeNames,
fontFormat, ujr,
fontRank);
} else {
FontManager.registerFontFile(path, nativeNames,
fontFormat, ujr,
fontRank);
}
break;
}
}
} catch (NoSuchElementException e) {
System.err.println(e);
}
if (!found) {
addToMissingFontFileList(fontFileName);
}
}
|
protected static native void registerFontWithPlatform(String fontName)
|
public static void registerJREFontsForPrinting() {
final String pathName;
synchronized (Win32GraphicsEnvironment.class) {
GraphicsEnvironment.getLocalGraphicsEnvironment();
if (fontsForPrinting == null) {
return;
}
pathName = fontsForPrinting;
fontsForPrinting = null;
}
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
File f1 = new File(pathName);
String[] ls = f1.list(new TTFilter());
if (ls == null) {
return null;
}
for (int i=0; i < ls.length; i++ ) {
File fontFile = new File(f1, ls[i]);
registerFontWithPlatform(fontFile.getAbsolutePath());
}
return null;
}
});
}
|
protected void registerJREFontsWithPlatform(String pathName) {
fontsForPrinting = pathName;
}
|
protected boolean useAbsoluteFontFileNames() {
return false;
}
Whether registerFontFile expects absolute or relative
font file names. |