Package: ceferino
Version: 0.97-8
Severity: minor

I've noticed that Ceferino does not always determine correctly whether
something will fit on the line, and that the text will touch the right
side of the screen.

This patch will ensure that the text is written to the screen with a
border of 20 pixels.
The measuring function and the printing function are now more
symmetrical.

Regards,
Roland Clobus

-- System Information:
Debian Release: 5.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

diff -r -u ../ceferino-0.97.8.orig/src/fuente2.cc ./src/fuente2.cc
--- ../ceferino-0.97.8.orig/src/fuente2.cc	2007-07-14 23:14:23.000000000 +0200
+++ ./src/fuente2.cc	2009-02-10 13:02:36.000000000 +0100
@@ -321,26 +321,27 @@
 void fuente2 :: alinear_inferior (int * x1, int * y1, char * cadena)
 {
 	int f = 0;
-	int c = 20;
+	int c = 0;
 	char * palabra = cadena;
-	char * offset;
-	int limite_w = 640;/*(modo_reducido)? 320: 640;*/
+	int limite_w = 640 - 2 * 20 + get_w (' ');/*(modo_reducido)? 320: 640;*/
 	int limite_h = 480;/*(modo_reducido)? 240: 480;*/
+	int width;
 
 	while (palabra)
 	{
-		if (c + ancho_palabra (palabra) > limite_w)
+		width = ancho_palabra (palabra) + get_w (' ');
+		if (c + width > limite_w || *palabra == '\n')
 		{
 			/* salta una linea */
-			c = ancho_palabra (palabra) + get_w (' ');
+			c = width;
 			f += get_h ();
 		}
 		else
 		{
-			c += ancho_palabra (palabra) + get_w (' ');
+			c += width;
 		}
 		
-		palabra = strstr (palabra, " ");
+		palabra = saltar_palabra (palabra);
 
 		if (palabra)
 		{
@@ -388,21 +388,23 @@
 void fuente2 :: imprimir_con_salto (SDL_Surface * dst, char * cadena, int x, \
 		int y, SDL_Rect *rect, int * nrect, bool transparente)
 {
-	int limite_w = 640;/*(modo_reducido)? 320: 640;*/
+	int limite_w = 640 - 2 * 20 + get_w (' ');/*(modo_reducido)? 320: 640;*/
 	char * palabra = cadena;
-	x = 20;
+	int width;
+	x = 0;
 
 	while (palabra)
 	{
-		if (x + ancho_palabra (palabra) > limite_w)
+		width = ancho_palabra (palabra) + get_w (' ');
+		if (x + width > limite_w)
 		{
-			x = 20;
+			x = 0;
 			y += get_h ();
 		}
 
-		imprimir_palabra (dst, palabra, x, y, rect, nrect,transparente);
+		imprimir_palabra (dst, palabra, 20 + x, y, rect, nrect,transparente);
 		
-		x += ancho_palabra (palabra) + get_w (' ');
+		x += width;
 
 		palabra = saltar_palabra (palabra);
 
@@ -410,7 +412,7 @@
 		{
 			if (palabra [0] == '\n')
 			{
-				x = 20;
+				x = 0;
 				y += get_h ();
 			}
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to