Algorithm for drawing bitmap-style font into display buffer with C -
for 8-bit embedded system has small monochrome lcd black/white pixels (not grayscale), need efficient way of storing , displaying fonts. choose 2 fixed-width fonts, 4x5 pixels , 5x7 pixels. resources limited: 30k rom, 2k ram. fonts written buffer 1:1 scale, one-line string given start offset in pixels (char* str, byte x, byte y)
i think use 1k of ram buffer. unless there's more efficient structure writing fonts to, have arranged can written sequentially lcd, follows:
byte buffer[1024];
where each byte represents horizontal line of 8 pixels (msb on left), , each line of display completed left right, , in fashion, top bottom. (so each line represented (128px / 8 =) 16 bytes.)
so question:
- how should fonts stored?
- what form should buffer take?
- how should fonts written buffer?
i presume there standard algorithms this, can't find in searches. suggestions helpful (i don't expect code me!!)
thanks
as first cut, implement bit blit, primitive many uses, including drawing characters. dictates following answers questions.
- as bitmaps.
- a bitmap.
- bit blit.
the implementation of bit blit involves bunch of bitwise operations repeatedly extracting byte or combination of 2 partial bytes source bitmap combined destination byte.
Comments
Post a Comment