I have the following code:
on Catalina, it prints
When I build and run it on a Big Sur/Intel machine, it prints the same. When I build and run it on an Big Sur/M1 machine *without a deloyment target set, is also prints the same. but: if I build with a deployment target of 10.15 (*), I suddenly get:
Note that the height of the string is reported at 4 display points smaller than it should (also, the font name is shown as "gray" instead of black, but ok...)
If I actually draw, the font draws the same size (and proper black) — but all my metrics that calculate where and what to draw based on what size gives me are of course off, so everything goes wrong (e.g. I end up drawing lines too tight together)
What could going on here? is this "as designed" or am I missing something?
(* actually, it might be a bit more complicated than that. The above is with our own compiler, Elements, and repros consistently, when I switch the deployment target back and forth. Compiling the equivalent ObjC with Xcode 12.2 or 12.3 Beta, I always get the wrong value of 13, even if I drop the deployment target. And to make things more complicated, I have an Intel-only build of my app, migrated from my Catalina/Intel machine, that has the proper behavior even when run on Big Sur/M3, but the same app from our build system, also Catalina, shows the same wrong behavior. it's all very weird)
Code Block var codeFont := NSFont.fontWithName("SF Mono Regular") size(11); var attributes := new NSMutableDictionary<NSAttributedStringKey,id>(); attributes[NSFontAttributeName] := codeFont; attributes[NSForegroundColorAttributeName] := NSColor.blackColor;; var charSize := new NSAttributedString withString("Q") attributes(attributes).size; writeLn("attributes {0}", attributes); writeLn("codeFont {0}", codeFont); writeLn("charSize.height {0}", charSize.height);
on Catalina, it prints
Code Block attributes { NSColor = "NSCalibratedWhiteColorSpace 0 1"; NSFont = "\"SFMono-Regular 11.00 pt. P [] (0x14f73aa80) fobj=0x14f728120, spc=6.80\""; } codeFont "SFMono-Regular 11.00 pt. P [] (0x14f73aa80) fobj=0x14f728120, spc=6.80" charSize.height 17
When I build and run it on a Big Sur/Intel machine, it prints the same. When I build and run it on an Big Sur/M1 machine *without a deloyment target set, is also prints the same. but: if I build with a deployment target of 10.15 (*), I suddenly get:
Code Block attributes { NSColor = "Generic Gray Gamma 2.2 Profile colorspace 0 1"; NSFont = "\"SFMono-Regular 11.00 pt. P [] (0x142f26dc0) fobj=0x142f1fad0, spc=6.80\""; } codeFont "SFMono-Regular 11.00 pt. P [] (0x142f27500) fobj=0x142f1fad0, spc=6.80" charSize.height 13
Note that the height of the string is reported at 4 display points smaller than it should (also, the font name is shown as "gray" instead of black, but ok...)
If I actually draw, the font draws the same size (and proper black) — but all my metrics that calculate where and what to draw based on what size gives me are of course off, so everything goes wrong (e.g. I end up drawing lines too tight together)
What could going on here? is this "as designed" or am I missing something?
(* actually, it might be a bit more complicated than that. The above is with our own compiler, Elements, and repros consistently, when I switch the deployment target back and forth. Compiling the equivalent ObjC with Xcode 12.2 or 12.3 Beta, I always get the wrong value of 13, even if I drop the deployment target. And to make things more complicated, I have an Intel-only build of my app, migrated from my Catalina/Intel machine, that has the proper behavior even when run on Big Sur/M3, but the same app from our build system, also Catalina, shows the same wrong behavior. it's all very weird)