13
$\begingroup$

I'm facing a problem with the relative scale of fonts and controls in Mathematica. In version 14, the ScreenResolutionCompatibilityMode (in CTRL+SHIFT+O settings) option stopped affecting anything. In 13.3.1, setting it to True made most fonts in Mathematica the same size as in other applications and the operating system.

I have a 1920x1080 screen with a 120 Hz refresh rate, Windows 11, and Mathematica 14.0.

Version 13.3.1
Version 13.3.1

Version 14.0.0
Version 14.0.0

Another good way to show is that the scales of fonts and elements don't match each other in the autocompletion popup:

autocompletion

How do I customize the scale of fonts and controls?

$\endgroup$
15
  • 4
    $\begingroup$ I have this problem too. I've scaled everything to 75% because I don't like how everything got really big. But now the code in the documentation is tiny. $\endgroup$
    – flinty
    Commented Jan 12 at 10:23
  • 1
    $\begingroup$ @flinty yes, you are right. I'm even more frustrated by the fact that different elements have different scales - like the autocompletion window, for example $\endgroup$ Commented Jan 12 at 12:32
  • 1
    $\begingroup$ You might try to set DPI settings or compatibility mode in Windows, this feature arrived in Windows 7 and can help to deal with this issue. The settings can be applied individually to any app $\endgroup$ Commented Jan 16 at 9:53
  • 3
    $\begingroup$ @TaikiBessho yes, I currently have, but I still have a feeling of imperfection. I want the default settings to be the most well adjusted. Here I can see that almost any Windows user who installs the new version will find that they will have to adjust to the right scale for them $\endgroup$ Commented Feb 26 at 4:33
  • 2
    $\begingroup$ @TaikiBessho the global magnification does not affect the toolboxes, which are absurdly large. $\endgroup$
    – Anixx
    Commented Jun 5 at 18:12

1 Answer 1

3
$\begingroup$

This Winhawk mod solves the issue for Mathematica (kind of) but it also affects other programs:

// ==WindhawkMod==
// @id              setcustomdpi
// @name            Set custom DPI
// @description     Sets custom DPI resolution
// @version         1.0
// @author          anixx
// @github          https://github.com/Anixx
// @include         Mathematica.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
*/
// ==/WindhawkModReadme==

#include <windows.h>
#include <shellscalingapi.h>

typedef HRESULT (WINAPI *GetDpiForMonitor_t)(
  HMONITOR         hmonitor,
  MONITOR_DPI_TYPE dpiType,
  UINT             *dpiX,
  UINT             *dpiY
);

GetDpiForMonitor_t GetDpiForMonitor_Original;

HRESULT WINAPI GetDpiForMonitor_Hook(
  HMONITOR         hmonitor,
  MONITOR_DPI_TYPE dpiType,
  UINT             *dpiX,
  UINT             *dpiY
)
{
    HRESULT res = GetDpiForMonitor_Original(hmonitor,dpiType,dpiX,dpiY);
    *dpiX = 72;
    *dpiY = 72;
    return res;
}

BOOL Wh_ModInit(void)
{   
    HMODULE user32module = LoadLibrary(L"Shcore.dll");
    FARPROC GetDpiForMonitor = GetProcAddress(user32module, "GetDpiForMonitor");
    Wh_SetFunctionHook((void*)GetDpiForMonitor, (void*)GetDpiForMonitor_Hook, (void**)&GetDpiForMonitor_Original);

    return TRUE;
}

Another side effect, it also affects the scrollbars, status bar and titlebar.

If anyone knows a better way to fix this, you are welcome. I also tried to hook function GetDpiForSystem - Mathematica starts only with the returned DPI is 96 or 120 but not 72. I also tried GetSystemMetricsForDpi - this affects controls size but not the text or cell separators. I also tried other functions, they make no effect.

$\endgroup$
1
  • 3
    $\begingroup$ It is ridiculous that even in 14 developers just ignore such problem which is known at least for two years. Thank you so much for your efforts $\endgroup$ Commented Jul 2 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.