ui icon indicating copy to clipboard operation
ui copied to clipboard

High DPI support on macOS .app bundles requires extra Info.plist metadata (command-line launching Just Works, apparently)

Open tmaiaroto opened this issue 10 years ago • 14 comments

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?

tmaiaroto avatar Dec 15 '14 17:12 tmaiaroto

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

tmaiaroto avatar Dec 15 '14 18:12 tmaiaroto

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?

andlabs avatar Dec 15 '14 18:12 andlabs

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"

tmaiaroto avatar Dec 15 '14 18:12 tmaiaroto

update: I don't see anything either in Interface Builder or in the docs about customizing window titlebar fonts

andlabs avatar Dec 15 '14 23:12 andlabs

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 ?

tmaiaroto avatar Dec 16 '14 00:12 tmaiaroto

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? screen shot 2014-12-27 at 20 02 06

landaire avatar Dec 28 '14 04:12 landaire

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.

tmaiaroto avatar Dec 28 '14 05:12 tmaiaroto

Can you provide a picture similar to @landaire's? Being on the same page can help.

andlabs avatar Jan 03 '15 06:01 andlabs

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.

tmaiaroto avatar Jan 04 '15 19:01 tmaiaroto

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.

test

alaingilbert avatar Mar 07 '18 23:03 alaingilbert

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

alaingilbert avatar Mar 07 '18 23:03 alaingilbert

That will need to be noted somewhere then... (Keep open for now.)

andlabs avatar Mar 08 '18 05:03 andlabs

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).

andlabs avatar Mar 27 '18 13:03 andlabs

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.

oimyounis avatar May 01 '20 22:05 oimyounis