title: Fastest way to draw characters in a console (framebuffer)?
body: <p>What would be the fastest way to render characters in a <strong>framebuffer</strong> based console? I'm using the <code>iso_font.h</code> font from the <strong>XNU</strong> distribution.</p>
  
  <p>Right now I'm using this code to render a character, but it doesn't seem to be too efficient:</p>
  
  <pre><code>px = px* ISO_CHAR_WIDTH;
  py = py* (ISO_CHAR_HEIGHT-1);
  
  for (int i = 0; i &lt; 15; i += 1) 
  {
      int sym = iso_font[c*16+i];
  
      int x = px;
      int y = py + i;
  
      for (int ii =0; ii &lt; 8; ii++) 
      {
          x+=1;
          if ((sym &amp; (1 &lt;&lt; ii)))
          {
              fb_set_px(x,y,fg);
          }
          else 
          {
              fb_set_px(x,y,bg);
          }
  
      }   
  }
  </code></pre>
  
  <p>And I'm also wondering if this code could be simpliefied:</p>
  
  <pre><code>void fb_set_px(x,y,hex){
      void*ptr = ((_base + (_bpr*y) + (_bpe*x)));
      unsigned int *p = (unsigned int *) ptr;
      *p=hex;
  }
  </code></pre>
  
  <p>It is decent up to the point where there are too many lines and I need to redraw the whole console (to scroll) at which point there is a significant delay.</p>