diff --git a/share/grafx2/skins/font_Classic.png b/share/grafx2/skins/font_Classic.png index 8db8d5fc..cdb07016 100644 Binary files a/share/grafx2/skins/font_Classic.png and b/share/grafx2/skins/font_Classic.png differ diff --git a/share/grafx2/skins/font_DPaint.png b/share/grafx2/skins/font_DPaint.png index c7c84745..f9e89c22 100644 Binary files a/share/grafx2/skins/font_DPaint.png and b/share/grafx2/skins/font_DPaint.png differ diff --git a/share/grafx2/skins/font_Fairlight.png b/share/grafx2/skins/font_Fairlight.png index 5d4f9818..f5ca8af9 100644 Binary files a/share/grafx2/skins/font_Fairlight.png and b/share/grafx2/skins/font_Fairlight.png differ diff --git a/share/grafx2/skins/font_Fun.png b/share/grafx2/skins/font_Fun.png index a1e36add..6d3b5667 100644 Binary files a/share/grafx2/skins/font_Fun.png and b/share/grafx2/skins/font_Fun.png differ diff --git a/share/grafx2/skins/font_Melon.png b/share/grafx2/skins/font_Melon.png index efa4d4f0..7ae30253 100644 Binary files a/share/grafx2/skins/font_Melon.png and b/share/grafx2/skins/font_Melon.png differ diff --git a/share/grafx2/skins/font_Seen.png b/share/grafx2/skins/font_Seen.png index 8510a9a0..85f82d56 100644 Binary files a/share/grafx2/skins/font_Seen.png and b/share/grafx2/skins/font_Seen.png differ diff --git a/share/grafx2/skins/skin_Clax2.gif b/share/grafx2/skins/skin_Clax2.gif index 1e9cac8f..6247deca 100644 Binary files a/share/grafx2/skins/skin_Clax2.gif and b/share/grafx2/skins/skin_Clax2.gif differ diff --git a/share/grafx2/skins/skin_Clax3.gif b/share/grafx2/skins/skin_Clax3.gif index 98fe8257..3e7d2f5b 100644 Binary files a/share/grafx2/skins/skin_Clax3.gif and b/share/grafx2/skins/skin_Clax3.gif differ diff --git a/src/SFont.c b/src/SFont.c index cd44d850..23de8ce0 100644 --- a/src/SFont.c +++ b/src/SFont.c @@ -145,8 +145,13 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, srcrect.h = dstrect.h = Font->Surface->h - 1; for(c = text; *c != '\0' && x <= Surface->w ; c++) { + if (*c == '\n') { + dstrect.y += Font->Surface->h-1; + x=0; + continue; + } // skip spaces and nonprintable characters - if (*c == ' ' || Font->CharWidth[(int)*c]==0) { + else if (*c == ' ' || Font->CharWidth[(int)*c]==0) { x += Font->Space; continue; } @@ -166,13 +171,23 @@ int SFont_TextWidth(const SFont_Font *Font, const char *text) { const char* c; int width = 0; + int previous_width = 0; if(text == NULL) return 0; - for(c = text; *c != '\0'; c++) { + for(c = text; *c != '\0'; c++) + { + if (*c == '\n') + { + if (previous_widthCharWidth[(int)*c]==0) { + if (*c == ' ' || Font->CharWidth[(int)*c]==0) + { width += Font->Space; continue; } @@ -180,18 +195,30 @@ int SFont_TextWidth(const SFont_Font *Font, const char *text) width += Font->CharWidth[(int)*c]; } - return width; + return previous_widthSurface->h - 1; + // Count occurences of '\n' + int nb_cr=0; + while (*text!='\0') + { + if (*text=='\n') + nb_cr++; + text++; + } + + return (Font->Surface->h - 1) * (nb_cr+1); } +/* +// Do not use: Doesn't implement carriage returns + void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font, int y, const char *text) { SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2, y, text); } - +*/ diff --git a/src/SFont.h b/src/SFont.h index 71b694b7..446acf4e 100644 --- a/src/SFont.h +++ b/src/SFont.h @@ -87,7 +87,7 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y, /// Returns the width of "text" in pixels int SFont_TextWidth(const SFont_Font* Font, const char *text); /// Returns the height of "text" in pixels (which is always equal to Font->Surface->h) -int SFont_TextHeight(const SFont_Font* Font); +int SFont_TextHeight(const SFont_Font* Font, const char *text); /// Blits a string to Surface with centered x position void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y, diff --git a/src/keyboard.c b/src/keyboard.c index b459b83c..584d20fb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -601,6 +601,7 @@ word Keysym_to_ANSI(SDL_keysym keysym) #if !(defined(__macosx__) || defined(__FreeBSD__)) if ( keysym.unicode == 0) { + switch(keysym.sym) { case SDLK_DELETE: @@ -610,7 +611,11 @@ word Keysym_to_ANSI(SDL_keysym keysym) case SDLK_END: case SDLK_BACKSPACE: case KEY_ESC: + return keysym.sym; case SDLK_RETURN: + // Case alt-enter + if (SDL_GetModState() & (KMOD_ALT|KMOD_META)) + return '\n'; return keysym.sym; default: return 0; diff --git a/src/readline.c b/src/readline.c index ce153024..89ebc17a 100644 --- a/src/readline.c +++ b/src/readline.c @@ -509,7 +509,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz switch(input_type) { case INPUT_TYPE_STRING : - if (input_key>=' ' && input_key<= 255) + if ((input_key>=' ' && input_key<= 255)||input_key=='\n') is_authorized=1; break; case INPUT_TYPE_INTEGER : diff --git a/src/text.c b/src/text.c index d5c70fa8..42bf09c4 100644 --- a/src/text.c +++ b/src/text.c @@ -567,7 +567,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh } // Calcul des dimensions - *height=SFont_TextHeight(font); + *height=SFont_TextHeight(font, str); *width=SFont_TextWidth(font, str); // Allocation d'une surface SDL text_surface=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 8, 0, 0, 0, 0);