Merge
This commit is contained in:
commit
aa8a574989
jdk/src
share
solaris/classes/sun/print
windows/native/sun/java2d/opengl
@ -339,6 +339,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
*/
|
||||
private static Properties mFontProps = null;
|
||||
|
||||
private static boolean isMac;
|
||||
|
||||
/* Class static initialiser block */
|
||||
static {
|
||||
//enable priviledges so initProps can access system properties,
|
||||
@ -347,6 +349,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
new java.security.PrivilegedAction() {
|
||||
public Object run() {
|
||||
mFontProps = initProps();
|
||||
String osName = System.getProperty("os.name");
|
||||
isMac = osName.startsWith("Mac");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -473,6 +477,12 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
PrintService pServ = getPrintService();
|
||||
if (pServ != null) {
|
||||
mDestination = pServ.getName();
|
||||
if (isMac) {
|
||||
PrintServiceAttributeSet psaSet = pServ.getAttributes() ;
|
||||
if (psaSet != null) {
|
||||
mDestination = psaSet.get(PrinterName.class).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -771,6 +781,12 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
PrintService pServ = getPrintService();
|
||||
if (pServ != null) {
|
||||
mDestination = pServ.getName();
|
||||
if (isMac) {
|
||||
PrintServiceAttributeSet psaSet = pServ.getAttributes();
|
||||
if (psaSet != null) {
|
||||
mDestination = psaSet.get(PrinterName.class).toString() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
PrinterSpooler spooler = new PrinterSpooler();
|
||||
java.security.AccessController.doPrivileged(spooler);
|
||||
|
@ -71,13 +71,17 @@ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage
|
||||
void initLCDGammaTables();
|
||||
|
||||
/* placeholder for extern variable */
|
||||
static int initialisedFontIDs = 0;
|
||||
FontManagerNativeIDs sunFontIDs;
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_font_SunFontManager_initIDs
|
||||
(JNIEnv *env, jclass cls) {
|
||||
static void initFontIDs(JNIEnv *env) {
|
||||
|
||||
jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
|
||||
jclass tmpClass;
|
||||
|
||||
if (initialisedFontIDs) {
|
||||
return;
|
||||
}
|
||||
tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
|
||||
sunFontIDs.ttReadBlockMID =
|
||||
(*env)->GetMethodID(env, tmpClass, "readBlock",
|
||||
"(Ljava/nio/ByteBuffer;II)I");
|
||||
@ -173,9 +177,20 @@ Java_sun_font_SunFontManager_initIDs
|
||||
(*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z");
|
||||
|
||||
initLCDGammaTables();
|
||||
|
||||
initialisedFontIDs = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs() {
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_font_SunFontManager_initIDs
|
||||
(JNIEnv *env, jclass cls) {
|
||||
|
||||
initFontIDs(env);
|
||||
}
|
||||
|
||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
|
||||
|
||||
initFontIDs(env);
|
||||
return sunFontIDs;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ typedef struct FontManagerNativeIDs {
|
||||
/* Note: we share variable in the context of fontmanager lib
|
||||
but we need access method to use it from separate rasterizer lib */
|
||||
extern FontManagerNativeIDs sunFontIDs;
|
||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs();
|
||||
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
||||
continue;
|
||||
}
|
||||
if ((defaultPrintService != null)
|
||||
&& printers[p].equals(defaultPrintService.getName())) {
|
||||
&& printers[p].equals(getPrinterDestName(defaultPrintService))) {
|
||||
printerList.add(defaultPrintService);
|
||||
defaultIndex = printerList.size() - 1;
|
||||
} else {
|
||||
@ -270,11 +270,12 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
||||
} else {
|
||||
int j;
|
||||
for (j=0; j<printServices.length; j++) {
|
||||
if ((printServices[j] != null) &&
|
||||
(printers[p].equals(printServices[j].getName()))) {
|
||||
printerList.add(printServices[j]);
|
||||
printServices[j] = null;
|
||||
break;
|
||||
if (printServices[j] != null) {
|
||||
if (printers[p].equals(getPrinterDestName(printServices[j]))) {
|
||||
printerList.add(printServices[j]);
|
||||
printServices[j] = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,6 +361,17 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the printer name compatible with the list of printers returned by
|
||||
* the system when we query default or all the available printers.
|
||||
*/
|
||||
private String getPrinterDestName(PrintService ps) {
|
||||
if (isMac()) {
|
||||
return ((IPPPrintService)ps).getDest();
|
||||
}
|
||||
return ps.getName();
|
||||
}
|
||||
|
||||
/* On a network with many (hundreds) of network printers, it
|
||||
* can save several seconds if you know all you want is a particular
|
||||
* printer, to ask for that printer rather than retrieving all printers.
|
||||
@ -369,10 +381,12 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
||||
if (name == null || name.equals("") || !checkPrinterName(name)) {
|
||||
return null;
|
||||
}
|
||||
/* check is all printers are already available */
|
||||
/* check if all printers are already available */
|
||||
if (printServices != null) {
|
||||
for (PrintService printService : printServices) {
|
||||
if (printService.getName().equals(name)) {
|
||||
PrinterName printerName =
|
||||
(PrinterName)printService.getAttribute(PrinterName.class);
|
||||
if (printerName.getValue().equals(name)) {
|
||||
return printService;
|
||||
}
|
||||
}
|
||||
@ -567,7 +581,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
||||
defaultPrintService = null;
|
||||
if (printServices != null) {
|
||||
for (int j=0; j<printServices.length; j++) {
|
||||
if (defaultPrinter.equals(printServices[j].getName())) {
|
||||
if (defaultPrinter.equals(getPrinterDestName(printServices[j]))) {
|
||||
defaultPrintService = printServices[j];
|
||||
break;
|
||||
}
|
||||
|
@ -67,14 +67,15 @@ Java_sun_java2d_opengl_WGLSurfaceData_initOps(JNIEnv *env, jobject wglsd,
|
||||
|
||||
J2dTraceLn(J2D_TRACE_INFO, "WGLSurfaceData_initOps");
|
||||
|
||||
if (oglsdo == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
|
||||
return;
|
||||
}
|
||||
if (wglsdo == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "creating native wgl ops");
|
||||
return;
|
||||
}
|
||||
if (oglsdo == NULL) {
|
||||
free(wglsdo);
|
||||
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
oglsdo->privOps = wglsdo;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user