DlangUI print too small on retina screens

evilrat evilrat666 at gmail.com
Sun Apr 14 02:12:28 UTC 2019


On Saturday, 13 April 2019 at 12:00:30 UTC, Joel wrote:
>
> Thanks for the reply, but I looked it up, and couldn't work out 
> what I can do. I want to try using the overrideScreenDPI trick.

option 1 - using override DPI function:
-------------------

     // your average hello world UIAppMain()

     import dlangui;

     mixin APP_ENTRY_POINT;

     const SCALE_FACTOR = 2.0f;

     /// entry point for dlangui based application
     extern (C) int UIAppMain(string[] args) {

         // just in case, but dlangui package seems to import 
pretty much everything
         import dlangui.core.types;

         // pretty much self explanatory, where 96 DPI is "normal" 
100% zoom
         // alternatively you can set it to your screen real DPI 
or PPI or whatever it is called now
         // however for 4k with 144 DPI IIRC I set it to 1.25 
scale because 1.5 was too big and/or didn't match WPF/native 
elements
         overrideScreenDPI = 96f * SCALE_FACTOR;

         // now create your widgets and run main loop
         ...

     }


option 2 - temporal override in cached package code (dub only)
-------------------

     once you build your app go to dub temporary package cache,
     on windows it is %USERPROFILE%\AppData\Local\dub\packages
     on linux it is something like ~/dub/packages

     go to corresponding dlangui version folder and edit the file
     dlangui-###\dlangui\src\dlangui\core\types.d
     find PRIVATE_SCREEN_DPI and set it to something bigger that 
closer match your DPI or 96 multiplied by relative scaling
     save & rebuild your project


option 3 - clone and edit (dub or manual builds if you know what 
to do)
-------------------

     clone dlangui repo somewhere
     do steps from option 2 for PRIVATE_SCREEN_DPI
     (dub only) in your dub project change dlangui dependency to 
point to where you cloned it
     "dependencies": {
         "dlangui":  { "version" : "*", "path": 
"your_modifief_dlangui_somewhere" }
     },

     rebuild, done


More information about the Digitalmars-d-learn mailing list