On Tue, 28 Feb 2023 18:20:50 GMT, Alexander Scherbatiy <[email protected]> wrote:
>> A printed content is truncated on macOS if the content paper size width >> larger than height with portrait orientation or width is less than height >> with landscape orientation. >> >> To reproduce the issue run the >> [CutOffImage](https://bugs.openjdk.org/secure/attachment/101145/CutOffImage.java) >> sample on MacOS. >> >> Four rectangles are printed: >> 1. size 300x100, portrait orientation >> 2. size 300x100, landscape orientation >> 3. size 100x300, portrait orientation >> 4. size 100x300, landscape orientation >> >> The first and fourth rectangles are truncated: [cut off >> content](https://bugs.openjdk.org/secure/attachment/101153/before-fix-all.pdf) >> >> The reason is that NSPrintInfo class does not allow to set paper size and >> orientation independently. >> Setting paper size width large than height changes NSPrintInfo orientation >> to landscape. >> Setting paper size width less than height changes NSPrintInfo orientation to >> portrait. >> Updating NSPrintInfo orientation from landscape to portrait or from portrait >> to landscape swaps NSPrintInfo paper width and height. >> >> The Cocoa code that shows NSPrintInfo behavior: >> >> #import <Cocoa/Cocoa.h> >> >> int main() >> { >> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; >> NSApp = [NSApplication sharedApplication]; >> >> #ifdef __MAC_10_9 // code for SDK 10.9 or newer >> #define NS_PORTRAIT NSPaperOrientationPortrait >> #define NS_LANDSCAPE NSPaperOrientationLandscape >> #else // code for SDK 10.8 or older >> #define NS_PORTRAIT NSPortraitOrientation >> #define NS_LANDSCAPE NSLandscapeOrientation >> #endif >> >> printf("NS_PORTRAIT: %d\n", NS_PORTRAIT); >> printf("NS_LANDSCAPE: %d\n", NS_LANDSCAPE); >> >> printf("create default print info\n"); >> NSPrintInfo* defaultPrintInfo = [[NSPrintInfo sharedPrintInfo] copy]; >> NSSize size = [defaultPrintInfo paperSize]; >> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo >> orientation], size.width, size.height); >> >> printf("call setUpPrintOperationDefaultValues\n"); >> [defaultPrintInfo setUpPrintOperationDefaultValues]; >> size = [defaultPrintInfo paperSize]; >> printf("orientation: %d, paper size: [%f, %f]\n", [defaultPrintInfo >> orientation], size.width, size.height); >> >> double w = 300.0; >> double h = 100.0; >> printf("set size: [%f, %f]\n", w, h); >> [defaultPrintInfo setPaperSize:NSMakeSize(w, h)]; >> size = [defaultPrintInfo paperSize]; >> printf("orientation: %d, paper si... > > Alexander Scherbatiy has updated the pull request incrementally with one > additional commit since the last revision: > > Update check criteria in test instructions Fixed in Java 28 https://bugs.openjdk.org/browse/JDK-8041911 ------------- PR Comment: https://git.openjdk.org/jdk/pull/10808#issuecomment-6833083381
