Fixed issue 127 : program path under unix was stored relative when launching the program with "./grafx2" in the dev directory, so font loading failed when changing directory (loading a pic, for example).
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@727 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
15e11b7144
commit
385a99d1f6
4
io.c
4
io.c
@ -194,9 +194,9 @@ void Extract_filename(char *dest, const char *source)
|
||||
// Récupère la partie "répertoire+/" d'un chemin.
|
||||
void Extract_path(char *dest, const char *source)
|
||||
{
|
||||
char * position;
|
||||
char * position=NULL;
|
||||
|
||||
strcpy(dest,source);
|
||||
realpath(source,dest);
|
||||
position = Find_last_slash(dest);
|
||||
if (position)
|
||||
*(position+1) = '\0';
|
||||
|
||||
7
text.c
7
text.c
@ -55,6 +55,7 @@
|
||||
#include "global.h"
|
||||
#include "sdlscreen.h"
|
||||
#include "io.h"
|
||||
#include "errors.h"
|
||||
|
||||
typedef struct T_Font
|
||||
{
|
||||
@ -459,10 +460,14 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
// Chargement de la fonte
|
||||
Surface_fonte=IMG_Load(Font_name(font_number));
|
||||
if (!Surface_fonte)
|
||||
{
|
||||
DEBUG("Font loading failed",0);
|
||||
return NULL;
|
||||
}
|
||||
font=SFont_InitFont(Surface_fonte);
|
||||
if (!font)
|
||||
{
|
||||
DEBUG("Font init failed",1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -475,6 +480,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
SFont_Write(TexteColore, font, 0, 0, str);
|
||||
if (!TexteColore)
|
||||
{
|
||||
DEBUG("Rendering failed",2);
|
||||
SFont_FreeFont(font);
|
||||
return NULL;
|
||||
}
|
||||
@ -485,6 +491,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh
|
||||
new_brush=Surface_to_bytefield(Texte8Bit, NULL);
|
||||
if (!new_brush)
|
||||
{
|
||||
DEBUG("Converting failed",3);
|
||||
SDL_FreeSurface(TexteColore);
|
||||
SDL_FreeSurface(Texte8Bit);
|
||||
SFont_FreeFont(font);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user