ScriptUI for InDesign CC still has serious problems with HiDPI monitors in Windows. Your typical settings—if you don't want to use a magnifying glass while navigating InDesign's submenus—probably look like this:

Typical 4K display settings in Windows10.

UI Scaling Preferences (InDesign CC.)

In short, a 1.5X factor is applied at some point in order to fit the screen coordinate space. The question is, does this factor come into play upstream, or downstream, relative to ScriptUI measurements? For example, when we set the preferredSize of a widget to [300,200], or read its windowBounds properties, are the dimensions and locations already upscaled (in actual screen coordinates), or should we talk to ScriptUI in some agnostic, internal coordinate language?

And the full, although nebulous, answer is:

    This Depends On Which Property You Are Setting Or Reading!

Indeed, ScriptUI sometimes speaks its own language (regarding size and location properties of inner elements), and sometimes it outputs and/or expects SCREEN coordinates (mainly for Window metrics.) Even worse, it may mix the two languages in a single object. For example, we found that the windowBounds property of a component blends ScriptUI dimensions (.width and .height attributes) and screen dimensions (.left and .top attributes.)

Note. — As a result, windowBounds.right and windowBounds.bottom are purely irrelevant since they are automatically computed by adding the (width,height) dimensions to the (left,top) location!

Tests and report

We found these interesting results by benchmarking coordinates from the below script:

The below figure recaps my findings. (ScriptUI coordinates are in yellow, screen coordinates in white.)

Inconsistencies of ScriptUI coordinates in a 150% UI Scaling environment. (InDesign CC/Win10)

Note. — The reported issues are CC specific. In InDesign CS6, for example, all measurements are consistent and reflect internal ScriptUI coordinates.

How to Detect the Scaling Factor

The good thing is that we can exploit the bias that corrupts ScriptUI CC coordinates to determine the actual UI scaling factor (1.5 along X- and Y- axes) applied to the display:

This routine has solved critical issues with complex UI components that required fine-tuned coordinate adjustments. It is now in use in IdExtenso.