Low Level C - Display text, pixel by pixel

I am working on a small project where I need to write a low level application. I would like to display text in this application, and I would even like it to be smoothed (à la ClearType). No libraries allowed, I have to draw every pixel char in pixels.

What is the best way to do this? Can you recommend some famous algorithms? How to store / read fonts?

Thank!

+2
source share
4 answers

Do you want to just smooth the edges of an existing bitmap font? This is easy if your source font is 16x32 and you want to display it at 8x16 or something like that, but if you don't have a higher-resolution bitmap, anti-aliasing is a very non-trivial operation that involves a lot of guesswork. In this case, I would look for an algorithm 2xsai(which gives visually nice results for this kind of thing) and first execute it to increase the font size to double resolution, and then scale it back using the area averaging algorithm (i.e. take each destination pixel from the average value of a 4-pixel square).

I would also recommend saving your final “smoothed” bitmap font and just using it in your program, rather than doing all this work at runtime.

+3

:

:

1) : , . Anti Aliasing ( ). , .

2) True Type: . , ( !). Anti-Aliasing ( ).

, ? , .

., BW . , , . , , BW ( ).

EDIT: , , . .

+2

, . :

, , FreeType, .

0

, TTF ( ) , , . , , , . , . , , -, , , ,...

, , - - , ; , .

My advice is to take FreeType and live with it, it is a good library for this, and can be statically linked and free from unnecessary bloating very easily.

0
source

All Articles