Search code examples
jxbrowser

Is there a way to disable JxBrowser content scaling?


Background: I'm running JDK 1.8 on my native Java Swing app, and have JxBrowser 7.2 for my web app. I can't upgrade my JDK version because of other issues.

I read content-scaling is automatically applied. I wonder if there is a way to turn off this content-scaling since other components of my app does not support scaling based on environments' HiDPI display, and fonts look bad when user has scaled their system display.


Solution

  • Try configuring the engine with the --force-device-scale-factor=1 switch as show below:

    Engine engine = Engine.newInstance(
        EngineOptions.newBuilder(rendering_mode)
                .addSwitch("--force-device-scale-factor=1")
                .build());
    

    This option forces Chromium to use a fixed scale factor and doesn't read it dynamically according to the current location on screen.