Getting name of system font with NSFontMBS

How do I get “San Francisco” as font name when getting the system font name? The following code

[quote] dim FontSize as Double = NSFontMBS.systemFontSize
dim theFont as NSFontMBS = NSFontMBS.systemFontOfSize(FontSize)
dim FontName as String = theFont.familyName[/quote]

has .AppleSystemUIFont as result, which is kind of ugly. Or can I assume that a font name starting with a . is the system font? But then I’d have to track what the system font is for each version of Mac OS.

That may be a special placeholder for the font name.

Could you explain in more detail what you mean?

The systemFont function doesn’t tell you the real name of the font.
just a placeholder.

https://forum.xojo.com/21829-detecting-the-actual-system-font-on-osx/0
https://forum.xojo.com/20977-system-font-in-textarea/0

FWIW the system fonts are placed on my 10.11.4 system in /System/Library/Fonts

SFNSText-BoldItalic.otf SFNSText-BoldItalicG1.otf SFNSText-BoldItalicG2.otf SFNSText-BoldItalicG3.otf SFNSText-HeavyItalic.otf SFNSText-Light.otf SFNSText-LightItalic.otf SFNSText-Medium.otf SFNSText-MediumItalic.otf SFNSText-Regular.otf SFNSText-RegularG1.otf SFNSText-RegularG2.otf SFNSText-RegularG3.otf SFNSText-RegularItalic.otf SFNSText-RegularItalicG1.otf SFNSText-RegularItalicG2.otf SFNSText-RegularItalicG3.otf SFNSText-Semibold.otf SFNSText-SemiboldItalic.otf Apple Color Emoji.ttf SFNSText-Bold.otf SFNSText-BoldG1.otf SFNSText-BoldG2.otf SFNSText-BoldG3.otf SFNSText-Heavy.otf ??????????? W8.ttc ??????? ProN W3.ttc ??????? ProN W6.ttc ??????????? W3.ttc ??????????? W6.ttc PingFang.ttc AquaKana.ttc ??????????? W0.ttc ??????????? W1.ttc ??????????? W2.ttc ??????????? W4.ttc ??????????? W5.ttc ??????????? W7.ttc ??????????? W9.ttc Apple Braille Outline 6 Dot.ttf Apple Braille Outline 8 Dot.ttf Apple Braille Pinpoint 6 Dot.ttf Apple Braille Pinpoint 8 Dot.ttf Apple Braille.ttf Apple Symbols.ttc Avenir Next Condensed.ttc Avenir Next.ttc Avenir.ttc GeezaPro.ttc HelveLTMM Noteworthy.ttc Optima.ttc Palatino.ttc SFNSDisplay-Black.otf SFNSDisplay-Bold.otf SFNSDisplay-Heavy.otf SFNSDisplay-Light.otf SFNSDisplay-Medium.otf SFNSDisplay-Regular.otf SFNSDisplay-Semibold.otf SFNSDisplay-Thin.otf SFNSDisplay-Ultralight.otf Symbol.ttf Times.dfont TimesLTMM ZapfDingbats.ttf Courier.dfont Geneva.dfont Helvetica.dfont HelveticaNeue.dfont HelveticaNeueDeskInterface.ttc Keyboard.ttf LastResort.ttf LucidaGrande.ttc MarkerFelt.ttc Menlo.ttc Monaco.dfont Hiragino Sans GB W3.ttc Hiragino Sans GB W6.ttc STHeiti Light.ttc STHeiti Medium.ttc STHeiti Thin.ttc STHeiti UltraLight.ttc AppleSDGothicNeo.ttc ArialHB.ttc Thonburi.ttc Kohinoor.ttc KohinoorBangla.ttc KohinoorTelugu.ttc

@Michel: My workaround with “.HelveticaNeue Deskinterface” doesn’t work anymore.

I am not surprised. As far as I know System Font Regular under 10.11.4 is San Francisco, not Helvetica Neue.

Note that System Font Regular exists in the system, and can even be displayed by Xojo with that name. It is in
/System/Library/Fonts/SFNSDisplay-Regular.otf
It furiously looks like San Francisco : same design (to the detail of characters), almost same spacing, the baseline slightly differs.

This is correct, the system font name may or may not return a displayable font name.

It was a huge feature at WWDC 2015, there was even an entire talk on the new system font. The designers are obviously very proud of it.

[quote=255705:@Sam Rowlands]@Michel Bujardet I am not surprised. As far as I know System Font Regular under 10.11.4 is San Francisco, not Helvetica Neue.
It was a huge feature at WWDC 2015, there was even an entire talk on the new system font. The designers are obviously very proud of it.[/quote]
… and it was such a dreadful decision. Jonathan Ive is megalomaniac. Rose gold. Flat UI. Constant nudging. Smart Battery Case. He is going to ruin Apple.

The displayname property may help.

System fonts design with 72 dpi screens are constrained by the poor rendition of curves and obliques. As a result, the fonts that best rendered were kind of angular.

It seems both Segoe UI on Windows and San Francisco (which look strangely similar) have been made possible by HiDPI.