Instead of having lots of duplicate code for drawing text to overlays and the background, move all of the actual drawing logic to a generic routine that can be used to draw text to *any* type of framebuffer.