Licensing the San Francisco fonts for API reference pages for Swift projects

The San Francisco Mono font is one of the best monospace coding fonts out there, and it is closely associated with the Swift language today, similar to Fira Mono in the Rust community. Today, the Fira font family is an important resource for the Rust community, and many Rust projects use it in their API documentation websites, which helps provide a common visual language for Rust users.

While I don’t expect Apple to open-source the San Francisco fonts, I wonder if it would be possible for a limited license exemption to be carved out to allow maintainers of Swift projects to serve this font on API documentation websites?

29 Likes

For now, you could probably use ui-monospace with fallbacks.

1 Like

yes that seems like the most common approach today, but that causes the API reference sites to look different across different platforms, as opposed to the standard library docs. this thread is about serving the San Francisco fonts as a web font.

SF Mono is only used by Xcode and its documentation.

If the standard library docs were also available on Swift​.​org, they would probably use Menlo on macOS, as below:

  • The book uses font-family: Menlo, monospace;

  • The blog uses font-family: "SF Mono", Menlo, Consolas, Monaco, "Courier New", monospace, serif; — but without @font-face declarations for SF Mono.

  • These forums use font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace;

6 Likes

I gather this isn’t quite what you had in mind... but there’s a new DocC tool if you’re looking for Apple-style documentation:

https://developer.apple.com/documentation/Xcode/documenting-a-swift-framework-or-package

1 Like

is this available on linux?

2 Likes

We’ll be open sourcing DocC as part of the Swift project (see the Meet DocC documentation in Xcode session we just posted). As part of that, we hope to bring DocC to additional platforms as well!

23 Likes

:tada::tada::tada: This is fantastic news and no doubt will be a great boon to the ecosystem.

6 Likes

…and to think i wasted the last two months writing the exact same tool with the exact same feature set, all the way down to the aside-block syntax :/

5 Likes