renderCharacters :: Int -> Int -> TextRenderer -> String -> IO ()
renderCharacters xpos ypos renderer strings = do
  GL.blend $= Enabled
  GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
  GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
  GL.depthFunc $= Nothing
  GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
  GL.clear [ColorBuffer]
  let font = textFont renderer
  foldM_
    (\(xp, yp) c ->
       case c of
         '\n' -> return (xpos, yp - fontHeight font)
         '\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
         _ ->
           maybe
             (return (xp, yp - fontAdvance font))
             (\c -> renderChar c xp yp font)
             (getCharacter font c))
    (xpos, ypos)
    strings
  where
    renderChar char xp yp f = do
      renderCharacterBGQuad renderer char xp yp f
      renderCharacterTextQuad renderer char xp yp f
renderCharacters :: Int -> Int -> TextRenderer -> String -> IO ()
renderCharacters xpos ypos renderer strings = do
  GL.blend $= Enabled
  GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
  GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
  GL.depthFunc $= Nothing
  GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
  GL.clear [ColorBuffer]
  let font = textFont renderer
  foldM_
    (\(xp, yp) c ->
       case c of
         '\n' -> return (xpos, yp - fontHeight font)
         '\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
         _ ->
           maybe
             (return (xp, yp - fontAdvance font))
             (\c -> renderChar c xp yp font)
             (getCharacter font c))
    (xpos, ypos)
    strings
  where
    renderChar char xp yp f = do
      renderCharacterBGQuad renderer char xp yp f
      renderCharacterTextQuad renderer char xp yp f
renderCharacters xpos ypos renderer strings = do
  GL.blend $= Enabled
  GL.blendEquationSeparate $= (FuncAdd, FuncAdd)
  GL.blendFuncSeparate $= ((SrcAlpha, OneMinusSrcAlpha), (One, Zero))
  GL.depthFunc $= Nothing
  GL.clearColor $= colToGLCol (Colour 0.0 0.0 0.0 0.0)
  GL.clear [ColorBuffer]
  let font = textFont renderer
  foldM_
    (\(xp, yp) c ->
       case c of
         '\n' -> return (xpos, yp - fontHeight font)
         '\t' -> renderCharacterSpace renderer (fontAdvance font) xp yp font
         _ ->
           maybe
             (return (xp, yp - fontAdvance font))
             (\c -> renderChar c xp yp font)
             (getCharacter font c))
    (xpos, ypos)
    strings
  where
    renderChar char xp yp f = do
      renderCharacterBGQuad renderer char xp yp f
      renderCharacterTextQuad renderer char xp yp f