Embedded font rendering works good


I just wanted to share my test results of JUCE embedded font rendering on Windows and Mac.

While trying the new embedded font rendering support in JUCE the results were different on Windows and Mac. So I made a few screenshots of JUCE text rendering and put them side by side. On the Mac I added a Texteditor Screenshot, on windows one from Word to get the default text rendering look.

The results look good. For each plattform text rendering is consistent when compared to the text rendering of Word / Texteditor.

Between the plattforms there is are differences. On the Mac text rendering of a regular font looks much bolder than on Windows. It seems to get a consistent look between plattforms for an App on Windows a semi-bold font style should be used.

Attached are the screenshots. The font used was Open Sans Regular.


Hi Patrick - that's interesting, but Word in Win 7 usually looks better than that. Have you tuned ClearType?

I've attached an example of what it looks like for me on Win 8. As you can see it looks a bit heavier, but it still has that distinctive Windows look.


PS - Jules recent tweaks to font rendering seem to be improving things, but it hasn't quite convinved me to dump FreeType yet :)


Kerning is different on Windows between Word and Juce.

On Mac you have one pixel of difference in height with the upper blur in TextEditor, kerning differences as well.


Yes, ClearType is enabled.

It may be possible you are seeing a difference on your machine because all my screenshots use a text color of #DDDDDD instead of pure white.


The semi-bold variant on Windows. Looks pretty close to the default Mac text rendering to me.



Your picture helps illustrate the way that Windows rendering is a horrible over-hinted distortion that loses all the subtle details in the original typeface, and the way OSX does it is by far the best in terms of aesthetics and typographic correctness given the available pixels.

I've always tried to emulate the OSX rendering in juce, which is why one of the only things that ever makes me really angry on the forum are the constant stream of posts about how juce's rendering is more "blurry" than the piss-poor job that Windows does.

FYI I added some cunning vertical hinting code last week, which does a pretty good approximation to the Mac vertical hinting in terms of sharpening the tops and bottoms of letters. Considering it's about 100 lines of code compared to FreeTypes huge many-thousand-lines-of-spaghetti auto-hinter (which IMHO over-hints anyway), I'm really pleased with the results!

The last thing I need to do (probably very soon) is to add some LCD sub-pixel rendering, which isn't too difficult, and which should make it pretty much identical to OSX rendering for anyone without a microscope. After that, if anyone else tries criticising the rendering for being "blurry", my reply will be short and unsuitable for children.


I'd love to see sub-pixel rendering in JUCE. I tried doing it myself but couldn't pull it off!


JUCE embedded font support allowed me to drop Freetype already. As illustrated in the screenshot the text rendering quality is good. I am sure LCD sub-pixel rendering would make it stellar! Looking forward to it.


Ah that might be it.

BTW I didn't mean did you have ClearType enabled, but have you run the ClearType tuner to optimise it? I tune it to look a bit heavier than the default.


Oh, I see. No I did not not run the ClearType tuner. Actually I did not know it existed until you mentioned it ;-)


Here's a side by side comparison of JUCE (day old tip) vs FreeType with Open Sans Regular.

As you can see FreeType makes things a little larger but nevertheless looks clearer at small sizes. Just a matter of taste perhaps :)


Nice screenshot! We need to revisit this thread when Jules has implemented LCD sub-pixel rendering.

Maybe I am getting old but I find those very small font sizes unpleasant to read regardless if JUCE or Freetype renders them :-)

Looking at your screenshot my prefered font sizes are usually >=16 pixels (rendered by JUCE) or >=14 pixels (rendered by Freetype). It may be this is because the development of websites is a large part of my job and web designs seem move to bigger, sometimes huge fonts.


Here's an old article from AGG which sums up all about the traps one can easily fall into when trying to render fonts:



here's an excerpt:

It really IS possible to find a reasonable solution. But first of all, you have to agree that there is no way to use any kind of hinting for absolutely exact text layout representation with any zoom factor, period. Only unhinted text, with its natural blurriness. However, we can improve it and we have something to sacrifice. Namely, we can afford some inaccuracy in the vertical positioning and the text height. After all, the TrueType hinting works in the very same way: the lines of text with, say, 12, and 13 pixels nominal heights have exactly the same pixel heights, but still look differently.

So, in short words, for the nice looking text with accurate horizontal positioning we need the following.

Use horizontal RGB sub-pixel anti-aliasing for LCD flat panels.
Use vertical hinting only and completely discard the horizontal one.
Use accurate glyph advance values, calculated at a high resolution for unhinted glyphs.
Use accurate, high resolution values from the kerning table.


OSX font rendering is by far the best available from an Operating System vendor, but AGG or Adobe's renderer are even better.

Looking forward for the upcoming sub pixel renderer.




Yes, me too. The only caveat is that sub-pixel rendering is dependent on the order of pixels on the actual physical screen (i.e. not the screen buffer), so if a screen has order BGR but the sub-pixel rendering assumes RGB, it will look shitty (https://www.grc.com/ctWhat.htm).


Yes - this'll only be possible if there's a way to find out the LCD colour order from the OS (which I'm kind of assuming must be possible, but haven't researched it yet)


Btw, Jules, since I've been one of those complaining about font rendering ;) With the latest tip, I must say you've done a great job!