[Pkg-sdl-commits] r49 - unstable/sdl-ttf1.2/debian/patches

Aurelien Jarno aurel32 at costa.debian.org
Mon Apr 10 18:51:52 UTC 2006


Author: aurel32
Date: 2006-04-10 18:51:52 +0000 (Mon, 10 Apr 2006)
New Revision: 49

Added:
   unstable/sdl-ttf1.2/debian/patches/autotools.diff
   unstable/sdl-ttf1.2/debian/patches/series
   unstable/sdl-ttf1.2/debian/patches/unicode.diff
Log:
Add patches that were in the .diff.gz



Added: unstable/sdl-ttf1.2/debian/patches/autotools.diff
===================================================================
--- unstable/sdl-ttf1.2/debian/patches/autotools.diff	2006-04-10 18:47:37 UTC (rev 48)
+++ unstable/sdl-ttf1.2/debian/patches/autotools.diff	2006-04-10 18:51:52 UTC (rev 49)
@@ -0,0 +1,56 @@
+--- sdl-ttf1.2-1.2.2.orig/Makefile.am
++++ sdl-ttf1.2-1.2.2/Makefile.am
+@@ -16,11 +16,11 @@
+ libSDL_ttf_la_LDFLAGS = 		\
+         -release $(LT_RELEASE)	\
+ 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+-libSDL_ttf_la_LIBADD = 
++libSDL_ttf_la_LIBADD = @SDL_LIBS_FOR_LIBS@
+ 
+ bin_PROGRAMS = showfont
+ 
+-showfont_LDADD = libSDL_ttf.la
++showfont_LDADD = libSDL_ttf.la @SDL_LIBS@
+ 
+ # Rule to build tar-gzipped distribution package
+ $(PACKAGE)-$(VERSION).tar.gz: dist
+--- sdl-ttf1.2-1.2.2.orig/configure.in
++++ sdl-ttf1.2-1.2.2/configure.in
+@@ -45,10 +45,10 @@
+ 
+ dnl Check for tools
+ 
++AC_PROG_CC
+ AC_LIBTOOL_WIN32_DLL
+ AM_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
+-AC_PROG_CC
+ AC_PROG_INSTALL
+ 
+ dnl The alpha architecture needs special flags for binary portability
+@@ -64,13 +64,12 @@
+ esac
+ 
+ dnl Check for SDL
+-SDL_VERSION=1.0.1
++SDL_VERSION=1.2.0
+ AM_PATH_SDL($SDL_VERSION,
+             :,
+ 	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
+ )
+ CFLAGS="$CFLAGS $SDL_CFLAGS"
+-LIBS="$LIBS $SDL_LIBS"
+ 
+ dnl Check for the FreeType library
+ have_freetype=no
+@@ -85,6 +84,10 @@
+ ])
+ fi
+ 
++dnl Also link against SDL
++SDL_LIBS_FOR_LIBS=`sdl-config --libs`
++AC_SUBST(SDL_LIBS_FOR_LIBS)
++
+ # Finally create all the generated files
+ AC_OUTPUT([
+ Makefile

Added: unstable/sdl-ttf1.2/debian/patches/series
===================================================================
--- unstable/sdl-ttf1.2/debian/patches/series	2006-04-10 18:47:37 UTC (rev 48)
+++ unstable/sdl-ttf1.2/debian/patches/series	2006-04-10 18:51:52 UTC (rev 49)
@@ -0,0 +1,2 @@
+autotools.diff -p1
+unicode.diff -p1

Added: unstable/sdl-ttf1.2/debian/patches/unicode.diff
===================================================================
--- unstable/sdl-ttf1.2/debian/patches/unicode.diff	2006-04-10 18:47:37 UTC (rev 48)
+++ unstable/sdl-ttf1.2/debian/patches/unicode.diff	2006-04-10 18:51:52 UTC (rev 49)
@@ -0,0 +1,382 @@
+--- sdl-ttf1.2-1.2.2.orig/SDL_ttf.c
++++ sdl-ttf1.2-1.2.2/SDL_ttf.c
+@@ -12,11 +12,16 @@
+ #endif
+ 
+ #include "SDL.h"
++#include "SDL_endian.h"
+ #include "SDL_ttf.h"
+ 
+ /* Macro to convert a character to a Unicode value -- assume already Unicode */
+ #define UNICODE(c)	c
+ 
++/* ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) */
++#define UNICODE_BOM_NATIVE	0xFEFF
++#define UNICODE_BOM_SWAPPED	0xFFFE
++
+ /* Round a float up to the nearest integeter and return that integer */
+ static int round(float x)
+ {
+@@ -74,6 +79,37 @@
+ /* The FreeType font engine */
+ static TT_Engine engine;
+ 
++static int TTF_byteswapped = 0;
++
++/* UNICODE string utilities */
++static __inline__ int UNICODE_strlen(const Uint16 *text)
++{
++	int size = 0;
++	while ( *text++ ) {
++		++size;
++	}
++	return size;
++}
++
++static __inline__ void UNICODE_strcpy(Uint16 *dst, const Uint16 *src, int swap)
++{
++	if ( swap ) {
++		while ( *src ) {
++			*dst = SDL_Swap16(*src);
++			++src;
++			++dst;
++		}
++		*dst = '\0';
++	} else {
++		while ( *src ) {
++			*dst = *src;
++			++src;
++			++dst;
++		}
++		*dst = '\0';
++	}
++}
++
+ int TTF_Init(void)
+ {
+ 	int error;
+@@ -460,12 +496,13 @@
+ 
+ 	/* Copy the Latin-1 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return -1;
+ 	}
+-	ASCII_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	ASCII_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	status = TTF_SizeUNICODE(font, unicode_text, w, h);
+@@ -483,12 +520,13 @@
+ 
+ 	/* Copy the UTF-8 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return -1;
+ 	}
+-	UTF8_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	UTF8_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	status = TTF_SizeUNICODE(font, unicode_text, w, h);
+@@ -498,10 +536,12 @@
+ 	return status;
+ }
+ 
+-int TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h)
++int TTF_SizeUNICODE(TTF_Font *font, const Uint16 *_text, int *w, int *h)
+ {
+ 	int status;
+ 	const Uint16 *ch;
++	Uint16 *text;
++	int textlen;
+ 	int x, z, minx, maxx;
+ 	TT_Error error;
+ 
+@@ -509,6 +549,17 @@
+ 	status = 0;
+ 	minx = maxx = 0;
+ 
++	/* Perform any UNICODE endian conversions */
++	textlen = UNICODE_strlen(_text);
++	text = (Uint16 *)malloc((textlen + 1) * (sizeof *text));
++	if ( _text[0] == UNICODE_BOM_NATIVE ) {
++		UNICODE_strcpy(text, _text+1, 0);
++	} else if ( *_text == UNICODE_BOM_SWAPPED ) {
++		UNICODE_strcpy(text, _text+1, 1);
++	} else {
++		UNICODE_strcpy(text, _text, TTF_byteswapped);
++	}
++
+ 	/* Load each character and sum it's bounding box */
+ 	x= 0;
+ 	for ( ch=text; *ch; ++ch ) {
+@@ -540,6 +591,9 @@
+ 	if ( h ) {
+ 		*h = font->height;
+ 	}
++
++	/* Free the temporary string and return */
++	free (text);
+ 	return status;
+ }
+ 
+@@ -554,12 +608,13 @@
+ 
+ 	/* Copy the Latin-1 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	ASCII_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	ASCII_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Solid(font, unicode_text, fg);
+@@ -580,12 +635,13 @@
+ 
+ 	/* Copy the UTF-8 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	UTF8_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	UTF8_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Solid(font, unicode_text, fg);
+@@ -596,10 +652,12 @@
+ }
+ 
+ SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font,
+-				const Uint16 *text, SDL_Color fg)
++				const Uint16 *_text, SDL_Color fg)
+ {
+ 	int xstart, width;
+ 	int w, h;
++	Uint16 *text;
++	int textlen;
+ 	SDL_Surface *textbuf;
+ 	SDL_Palette *palette;
+ 	const Uint16 *ch;
+@@ -608,7 +666,7 @@
+ 	TT_Error error;
+ 
+ 	/* Get the dimensions of the text surface */
+-	if ( (TTF_SizeUNICODE(font, text, &w, &h) < 0) || !w ) {
++	if ( (TTF_SizeUNICODE(font, _text, &w, &h) < 0) || !w ) {
+ 		TTF_SetError("Text has zero width");
+ 		return(NULL);
+ 	}
+@@ -631,6 +689,17 @@
+ 	palette->colors[1].b = fg.b;
+ 	SDL_SetColorKey(textbuf, SDL_SRCCOLORKEY, 0);
+ 
++	/* Perform any UNICODE endian conversions */
++	textlen = UNICODE_strlen(_text);
++	text = (Uint16 *)malloc((textlen + 1) * (sizeof *text));
++	if ( *_text == UNICODE_BOM_NATIVE ) {
++		UNICODE_strcpy(text, _text+1, 0);
++	} else if ( *_text == UNICODE_BOM_SWAPPED ) {
++		UNICODE_strcpy(text, _text+1, 1);
++	} else {
++		UNICODE_strcpy(text, _text, TTF_byteswapped);
++	}
++
+ 	/* Load and render each character */
+ 	xstart = 0;
+ 	for ( ch=text; *ch; ++ch ) {
+@@ -678,6 +747,8 @@
+ 		memset((Uint8 *)textbuf->pixels+row_offset*textbuf->pitch,
+ 								1, width);
+ 	}
++
++	free(text);
+ 	return(textbuf);
+ }
+ 
+@@ -764,12 +835,13 @@
+ 
+ 	/* Copy the Latin-1 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	ASCII_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	ASCII_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Shaded(font, unicode_text, fg, bg);
+@@ -790,12 +862,13 @@
+ 
+ 	/* Copy the UTF-8 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	UTF8_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	UTF8_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Shaded(font, unicode_text, fg, bg);
+@@ -806,10 +879,12 @@
+ }
+ 
+ SDL_Surface *TTF_RenderUNICODE_Shaded(TTF_Font *font,
+-				const Uint16 *text, SDL_Color fg, SDL_Color bg)
++				const Uint16 *_text, SDL_Color fg, SDL_Color bg)
+ {
+ 	int xstart, width;
+ 	int w, h;
++	Uint16* text;
++	int textlen;
+ 	SDL_Surface *textbuf;
+ 	SDL_Palette *palette;
+ 	int index;
+@@ -820,7 +895,7 @@
+ 	TT_Error error;
+ 
+ 	/* Get the dimensions of the text surface */
+-	if ( (TTF_SizeUNICODE(font, text, &w, &h) < 0) || !w ) {
++	if ( (TTF_SizeUNICODE(font, _text, &w, &h) < 0) || !w ) {
+ 		TTF_SetError("Text has zero width");
+ 		return(NULL);
+ 	}
+@@ -848,6 +923,17 @@
+ 		palette->colors[index] = palette->colors[4];
+ 	}
+ 
++	/* Perform any UNICODE endian conversions */
++	textlen = UNICODE_strlen(_text);
++	text = (Uint16 *)malloc((textlen + 1) * (sizeof *text));
++	if ( *_text == UNICODE_BOM_NATIVE ) {
++		UNICODE_strcpy(text, _text+1, 0);
++	} else if ( *_text == UNICODE_BOM_SWAPPED ) {
++		UNICODE_strcpy(text, _text+1, 1);
++	} else {
++		UNICODE_strcpy(text, _text, TTF_byteswapped);
++	}
++
+ 	/* Load and render each character */
+ 	xstart = 0;
+ 	for ( ch=text; *ch; ++ch ) {
+@@ -883,6 +969,7 @@
+ 		memset((Uint8 *)textbuf->pixels+row_offset*textbuf->pitch,
+ 								4, width);
+ 	}
++	free(text);
+ 	return(textbuf);
+ }
+ 
+@@ -955,12 +1042,13 @@
+ 
+ 	/* Copy the Latin-1 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	ASCII_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	ASCII_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Blended(font, unicode_text, fg);
+@@ -981,12 +1069,13 @@
+ 
+ 	/* Copy the UTF-8 text to a UNICODE text buffer */
+ 	unicode_len = strlen(text);
+-	unicode_text = (Uint16 *)malloc((unicode_len+1)*(sizeof *unicode_text));
++	unicode_text = (Uint16 *)malloc((1+unicode_len+1)*(sizeof *unicode_text));
+ 	if ( unicode_text == NULL ) {
+ 		SDL_SetError("Out of memory");
+ 		return(NULL);
+ 	}
+-	UTF8_to_UNICODE(unicode_text, text, unicode_len);
++	unicode_text[0] = UNICODE_BOM_NATIVE;
++	UTF8_to_UNICODE(unicode_text+1, text, unicode_len);
+ 
+ 	/* Render the new text */
+ 	textbuf = TTF_RenderUNICODE_Blended(font, unicode_text, fg);
+@@ -997,10 +1086,12 @@
+ }
+ 
+ SDL_Surface *TTF_RenderUNICODE_Blended(TTF_Font *font,
+-				const Uint16 *text, SDL_Color fg)
++				const Uint16 *_text, SDL_Color fg)
+ {
+ 	int xstart, width;
+ 	int w, h;
++	Uint16 *text;
++	int textlen;
+ 	SDL_Surface *textbuf;
+ #if SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) >= \
+     SDL_VERSIONNUM(1, 1, 5)			/* The great alpha flip */
+@@ -1021,7 +1112,7 @@
+ 	TT_Error error;
+ 
+ 	/* Get the dimensions of the text surface */
+-	if ( (TTF_SizeUNICODE(font, text, &w, &h) < 0) || !w ) {
++	if ( (TTF_SizeUNICODE(font, _text, &w, &h) < 0) || !w ) {
+ 		TTF_SetError("Text has zero width");
+ 		return(NULL);
+ 	}
+@@ -1036,6 +1127,17 @@
+ 		return(NULL);
+ 	}
+ 
++	/* Perform any UNICODE endian conversions */
++	textlen = UNICODE_strlen(_text);
++	text = (Uint16 *)malloc((textlen + 1) * (sizeof *text));
++	if ( *_text == UNICODE_BOM_NATIVE ) {
++		UNICODE_strcpy(text, _text+1, 0);
++	} else if ( *_text == UNICODE_BOM_SWAPPED ) {
++		UNICODE_strcpy(text, _text+1, 1);
++	} else {
++	        UNICODE_strcpy(text, _text, TTF_byteswapped);
++	}
++
+ 	/* Load and render each character */
+ 	xstart = 0;
+ 	for ( ch=text; *ch; ++ch ) {
+@@ -1095,6 +1197,7 @@
+ 			++dst;
+ 		}
+ 	}
++	free(text);
+ 	return(textbuf);
+ }
+ 
+--- sdl-ttf1.2-1.2.2.orig/showfont.c
++++ sdl-ttf1.2-1.2.2/showfont.c
+@@ -262,3 +262,4 @@
+ 	TTF_CloseFont(font);
+ 	exit(0);
+ }
++




More information about the Pkg-sdl-commits mailing list