Package: sdl-ttf2.0
Severity: normal
Version: 2.0.11-1

Dear Maintainer,

TTF_RenderGlyph_Shaded() is broken. I wrote a small program to reproduce
the bug. Please read the attachment for the program.

This bug has been reported to the upstream and there is a patch to fix
this bug. Please read
http://bugzilla.libsdl.org/show_bug.cgi?id=1433
I report it here just for easier tracking.

Yours Sincerely,
Paul Liu

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=ja_JP.utf8, LC_CTYPE=ja_JP.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libsdl-ttf2.0-0 depends on:
ii  libc6              2.13-26
ii  libfreetype6       2.4.8-1
ii  libsdl1.2debian    1.2.15-1
ii  multiarch-support  2.13-26
ii  zlib1g             1:1.2.6.dfsg-1

libsdl-ttf2.0-0 recommends no packages.

libsdl-ttf2.0-0 suggests no packages.

-- no debconf information

-- 
                                PaulLiu (劉穎駿)
E-mail: Ying-Chun Liu (PaulLiu) <[email protected]>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL_ttf.h>
#include <SDL.h>

/*
gcc -g -o test test.c `sdl-config --cflags` `sdl-config --libs` -lSDL_ttf
*/

int main() {
  SDL_Color fcolor={0xff, 0xff, 0xff}, bcolor={0, 0xff, 0};
  Uint16 text = 't';
  const char *text_str = "t";
  TTF_Font *font = NULL;
  SDL_Surface *tmp,*screenSurface;
  int running=1;
  SDL_Rect dstrect;
  SDL_Event event;

  if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO ) < 0 ){
    fprintf( stderr, "Couldn't initialize SDL: %s\n", SDL_GetError() );
    exit(-1);
  }
  if ( TTF_Init() < 0 ){
    fprintf( stderr, "Can't initialize SDL TTF\n");
    exit(-1);
  }

  screenSurface = SDL_SetVideoMode( 800,600,0,0);
  
  font = TTF_OpenFont ("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",30);
  if (!font) {
    printf("TTF_OpenFont: %s\n", TTF_GetError());
  }
  if (TTF_GlyphIsProvided(font,text)) {
    printf ("%s:%d Code %x is provided\n",__func__,__LINE__,text);
  }

  while (running) {
    while (SDL_PollEvent(&event)) {
      switch (event.type) {
      case SDL_QUIT:
        running=0;
        break;
      default:
        break;
      }
    }
    /* put a 't' character in (100,100) */
    tmp = TTF_RenderGlyph_Shaded( font, text, fcolor, bcolor );
    if (!tmp) {
      printf("%s:%d Error\n",__func__,__LINE__);
    }
    memset(&dstrect,0,sizeof(SDL_Rect));
    dstrect.x = 100;
    dstrect.y = 100;
    SDL_BlitSurface(tmp,NULL,screenSurface,&dstrect);
    SDL_FreeSurface(tmp);
    /* put a 't' character in (200,100) */
    tmp = TTF_RenderText_Shaded( font, text_str, fcolor, bcolor );
    if (!tmp) {
      printf("%s:%d Error\n",__func__,__LINE__);
    }
    memset(&dstrect,0,sizeof(SDL_Rect));
    dstrect.x = 200;
    dstrect.y = 100;
    SDL_BlitSurface(tmp,NULL,screenSurface,&dstrect);
    SDL_FreeSurface(tmp);
    SDL_UpdateRect(screenSurface,0,0,0,0);
    SDL_Delay(50);
  }
  return 0;
}

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to