My team rewrote Apple's TrueType hinting interpreter in Swift, ask me anything.

Last year, my team shipped a Swift rewrite of Apple's TrueType hinting interpreter. The new code is strictly memory safe, relentlessly tested, and faster than the C code it replaced.

This year, it is my pleasure to ship it for a second time, now as an open source package, and to share our experience on the Swift blog: https://www.swift.org/blog/migrating-truetype-hinting-to-swift/

Swift at Apple: Migrating the TrueType Hinting Interpreter

TrueType is a widely used vector font standard for rendering text in web pages, PDFs, operating systems, and applications. Familiar fonts like Helvetica, Garamond, and Monaco are all built on TrueType outlines. The format specifies a hinting interpreter intended to help outlines rasterize faithfully on low-resolution displays. Modern high-resolution displays enable beautiful typography from outlines alone, but TrueType fonts that need hinting to render legibly remain in use and we continue to support them. Font parsers process data from untrusted sources, making the TrueType hinting interpreter a security-critical attack surface. To make the format more resilient on Apple platforms, we rewrote its hinting interpreter from C to memory-safe Swift for the Fall 2025 releases. In addition to memory safety, we also improved performance: on average, our Swift interpreter runs 13% faster than the C interpreter it replaced. To accompany this post, we’ve also published the source code of the Swift TrueType hinting interpreter. We hope sharing our experience helps others doing similar work in Swift.

Swift.org
If this sounds fun to you, the SPEAR team is hiring. Engineering and management, junior to staff. https://xoxo.zone/@numist/116421360766436710
Scott Perry (@[email protected])

If this sounds fun to you, we are extremely hiring: https://jobs.apple.com/en-us/details/200592135-0836/platform-and-frameworks-software-engineer-sear?team=SFTWR Happy to have coffee about it with mutuals, and yes, it's in Cupertino. When I changed roles in 2024 my initial goal was just to find an office closer to my home in Oakland. This team is delivering high impact results with career-defining projects that is worth the (3 days a week) commute.

XOXO Zone
@numist Scott Perry Engineering And Radness?
@numist whoa, this is very cool; nice work!
@kyleve @numist yeah this is dope. excellent writeup as well!
@numist gah, the background flickering under the header as I scroll through the page is so distracting that I had trouble reading :(
@kepstin oh no, what browser/version are you using? might be worth filing an issue against https://github.com/swiftlang/swift-org-website
GitHub - swiftlang/swift-org-website: Swift.org website

Swift.org website. Contribute to swiftlang/swift-org-website development by creating an account on GitHub.

GitHub
@numist I'm using Firefox on Android. The background of the header bar keeps changing as I scroll depending on what's under it - I assume it's using some filters to try to do something similar to Apple's "liquid glass" effect, but it's distracting and unnecessary :(
@numist (for fall 2026 y? The blog says 2025 releases)
@numist ohh nvm I see now
@cbowns Yup! Sorry it took me so long to write about it.
@numist is that a reference to XKCD 221 I see with kFairDiceRoll in interpreter.swift?
@jmono Yup! That opcode was supposed to push a random number in a range bounded by a value popped from the stack, but due to a bug that's at least 25 years old it always returned the same value and I was afraid to fix it.