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
# 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
LOPT = $(SDLLOPT) $(LUALOPT) -framework libpng14 -lz
else
@ -134,7 +134,7 @@ endif
#CC = nccgen -ncgcc -ncld -ncfabs
OBJDIR = ../obj/macosx
PLATFORMOBJ = $(OBJDIR)/SDLMain.o
X11LOPT =
FCLOPT =
MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2
NOTTF = 1
else
@ -234,7 +234,7 @@ endif
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
OBJDIR = ../obj/unix
X11LOPT = -lX11
FCLOPT = -lfontconfig
CC = gcc
else
ifeq ($(PLATFORM),FreeMiNT) #10
@ -253,7 +253,7 @@ endif
STRIP = strip -s
STACK = stack
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)
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
@ -272,7 +272,7 @@ endif
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/syllable
X11LOPT =
FCLOPT =
else
# Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested.
# Linux and FreeBSD specific (default rules)
@ -339,7 +339,7 @@ endif
STRIP = m68k-atari-mint-strip -s
STACK = m68k-atari-mint-stack
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)
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
@ -350,7 +350,7 @@ endif
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) `pkg-config --libs libpng` $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/unix
X11LOPT = -lX11
FCLOPT = -lfontconfig
endif
endif
endif
@ -380,7 +380,7 @@ ifndef ($(ATARICROSS,1))
TTFLABEL = -nottf
else
TTFCOPT =
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT)
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(FCLOPT)
TTFLIBS = bin/libfreetype-6.dll bin/SDL_ttf.dll
TTFLABEL =
endif
@ -392,7 +392,7 @@ else
TTFLABEL = -nottf
else
TTFCOPT =
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(X11LOPT)
TTFLOPT = -L$(prefix)/lib -lSDL_ttf $(FCLOPT)
TTFLIBS =
TTFLABEL =
endif

View File

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

View File

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