Search code examples
c++windowsgdiphotoshop

CreateFont API quality


So I'm trying to using CreateFont to try to create a font similar to the one I have in Photoshop, but if you look close the quality in Photoshop is a lot better.

Here's the code I'm using to create the font:

CreateFont(45, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
    CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_MODERN, __T("Times New Roman"));

And here is a comparison of the two fonts:
Fonts
As you can see the top one is much smoother.
Should I be using different arguments in CreateFont? I'll admit I don't completely understand them all. An explanation would be nice.


Solution

  • Photoshop uses its own antialiasing and applies it consistently.

    Windows only uses antialiasing on font sizes within certain limits, and it looks like your sample is outside the limits. Here's a quote from the CreateFont documentation (emphasis added):

    ANTIALIASED_QUALITY Font is antialiased, or smoothed, if the font supports it and the size of the font is not too small or too large.

    You might have better control in GDI+.