Apply patch from #305 and #525. Use FontConfig on linux to get true type fonts instead of

the X11 functions.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2050 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2013-02-02 08:45:33 +00:00
parent 1dce247656
commit 72d8f5a49d
3 changed files with 30 additions and 29 deletions

View File

@ -123,7 +123,7 @@ else
endif endif
# these are for everyone # these are for everyone
COPT = -D_DARWIN_C_SOURCE -D__macosx__ -D__linux__ -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g $(LUACOPT) $(SDLCOPT) $(TTFCOPT) -I/usr/X11/include COPT = -D_DARWIN_C_SOURCE -D__macosx__ -D__linux__ -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -std=c99 -c -g $(LUACOPT) $(SDLCOPT) $(TTFCOPT) -I/usr/include
ifdef MACOSX_LION ifdef MACOSX_LION
LOPT = $(SDLLOPT) $(LUALOPT) -framework libpng14 -lz LOPT = $(SDLLOPT) $(LUALOPT) -framework libpng14 -lz
else else
@ -134,7 +134,7 @@ endif
#CC = nccgen -ncgcc -ncld -ncfabs #CC = nccgen -ncgcc -ncld -ncfabs
OBJDIR = ../obj/macosx OBJDIR = ../obj/macosx
PLATFORMOBJ = $(OBJDIR)/SDLMain.o PLATFORMOBJ = $(OBJDIR)/SDLMain.o
X11LOPT = FCLOPT =
MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2 MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2
NOTTF = 1 NOTTF = 1
else else
@ -234,7 +234,7 @@ endif
COPT = -W -Wall -std=c99 -c -g -gstabs -D__TRU64__ $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT) COPT = -W -Wall -std=c99 -c -g -gstabs -D__TRU64__ $(shell sdl-config --cflags) $(TTFCOPT) $(LUACOPT)
LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) -lpng $(LUALOPT) -lm LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) -lpng $(LUALOPT) -lm
OBJDIR = ../obj/unix OBJDIR = ../obj/unix
X11LOPT = -lX11 FCLOPT = -lfontconfig
CC = gcc CC = gcc
else else
ifeq ($(PLATFORM),FreeMiNT) #10 ifeq ($(PLATFORM),FreeMiNT) #10
@ -253,7 +253,7 @@ endif
STRIP = strip -s STRIP = strip -s
STACK = stack STACK = stack
FIX_FLAGS = flags FIX_FLAGS = flags
X11LOPT = FCLOPT =
COPT = -W -Wall -m68020-60 -fomit-frame-pointer -std=c99 -Wdeclaration-after-statement -D__MINT__ -DNO_INLINE_MATH -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $(JOYCOPT) $(LUACOPT) COPT = -W -Wall -m68020-60 -fomit-frame-pointer -std=c99 -Wdeclaration-after-statement -D__MINT__ -DNO_INLINE_MATH -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $(JOYCOPT) $(LUACOPT)
LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) $(LAYERLOPT) LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) $(LAYERLOPT)
else else
@ -272,7 +272,7 @@ endif
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm
CC = gcc CC = gcc
OBJDIR = ../obj/syllable OBJDIR = ../obj/syllable
X11LOPT = FCLOPT =
else else
# Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested. # Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested.
# Linux and FreeBSD specific (default rules) # Linux and FreeBSD specific (default rules)
@ -339,7 +339,7 @@ endif
STRIP = m68k-atari-mint-strip -s STRIP = m68k-atari-mint-strip -s
STACK = m68k-atari-mint-stack STACK = m68k-atari-mint-stack
FIX_FLAGS = m68k-atari-mint-flags FIX_FLAGS = m68k-atari-mint-flags
X11LOPT = FCLOPT =
COPT = -W -Wall -m68020-60 -fomit-frame-pointer -std=c99 -Wdeclaration-after-statement -D__MINT__ -ffast-math -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $(JOYCOPT) $(LUACOPT) COPT = -W -Wall -m68020-60 -fomit-frame-pointer -std=c99 -Wdeclaration-after-statement -D__MINT__ -ffast-math -O$(OPTIM) -c -I$(prefix)/include `$(prefix)/bin/libpng12-config --cflags` `$(prefix)/bin/sdl-config --cflags` $(JOYCOPT) $(LUACOPT)
LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) -lm $(LAYERLOPT) -Wl,--stack,8k LOPT = -static -m68020-60 -lSDL_image `$(prefix)/bin/sdl-config --libs` -L$(prefix)/lib -ltiff -ljpeg `$(prefix)/bin/libpng12-config --libs` -lz -lm $(TTFLOPT) -lfreetype $(LUALOPT) -lm $(LAYERLOPT) -Wl,--stack,8k
else else
@ -350,7 +350,7 @@ endif
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) `pkg-config --libs libpng` $(LUALOPT) -lm LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) `pkg-config --libs libpng` $(LUALOPT) -lm
CC = gcc CC = gcc
OBJDIR = ../obj/unix OBJDIR = ../obj/unix
X11LOPT = -lX11 FCLOPT = -lfontconfig
endif endif
endif endif
endif endif
@ -380,7 +380,7 @@ ifndef ($(ATARICROSS,1))
TTFLABEL = -nottf TTFLABEL = -nottf
else else
TTFCOPT = TTFCOPT =
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(FCLOPT)
TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll
TTFLABEL = TTFLABEL =
endif endif
@ -392,7 +392,7 @@ else
TTFLABEL = -nottf TTFLABEL = -nottf
else else
TTFCOPT = TTFCOPT =
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT) TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(FCLOPT)
TTFLIBS = TTFLIBS =
TTFLABEL = TTFLABEL =
endif endif

