Disabling font Anti-Aliasing in a Text in SwiftUI

Hi,

I'm using one ttf font that simulate a bitmap look in my app. However, macOS renders all font with anti-aliasing. On those kind of font, that introduce some artefacts.

Is there a way to disable anti-aliasing or some tricks that would make like there were no anti-aliasing?

Thanks.

Answered by DTS Engineer in 851039022

Even if you were able to turn off font anti-aliasing, say, using something like CGContext's setShouldAntialias(_:) method, modern displays have such fine resolution you most likely would not achieve the blocky text appearance you have described. A custom font may be a simpler solution in this case.

Even if you were able to turn off font anti-aliasing, say, using something like CGContext's setShouldAntialias(_:) method, modern displays have such fine resolution you most likely would not achieve the blocky text appearance you have described. A custom font may be a simpler solution in this case.

I really don’t appreciate answers along the lines of “Why would you want to do this? You don't need it.” That kind of response is exactly why people are increasingly turning to AI tools for help — because they aim to assist without being dismissive or patronizing.

I asked the question because I do notice a difference. I’m currently using a bitmap-style font from this site: https://int10h.org/oldschool-pc-fonts/fontlist. They provide real bitmap fonts, but macOS doesn’t support them natively, so I'm forced to use outline versions instead. Creating a custom font won't help in this case — it won't behave differently regarding anti-aliasing.

Here’s the context:

I’m developing a music app for macOS that simulates the look of old audio equipment — specifically the monochrome dot matrix LCDs and VFDs.

The font is rendered at a specific size such that each ‘fake bitmap pixel’ maps to a 3×3 block of screen pixels. I then apply a mask so that only the 4 top-left pixels of each block are visible, mimicking the glowing dots with spacing.

The issue is that anti-aliasing causes a visual bleed between these ‘dots’, which breaks the illusion. It's subtle, yes — but definitely noticeable, especially when you’re going for pixel-precision. I'm a perfectionist, and this kind of detail matters for the effect I'm trying to achieve.

So, if it’s simply not possible to disable anti-aliasing for font rendering in this context, that’s fine — I can accept that. But I'd much rather get a straightforward “no” than an explanation of why I shouldn't want to do it in the first place.

Thanks.

N.B.: I've provided two screenshots of the same text:

Rendered in TextEdit:

Rendered in my app:

I just realized that you didn't understand my first request at the first place. I already wrote in my initial question that I already used custom font that simulates the bitmap look.

The problem is that they are also being anti-aliased (there's no reason they shouldn't) and it introduced artefact on those kind of font.

I was so disappointed at your patronizing answer that I thought you had understood my question and were referring to the anti-aliasing artifacts when you said they wouldn't be visible on high screen resolution

You assumed I wanted to make a bitmap look by using ANY font and removing the anti-alias.

So your answer is even worse because you proudly marked it yourself as the recommended solution while it was what I was doing at the first place... I just needed an improvement to it since the anti-aliasing introduced artifacts on those blocky fonts.


Anyway, that's not even relevant because I don't even need to explain WHY I need the anti-alias. It is not for anyone else to decide. Regardless of why I want to disable it, the technical question should stand on its own.

The question was “Can we disable anti-alias on fonts ?”.

The answer should have been “There's unfortunately no way or trick to remove the anti-aliasing on fonts”. Not the patronizing “Removing the anti-alias is not useful to you”.


I explained the reason why I wanted to disable the anti-alias because I wanted to avoid useless answers asking me “why” I wanted it. What I got in return was even worse.

I really didn't expect this kind of answer from an Apple Engineer on their official forums...

Anyway, I waste my time. I don't expect any other response for you after you dropped “your recommended solution”.

Thank you for your explanation. I am sorry about any confusion.

There is no way to disable antialiasing for fonts at this time. Though, as I have pointed out what exactly that means on modern displays is somewhat unclear since screen resolution has changed since the days of 72 dot per inch displays and though most drawing operations are still measured using that scale in floating point units, the actual resolution of the drawn results is much finer on modern displays.

If you'd like us to consider adding the ability to disable font anti-aliasing, please file an enhancement request using the Feedback Assistant. If you file the request, please post the Feedback number here so we can make sure it gets routed to the right team.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Disabling font Anti-Aliasing in a Text in SwiftUI
 
 
Q