News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

ClearType Antialiasing

Started by jj2007, September 22, 2022, 07:49:42 PM

Previous topic - Next topic

jj2007

While trying to be helpful to a known Sudoku developer, I stumbled over this oddity called ClearType Antialiasing. It works, but attention... it does not what you expect.

Attached sources plus two executables:
- one sets antialiasing off, as shown to the left of the image
- the other one sets antialiasing on, as shown to the right

Note the following:
- SystemParametersInfo does not only provide infos, it can also set parameters (the name is misleading)
- if used as a setter, it affects the whole system (your Explorer and all your menus will look funny)
- the big fonts shown below don't care about the setting, absolutely no difference

The MakeFont macro used in the source uses CreateFontIndirect.
MakeFont hProof, Quality:PROOF_QUALITY, Height:-32, Weight:FW_SEMIBOLD
MakeFont hProofCT, Quality:CLEARTYPE_QUALITY, "Lucida Console"
MakeFont hTimes, "Times New Roman", Height:-24, Weight:FW_THIN
MakeFont hArial, "Arial", Underline:TRUE, Italic:0
MakeFont hRussian, Quality:0, Underline:FALSE, Italic:TRUE, Weight:FW_SEMIBOLD

NoCforMe

Very interesting, JJ. But what type of font is that sans serif one at the top? Is it TrueType? Maybe it's a type of font that can't be anti-aliased. (It looks suspiciously like Arial.)
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on September 22, 2022, 07:55:16 PM
Very interesting, JJ. But what type of font is that sans serif one at the top? Is it TrueType? Maybe it's a type of font that can't be anti-aliased. (It looks suspiciously like Arial.)

Very good question. It's what you get when you don't specify a type face like "Arial" or "Tahoma". As soon as you specify a type face, the anti-aliasing starts, except for "Terminal" (the default console font) or "System32". If you choose "System" without the 32, the font remains small, i.e. the size argument gets ignored. Mysteries of Windows :cool:

NoCforMe

Yes, somewhat a mystery. I do know that there are types of fonts (bitmap ones, f'rinstance) that cannot be antialiased. So far as I know, all TrueType fonts can be.

Looking at my installed fonts, there are only 3 types: raster (bitmap), TrueType and OpenType. Not sure what that last type is.

I'm pretty sure System and System32 are just bits of ancient history left over "for compatibility reasons", so not much of a mystery there. Legacy stuff.
Assembly language programming should be fun. That's why I do it.

hutch--

That is the deal, the difference between vector and bitmap fonts. I personally like the ancient FIXEDSYS font but with the last few versions of Windows, Consolas works fine and is clear enough. Even Windows tends to use Segoe UI for many things so the ancient bmp fonts are just legacy products.

TimoVJL

Quote from: NoCforMe on September 23, 2022, 07:31:28 AM
I do know that there are types of fonts (bitmap ones, f'rinstance) that cannot be antialiased. So far as I know, all TrueType fonts can be.
Anti-Aliasing image improvement technique works for bitmaps, also raster fonts belongs that group ?
May the source be with you

NoCforMe

Raster fonts are bitmap fonts, by definition. And I don't believe that; how can you antialias a bitmap font?

Hutch: I've come to like Segoe very much. It's much more readable, and just plain pleasant, than any of the previous Microsoft-official fonts. They chose well, I think.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: jj2007 on September 22, 2022, 10:22:38 PMAs soon as you specify a type face, the anti-aliasing starts, except for "Terminal" (the default console font) or "System32". If you choose "System" without the 32, the font remains small, i.e. the size argument gets ignored.

Same for FixedSys (remains small, no anti-aliasing) and FixedSys32 (honours size arguments, has aa).

If a font does not exist, Windows tries to match the request with a similar one. Apparently, System and FixedSys don't have a match.