You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LOGPIXELSX and LOGPIXELSY are fixed at the startup of an application. If the primary monitor zoom is changed after the startup those value will still return the original values and can therefor lead to unwanted behavior with the monitor-specific scaling flag. There are only few usages left, that could lead to issues and we need to investigate whether their usage is fine or should be adapted. These places are:
In Device::getFontList, instead of int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY); we can atleast get the primary monitor and use its handle to obtain the new dpi value using OS.GetDpiForMonitor if changed.
Device::getFontList is used in a deprecated methods FontRegistry::bestData and bestDataArray whica re used to install fonts in preference store.
Other than that its used in font tests and GraphicsExample
Also used in TextEditor::getFontNames, but only the name of the FontData is utilized.
Except for the first time, its rather safe to leave it there. The only thing I will be concerned about is its usage in FontRegistry::bestData. Since it is completely specific to the application functionality, it can be safe to use Display.getCurrent or getDefault but since it is not null safe, I am a bit iffy. Another point is that even though, it has nothing to do with printer but its the code in Device and we do not want to make something specific to Display in Device Public API.
Conclusion: The best would be to leave it out like that there as it doesn't seem to be harmful. Or as a second choice we can replace int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY); with:
int [] dpiX = new int[1];
int [] dpiY = new int[1];
OS.GetDpiForMonitor(Display.getCurrent().getPrimaryMonitor().handle, OS.MDT_EFFECTIVE_DPI, dpiX, dpiY);
int logPixelsY = dpiY[0];
LOGPIXELSX and LOGPIXELSY are fixed at the startup of an application. If the primary monitor zoom is changed after the startup those value will still return the original values and can therefor lead to unwanted behavior with the monitor-specific scaling flag. There are only few usages left, that could lead to issues and we need to investigate whether their usage is fine or should be adapted. These places are:
The text was updated successfully, but these errors were encountered: