title: Algorithm for drawing bitmap-style font into display buffer with C
body: <p>For an 8-bit embedded system that has a small monochrome LCD with black/white pixels (not grayscale), I need an efficient way of storing and displaying fonts. I will probably choose two fixed-width fonts, 4x5 pixels and 5x7 pixels. The resources are very limited: 30k ROM, 2k RAM. The fonts will be written to the buffer with a 1:1 scale, as a one-line string with a given start offset in pixels <code>(char* str, byte x, byte y)</code></p>
  
  <p>I think I would use 1k of RAM for the buffer. Unless there's a more efficient structure for writing the fonts to, I would have it arranged so it can be written sequentially into the LCD, which would be as follows:</p>
  
  <pre><code>byte buffer[1024];
  </code></pre>
  
  <p>Where each byte represents a horizontal line of 8 pixels (MSB on the left), and each line of the display is completed from left to right, and in that fashion, top to bottom. (So each line is represented by (128px / 8 =) 16 bytes.)</p>
  
  <p>So my question: </p>
  
  <ol>
  <li>How should the fonts be stored?</li>
  <li>What form should the buffer take?</li>
  <li>How should the fonts be written to the buffer?</li>
  </ol>
  
  <p>I presume there are some standard algorithms for this, but I can't find anything in searches. Any suggestions would be very helpful (I don't expect anyone to code this for me!!)</p>
  
  <p>Thanks</p>