static void gl_raster_font_render_msg(void *data, const char *msg,
      const void *userdata)
{
   GLfloat x, y, scale, drop_mod;
   GLfloat color[4], color_dark[4];
   int drop_x, drop_y;
   bool full_screen;
   enum text_alignment text_align;
   gl_t *gl = NULL;
   gl_raster_t *font = (gl_raster_t*)data;
   settings_t *settings = config_get_ptr();
   const struct font_params *params = (const struct font_params*)userdata;

   if (!font)
      return;

   gl = font->gl;

   if (params)
   {
      x           = params->x;
      y           = params->y;
      scale       = params->scale;
      full_screen = params->full_screen;
      text_align  = params->text_align;
      drop_x      = params->drop_x;
      drop_y      = params->drop_y;
      drop_mod    = params->drop_mod;

      color[0]    = FONT_COLOR_GET_RED(params->color) / 255.0f;
      color[1]    = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
      color[2]    = FONT_COLOR_GET_BLUE(params->color) / 255.0f;
      color[3]    = FONT_COLOR_GET_ALPHA(params->color) / 255.0f;

      /* If alpha is 0.0f, turn it into default 1.0f */
      if (color[3] <= 0.0f)
         color[3] = 1.0f;
   }
   else
   {
      x           = settings->video.msg_pos_x;
      y           = settings->video.msg_pos_y;
      scale       = 1.0f;
      full_screen = false;
      text_align  = TEXT_ALIGN_LEFT;

      color[0]    = settings->video.msg_color_r;
      color[1]    = settings->video.msg_color_g;
      color[2]    = settings->video.msg_color_b;
      color[3] = 1.0f;

      drop_x = -2;
      drop_y = -2;
      drop_mod = 0.3f;
   }

   if (font->block)
      font->block->fullscreen = full_screen;
   else
      gl_raster_font_setup_viewport(font, full_screen);

   if (drop_x || drop_y)
   {
      color_dark[0] = color[0] * drop_mod;
      color_dark[1] = color[1] * drop_mod;
      color_dark[2] = color[2] * drop_mod;
      color_dark[3] = color[3];

      gl_raster_font_render_message(font, msg, scale, color_dark,
            x + scale * drop_x / gl->vp.width, y + 
            scale * drop_y / gl->vp.height, text_align);
   }

   gl_raster_font_render_message(font, msg, scale, color, x, y, text_align);

   if (!font->block)
      gl_raster_font_restore_viewport(gl);
}
static void gl_raster_font_render_msg(
      video_frame_info_t *video_info,
      void *data, const char *msg,
      const void *userdata)
{
   GLfloat x, y, scale, drop_mod, drop_alpha;
   GLfloat color[4], color_dark[4];
   int drop_x, drop_y;
   enum text_alignment text_align   = TEXT_ALIGN_LEFT;
   bool full_screen                 = false ;
   gl_t                         *gl = NULL;
   gl_raster_t                *font = (gl_raster_t*)data;
   unsigned width                   = video_info->width;
   unsigned height                  = video_info->height;
   const struct font_params *params = (const struct font_params*)userdata;

   if (!font || string_is_empty(msg))
      return;

   gl = font->gl;

   if (!gl)
      return;

   if (params)
   {
      x           = params->x;
      y           = params->y;
      scale       = params->scale;
      full_screen = params->full_screen;
      text_align  = params->text_align;
      drop_x      = params->drop_x;
      drop_y      = params->drop_y;
      drop_mod    = params->drop_mod;
      drop_alpha  = params->drop_alpha;

      color[0]    = FONT_COLOR_GET_RED(params->color) / 255.0f;
      color[1]    = FONT_COLOR_GET_GREEN(params->color) / 255.0f;
      color[2]    = FONT_COLOR_GET_BLUE(params->color) / 255.0f;
      color[3]    = FONT_COLOR_GET_ALPHA(params->color) / 255.0f;

      /* If alpha is 0.0f, turn it into default 1.0f */
      if (color[3] <= 0.0f)
         color[3] = 1.0f;
   }
   else
   {
      x                    = video_info->font_msg_pos_x;
      y                    = video_info->font_msg_pos_y;
      scale                = 1.0f;
      full_screen          = true;
      text_align           = TEXT_ALIGN_LEFT;

      color[0]             = video_info->font_msg_color_r;
      color[1]             = video_info->font_msg_color_g;
      color[2]             = video_info->font_msg_color_b;
      color[3]             = 1.0f;

      drop_x               = -2;
      drop_y               = -2;
      drop_mod             = 0.3f;
      drop_alpha           = 1.0f;
   }

   if (font && font->block)
      font->block->fullscreen = full_screen;
   else
      gl_raster_font_setup_viewport(width, height, font, full_screen);

   if (drop_x || drop_y)
   {
      color_dark[0] = color[0] * drop_mod;
      color_dark[1] = color[1] * drop_mod;
      color_dark[2] = color[2] * drop_mod;
      color_dark[3] = color[3] * drop_alpha;

      if (font && !string_is_empty(msg) && font->gl && font->font_data && font->font_driver)
         gl_raster_font_render_message(font, msg, scale, color_dark,
               x + scale * drop_x / gl->vp.width, y +
               scale * drop_y / gl->vp.height, text_align);
   }

   if (font && !string_is_empty(msg) && font->gl && font->font_data && font->font_driver)
      gl_raster_font_render_message(font, msg, scale, color, x, y, text_align);

   if (!font->block)
      gl_raster_font_restore_viewport(width, height, gl, false);
}