Thanks for the information! On 09.01.2017 at 17:33 Ken Thomases wrote:
> On Jan 9, 2017, at 10:13 AM, Andreas Falkenhahn <[email protected]> > wrote: > I'm building some windows and controls in my app by manually > creating NSWindow objects and the respective controls and then > adding them to the NSWindow by using > [[win contentView] addSubview:control]; > The control and window sizes and their positions are all hard-coded > in pixels. > You may have thought they were specified in pixels, but that's not > correct. All of the APIs for sizing windows, views, controls, etc. > take sizes and positions in "points". These are NOT typographic > points (~1/72") which you may be familiar with. These are an > abstract unit not necessarily related to real-world dimensions (such as > inches) nor pixels. > You can think of the size of a point as being chosen by the user > (indirectly via System Preferences > Displays) such that 12-point > text is comfortable to read at the typical screen distance. > Thus, it is assumed that the UI font size stays the > same. > Fonts are measured in the same point coordinate system, so that's > kind of reasonable to assume _except_ that Apple has changed the > system UI font on repeated occasions. They try to keep the metrics > pretty close, but it's just not possible to keep it exact, given their goals > in changing the font. > Now I was wondering how such code will behave on Retina Macs? > Will it mess up completely because I use hard-coded position > and size values but the font on Retina Mac is bigger? > Because you work in abstract points, there's no problem with Retina > displays. Your windows, views, controls, etc. will remain at a > comfortable/sensible size, they'll just have finer detail. The main > area of concern is bitmap images. If you don't provide @2x versions > of your images, they may get scaled up in terms of pixels to > maintain their size in points. That will result in chunky images. > I don't > have a Retina Mac here so can somebody explain (or point me to > some documents) how to write code that scales nicely on Retina > Macs? > https://developer.apple.com/high-resolution/ > https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Introduction/Introduction.html > I'm familiar with Retina development on iOS. On iOS, position and > size on Retina and Non-Retina devices are basically the same. > To solve the problem of higher resolutions, there is a scale > coefficient that can be queried by looking into "UIScreen.scale". > This way apps written for non-Retina devices normally just work > on Retina devices. Do Retina Macs use a similar implementation? > More or less, yes. > Is there any way to test if my app runs nicely on a Retina Mac > without actually having a Retina Mac? > Yes, you can use Quartz Debug to enable high-resolution display > modes. These basically cause Cocoa to see your screen as half its > normal dimensions (in terms of points). So, your app will display > visually huge but with the finer detail that Retina enables. You > should just imagine that your screen is a small Retina display that you're > standing too close to. ;) > https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Testing/Testing.html#//apple_ref/doc/uid/TP40012302-CH6-SW2 > Regards, > Ken > -- Best regards, Andreas Falkenhahn mailto:[email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