View File

@ -496,13 +496,13 @@ static const T_Help_table helptable_credits[] =
HELP_TEXT (" kusma lmemsm Lord Graga ") HELP_TEXT (" kusma lmemsm Lord Graga ")
HELP_TEXT (" Lorenzo Gatti MagerValp maymunbeyin ") HELP_TEXT (" Lorenzo Gatti MagerValp maymunbeyin ")
HELP_TEXT (" Michael Ilsaas mind MooZ ") HELP_TEXT (" Michael Ilsaas mind MooZ ")
HELP_TEXT (" Pasi Kallinen the Peach petter ") HELP_TEXT (" m.zubrov Pasi Kallinen the Peach ")
HELP_TEXT (" PheeL Ravey1138 richienyhus ") HELP_TEXT (" petter PheeL Ravey1138 ")
HELP_TEXT (" rixard sm4tik spratek ") HELP_TEXT (" richienyhus rixard sm4tik ")
HELP_TEXT (" Surt tape.yrm TeeEmCee ") HELP_TEXT (" spratek Surt tape.yrm ")
HELP_TEXT (" tempest Timo Kurrpa titus^Rab ") HELP_TEXT (" TeeEmCee tempest Timo Kurrpa ")
HELP_TEXT (" Tobé yakumo2975 00ai99") HELP_TEXT (" titus^Rab Tobé yakumo2975 ")
HELP_TEXT ("") HELP_TEXT (" 00ai99 ")
HELP_TEXT (" ... posted the annoying bug reports.") HELP_TEXT (" ... posted the annoying bug reports.")
HELP_TEXT ("") HELP_TEXT ("")

View File

@ -38,9 +38,9 @@
#endif #endif
#if defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) #if defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__)
// No X11 // No fontconfig
#elif defined(__linux__) #elif defined(__linux__)
#include <X11/Xlib.h> #include <fontconfig/fontconfig.h>
#endif #endif
#endif #endif
@ -326,22 +326,23 @@ void Init_text(void)
#endif #endif
#elif defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__) #elif defined(__CAANOO__) || defined(__WIZ__) || defined(__GP2X__)
// No X11 : Only use fonts from Grafx2 // No fontconfig : Only use fonts from Grafx2
#elif defined(__linux__) #elif defined(__linux__)
#ifndef NOTTF #ifndef NOTTF
#define USE_XLIB #define USE_FC
#ifdef USE_XLIB #ifdef USE_FC
{ {
int i,number; FcStrList* dirs;
Display* dpy = XOpenDisplay(NULL); dirs = FcConfigGetFontDirs(NULL);
char** font_path_list = XGetFontPath(dpy,&number); char* fdir = FcStrListNext(dirs);
XCloseDisplay(dpy); while(fdir != NULL)
{
For_each_file(fdir,Add_font);
fdir = FcStrListNext(dirs);
}
for(i=0;i<number;i++) FcStrListDone(dirs);
For_each_file(*(font_path_list+i),Add_font);
XFreeFontPath(font_path_list);
} }
#endif #endif
#endif #endif