Text drawing in embedded system
-
-
Hi. I want to develop in an embedded system. It's OS dos not support any graphic API and functions except SetPixel for developer. I need to use some standard font for text drawing. If you have any idea to do that, please share with me. Thanks very much.
You'll have to write your own routines for drawing text. The way this was done back in the day was to create a fixed-size font (usually consisting of 8x8 monochrome pixels, so each character would take 8 bytes to describe), and a simple look-up algorithm (in this case something like "base address of font + character code * 8). If you have to work pixel by pixel, I'd start with writing a routine to draw a row of 8 pixels, and use that to draw the whole character. There are some classic old fonts to look at here: http://damieng.com/blog/2011/02/20/typography-in-8-bits-system-fonts[^] You'd have to convert them to your own format, but that's reasonably trivial. If you take the first (PET), resize it so that there's one real pixel per used pixel, and save the image as a monochrome (2-bit) bitmap, you can read it out from there.
-
You'll have to write your own routines for drawing text. The way this was done back in the day was to create a fixed-size font (usually consisting of 8x8 monochrome pixels, so each character would take 8 bytes to describe), and a simple look-up algorithm (in this case something like "base address of font + character code * 8). If you have to work pixel by pixel, I'd start with writing a routine to draw a row of 8 pixels, and use that to draw the whole character. There are some classic old fonts to look at here: http://damieng.com/blog/2011/02/20/typography-in-8-bits-system-fonts[^] You'd have to convert them to your own format, but that's reasonably trivial. If you take the first (PET), resize it so that there's one real pixel per used pixel, and save the image as a monochrome (2-bit) bitmap, you can read it out from there.