ui
ui copied to clipboard
High DPI support on macOS .app bundles requires extra Info.plist metadata (command-line launching Just Works, apparently)
Is this supported? Maybe it's just some option I need to pass? The application window bar titles contain blurry text. The text within the app is sharper, but not the best (maybe a font choice?). Can this be changed?
Something to do with this? https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/APIs/APIs.html#//apple_ref/doc/uid/TP40012302-CH5-SW1
Uhhh... I don't know how the standard Cocoa controls don't have sharp text by default :S All I'm doing is
[control setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSze:NSControlSizeRegular]]];
and I don't know how that isn't sufficient to get controls drawing correctly. As for windows, I'm not sure; probably also a missing NSFont assignment; will look into it. There are no other DPI-dependent calculations in package ui that I am ware of; control spacing is decided using pixels, but I don't know how that's different from what Interface Builder does already (and controls themselves provide their preferred sizes).
Is there something I'm missing to get the standard Cocoa controls to recognize high-DPI environments?
Area is different; I need to add a DPI()
method to get the current DPI used by the Area (or some other approach).
Does OS X require a "secret handshake" to enable high-DPI, like on Windows?
I'm not sure, I've been trying to search around a bit. It seems like there may be new APIs to use based on that link above. Though I'm new to all this so I just don't know and they don't make it super clear with a "this is how you used to do it, here's how you do it now"
update: I don't see anything either in Interface Builder or in the docs about customizing window titlebar fonts
K for fonts... but what about relative resolution? https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/APIs/APIs.html#//apple_ref/doc/uid/TP40012302-CH5-SW8
Would this be here? https://github.com/andlabs/ui/blob/master/window_darwin.m#L30
The NSWindow
using convertRectToScreen
? Then the backing store with convertRectToBacking
?
For what it's worth I just looked into this lib for the first time and the examples look fine or are you guys talking about something else?
For me things were blurry on Macbook Pro Retina machines due to the high resolution. I believe the way windows and sized and items positioned, there's an API to use that makes things relative to the display resolution (and supports retina). I'm just not familiar enough to figure it out, but I was looking through the code.
Can you provide a picture similar to @landaire's? Being on the same page can help.
Well this is really strange. It's no longer blurry for me when I'm testing now. I wonder if it was because I had an external monitor plugged in...Though I tried at home with a different external monitor and it was still sharp. This is strange. I'll take a screenshot and re-open later if I see it again I guess.
I still have this issue if I open the app with a launcher (.app)
The first image is when I open the binary normally.
The second one is when I open it through a .app
launcher.

Ok, I solved it by adding:
<key>NSHighResolutionCapable</key>
<string>True</string>
In my Info.plist
Solution from: https://apple.stackexchange.com/questions/69038/open-in-low-resolution-checkbox-on-retina-macbook-pro-checked-and-disabled
That will need to be noted somewhere then... (Keep open for now.)
I still need to get an external high-DPI monitor so I can test this myself (Quartz Debugger shows no simulated High DPI options for me).
Ok, I solved it by adding:
<key>NSHighResolutionCapable</key> <string>True</string>
In my
Info.plist
Solution from: https://apple.stackexchange.com/questions/69038/open-in-low-resolution-checkbox-on-retina-macbook-pro-checked-and-disabled
This worked for me perfectly.. Also if the app is already in the "Applications" folder, you will need to move it out of there and then move it back in.