www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DlangUI print too small on retina screens

reply Joel <joelcnz gmail.com> writes:
I got a new computer (another MacBook Pro, but this one has 
retina display), now I don't think I can use my main programs 
(done in DlangUI), without eye strain and having my head close to 
the screen.

I noticed a lot of forked versions of the said library. Do any 
have a fix for the tiny print, if so, which one is good?

Thanks in advance.
Apr 12
parent reply evilrat <evilrat666 gmail.com> writes:
On Friday, 12 April 2019 at 08:39:52 UTC, Joel wrote:
 I got a new computer (another MacBook Pro, but this one has 
 retina display), now I don't think I can use my main programs 
 (done in DlangUI), without eye strain and having my head close 
 to the screen.

 I noticed a lot of forked versions of the said library. Do any 
 have a fix for the tiny print, if so, which one is good?

 Thanks in advance.
It should detect DPI for you, and internally do the scaling. Though I don't know if it works at all. In case it is not yet implemented try this function[1](overrideScreenDPI from dlangui.core.types) before creating your widgets in UI main function, at the very last resort you can just change the values in that file as well and rebuild (that's what I did for my crappy projects and it was working on Windows). [1]https://github.com/buggins/dlangui/blob/d942853bcd458f563ee3c855332ab58c1f1e5faa/src/dlangui/core/types.d#L317
Apr 12
parent reply Joel <joelcnz gmail.com> writes:
On Saturday, 13 April 2019 at 02:35:59 UTC, evilrat wrote:
 On Friday, 12 April 2019 at 08:39:52 UTC, Joel wrote:
 [...]
It should detect DPI for you, and internally do the scaling. Though I don't know if it works at all. In case it is not yet implemented try this function[1](overrideScreenDPI from dlangui.core.types) before creating your widgets in UI main function, at the very last resort you can just change the values in that file as well and rebuild (that's what I did for my crappy projects and it was working on Windows). [1]https://github.com/buggins/dlangui/blob/d942853bcd458f563ee3c855332ab58c1f1e5faa/src/dlangui/core/types.d#L317
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.
Apr 13
parent reply evilrat <evilrat666 gmail.com> writes:
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
Apr 13
parent Joel <joelcnz gmail.com> writes:
On Sunday, 14 April 2019 at 02:12:28 UTC, evilrat wrote:
 On Saturday, 13 April 2019 at 12:00:30 UTC, Joel wrote:
 [...]
option 1 - using override DPI function: ------------------- [...]
Thanks, option 1 pretty much worked - though overrideScreenDPI didn't compile with float type (int type worked though).
Apr 13