Changed the buildin SDL_ttf to a dependency on the library version >= 2.0.8.

This commit is contained in:
Mark de Wever 2008-03-04 18:24:15 +00:00
parent a33933f2de
commit d41120795d
13 changed files with 46 additions and 1998 deletions

View file

@ -473,7 +473,7 @@ WARN_LOGFILE =
# like "myfile.cpp" or directories like "/usr/src/myproject".
# Separate the files or directories with spaces.
INPUT = src src/campaign_server src/editor src/serialization src/server src/sdl_ttf src/tools src/widgets doc/doxygen/doxygen.cpp src/animated.i
INPUT = src src/campaign_server src/editor src/serialization src/server src/tools src/widgets doc/doxygen/doxygen.cpp src/animated.i
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp

View file

@ -6,6 +6,7 @@ You'll need to have these libraries (with equivalent devel versions) to build We
libsdl-image1.2 (with png support)
libsdl-mixer1.2 (with Vorbis support)
libsdl-net
libsdl-ttf2.0.8
libfreetype2
libz
boost_iostreams >= 1.33.0

View file

@ -14,3 +14,4 @@ The release team should empty this file after each release.
Notes for packagers (not sure whether needed in normal notes as well)
* We now depend on boost_regex >= 1.33.0
* We now depend on libsdl-ttf >= 2.0.8

View file

@ -12,6 +12,7 @@ Version 1.5.0-svn:
* miscellaneous and bug fixes:
* remove an ancient wml update program which has been obsoleted by wmllint
* added the boost regex dependency
* added the sdl-ttf dependency
Version 1.4:
* language and i18n:

View file

@ -551,7 +551,8 @@ AC_ARG_ENABLE([sdltest],
[enable_sdltest=yes])
min_sdl_version=1.2.7
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
min_sdl_ttf_version=2.0.8
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version and SDL_ttf - version >= $min_sdl_ttf_version)
SDL_CFLAGS=`$SDL_CONFIG --cflags`
SDL_LIBS=`$SDL_CONFIG --libs`
@ -562,6 +563,14 @@ sdl_minor_version=`$SDL_CONFIG --version | \
sdl_micro_version=`$SDL_CONFIG --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
sdl_ttf_major_version=`echo $min_sdl_ttf_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_ttf_minor_version=`echo $min_sdl_ttf_version| \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_ttf_micro_version=`echo $min_sdl_ttf_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
@ -577,6 +586,7 @@ if test "x$enable_sdltest" = "xyes" ; then
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "SDL_ttf.h"
char*
my_strdup (char *str)
@ -615,7 +625,21 @@ int main (int argc, char **argv)
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
SDL_version compile_version, *link_version;
TTF_VERSION(&compile_version);
if (($sdl_ttf_major_version > compile_version.major) ||
(($sdl_ttf_major_version == compile_version.major)
&& ($sdl_ttf_minor_version > compile_version.minor)) ||
(($sdl_ttf_major_version == compile_version.major)
&& ($sdl_ttf_minor_version == compile_version.minor)
&& ($sdl_ttf_micro_version == compile_version.patch)))
{
return 0;
} else {
printf("\n*** TTF_VERSION returned %d.%d.%d, but the minimum version\n",compile_version.major, compile_version.minor, compile_version.patch);
printf("*** required version is %d.%d.%d. Please update your library.\n",$sdl_ttf_major_version,$sdl_ttf_minor_version,$sdl_ttf_micro_version);
return 1;
}
}
else
{
@ -732,12 +756,22 @@ fi],
[AC_MSG_ERROR([*** SDL_net lib not found! Get SDL_net from
http://www.libsdl.org/projects/SDL_net/index.html])])
AC_CHECK_LIB([SDL_ttf],
[TTF_Init],
[if test -n "$LDPREFIX" -a -r `$SDL_CONFIG --prefix`/lib/libSDL_ttf.la
then SDL_TTF_LIBS=`$SDL_CONFIG --prefix`/lib/libSDL_ttf.la
else SDL_TTF_LIBS=-lSDL_ttf
fi],
[AC_MSG_ERROR([*** SDL_ttf lib not found! Get SDL_ttf from
http://www.libsdl.org/projects/SDL_ttf/index.html])])
LIBS=$OLD_LIBS
AC_SUBST([SDL_LIBS])
AC_SUBST([SDL_IMAGE_LIBS])
AC_SUBST([SDL_MIXER_LIBS])
AC_SUBST([SDL_NET_LIBS])
AC_SUBST([SDL_TTF_LIBS])
# Checking for the freetype library. This was copied from the
# config script of SDL_ttf, modified for CPPFLAGS

View file

@ -360,7 +360,6 @@ noinst_HEADERS = \
variable.hpp \
video.hpp \
wml_separators.hpp \
sdl_ttf/SDL_ttf.h \
wesconfig.h \
wml_exception.hpp
@ -438,7 +437,6 @@ libwesnoth_a_SOURCES = \
widgets/slider.cpp \
widgets/textbox.cpp \
widgets/widget.cpp \
sdl_ttf/SDL_ttf.c \
wml_exception.cpp
if USESVN
@ -454,10 +452,10 @@ revision-stamp: FORCE
FORCE:
endif
AM_CXXFLAGS = -I $(srcdir)/sdl_ttf -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
AM_CXXFLAGS = -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR) -DFIFODIR=\"$(fifodir)\"
AM_CFLAGS = -I $(srcdir)/sdl_ttf -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
AM_CFLAGS = -I../intl -I$(top_srcdir)/intl @SDL_CFLAGS@ -DWESNOTH_PATH=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(LOCALEDIR)\" -DHAS_RELATIVE_LOCALEDIR=$(HAS_RELATIVE_LOCALEDIR)
if PYTHON

View file

@ -39,7 +39,7 @@
#include "widgets/progressbar.hpp"
#include "widgets/textbox.hpp"
#include "sdl_ttf/SDL_ttf.h"
#include "SDL_ttf.h"
#include <iostream>
#include <numeric>

View file

@ -45,15 +45,6 @@
#define WRN_FT LOG_STREAM(warn, display)
#define ERR_FT LOG_STREAM(err, display)
//Deliberately breaking compilation with the original SDL_ttf library. Remove
//the lines below to be able to do this anyway, however this is buggy and may
//cause random memory corruption errors depending on the OS / Version of
//Freetype / Language you are using!
//
#ifndef SDL_TTF_WESNOTH
#error Please use the SDL_ttf files in the sdl_ttf directory, and not the original SDL_ttf library.
#endif
#ifdef HAVE_FRIBIDI
#include <fribidi/fribidi.h>

View file

@ -15,7 +15,7 @@
#define FONT_HPP_INCLUDED
#include "SDL.h"
#include "sdl_ttf/SDL_ttf.h"
#include "SDL_ttf.h"
class CVideo;
#include "sdl_utils.hpp"

File diff suppressed because it is too large Load diff

View file

@ -1,235 +0,0 @@
/*
SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts
Copyright (C) 1997-2004 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
/* $Id$ */
/* This library is a wrapper around the excellent FreeType 2.0 library,
available at:
http://www.freetype.org/
*/
#ifndef _SDL_TTF_H
#define _SDL_TTF_H
#include "SDL.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
#define SDL_TTF_MAJOR_VERSION 2
#define SDL_TTF_MINOR_VERSION 0
#define SDL_TTF_PATCHLEVEL 7
#define SDL_TTF_WESNOTH 1
/* This macro can be used to fill a version structure with the compile-time
* version of the SDL_ttf library.
*/
#define SDL_TTF_VERSION(X) \
{ \
(X)->major = SDL_TTF_MAJOR_VERSION; \
(X)->minor = SDL_TTF_MINOR_VERSION; \
(X)->patch = SDL_TTF_PATCHLEVEL; \
}
/* Backwards compatibility */
#define TTF_MAJOR_VERSION SDL_TTF_MAJOR_VERSION
#define TTF_MINOR_VERSION SDL_TTF_MINOR_VERSION
#define TTF_PATCHLEVEL SDL_TTF_PATCHLEVEL
#define TTF_VERSION(X) SDL_TTF_VERSION(X)
/* This function gets the version of the dynamically linked SDL_ttf library.
it should NOT be used to fill a version structure, instead you should
use the SDL_TTF_VERSION() macro.
*/
extern DECLSPEC const SDL_version * SDLCALL TTF_Linked_Version(void);
/* ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) */
#define UNICODE_BOM_NATIVE 0xFEFF
#define UNICODE_BOM_SWAPPED 0xFFFE
/* This function tells the library whether UNICODE text is generally
byteswapped. A UNICODE BOM character in a string will override
this setting for the remainder of that string.
*/
extern DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(int swapped);
/* The internal structure containing font information */
typedef struct _TTF_Font TTF_Font;
/* Initialize the TTF engine - returns 0 if successful, -1 on error */
extern DECLSPEC int SDLCALL TTF_Init(void);
/* Open a font file and create a font of the specified point size.
* Some .fon fonts will have several sizes embedded in the file, so the
* point size becomes the index of choosing which size. If the value
* is too high, the last indexed size will be the default. */
extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, int ptsize);
extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int ptsize, long index);
extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontRW(SDL_RWops *src, int freesrc, int ptsize);
extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexRW(SDL_RWops *src, int freesrc, int ptsize, long index);
/* Set and retrieve the font style
This font style is implemented by modifying the font glyphs, and
doesn't reflect any inherent properties of the truetype font file.
*/
#define TTF_STYLE_NORMAL 0x00
#define TTF_STYLE_BOLD 0x01
#define TTF_STYLE_ITALIC 0x02
#define TTF_STYLE_UNDERLINE 0x04
extern DECLSPEC int SDLCALL TTF_GetFontStyle(TTF_Font *font);
extern DECLSPEC void SDLCALL TTF_SetFontStyle(TTF_Font *font, int style);
/* Get the total height of the font - usually equal to point size */
extern DECLSPEC int SDLCALL TTF_FontHeight(TTF_Font *font);
/* Get the offset from the baseline to the top of the font
This is a positive value, relative to the baseline.
*/
extern DECLSPEC int SDLCALL TTF_FontAscent(TTF_Font *font);
/* Get the offset from the baseline to the bottom of the font
This is a negative value, relative to the baseline.
*/
extern DECLSPEC int SDLCALL TTF_FontDescent(TTF_Font *font);
/* Get the recommended spacing between lines of text for this font */
extern DECLSPEC int SDLCALL TTF_FontLineSkip(TTF_Font *font);
/* Get the number of faces of the font */
extern DECLSPEC long SDLCALL TTF_FontFaces(TTF_Font *font);
/* Get the font face attributes, if any */
extern DECLSPEC int SDLCALL TTF_FontFaceIsFixedWidth(TTF_Font *font);
extern DECLSPEC char * SDLCALL TTF_FontFaceFamilyName(TTF_Font *font);
extern DECLSPEC char * SDLCALL TTF_FontFaceStyleName(TTF_Font *font);
/* Get the metrics (dimensions) of a glyph
To understand what these metrics mean, here is a useful link:
http://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html
*/
extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch,
int *minx, int *maxx,
int *miny, int *maxy, int *advance);
/* Get the dimensions of a rendered string of text */
extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h);
extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h);
/* Create an 8-bit palettized surface and render the given text at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is set
to the text color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid(TTF_Font *font,
const Uint16 *text, SDL_Color fg);
/* Create an 8-bit palettized surface and render the given glyph at
fast quality with the given font and color. The 0 pixel is the
colorkey, giving a transparent background, and the 1 pixel is set
to the text color. The glyph is rendered without any padding or
centering in the X direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font,
Uint16 ch, SDL_Color fg);
/* Create an 8-bit palettized surface and render the given text at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font,
const char *text, SDL_Color fg, SDL_Color bg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font,
const char *text, SDL_Color fg, SDL_Color bg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded(TTF_Font *font,
const Uint16 *text, SDL_Color fg, SDL_Color bg);
/* Create an 8-bit palettized surface and render the given glyph at
high quality with the given font and colors. The 0 pixel is background,
while other pixels have varying degrees of the foreground color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font,
Uint16 ch, SDL_Color fg, SDL_Color bg);
/* Create a 32-bit ARGB surface and render the given text at high quality,
using alpha blending to dither the font with the given color.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font,
const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font,
const Uint16 *text, SDL_Color fg);
/* Create a 32-bit ARGB surface and render the given glyph at high quality,
using alpha blending to dither the font with the given color.
The glyph is rendered without any padding or centering in the X
direction, and aligned normally in the Y direction.
This function returns the new surface, or NULL if there was an error.
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font,
Uint16 ch, SDL_Color fg);
/* For compatibility with previous versions, here are the old functions */
#define TTF_RenderText(font, text, fg, bg) \
TTF_RenderText_Shaded(font, text, fg, bg)
#define TTF_RenderUTF8(font, text, fg, bg) \
TTF_RenderUTF8_Shaded(font, text, fg, bg)
#define TTF_RenderUNICODE(font, text, fg, bg) \
TTF_RenderUNICODE_Shaded(font, text, fg, bg)
/* Close an opened font file */
extern DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font);
/* De-initialize the TTF engine */
extern DECLSPEC void SDLCALL TTF_Quit(void);
/* Check if the TTF engine is initialized */
extern DECLSPEC int SDLCALL TTF_WasInit(void);
/* We'll use SDL for reporting errors */
#define TTF_SetError SDL_SetError
#define TTF_GetError SDL_GetError
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* _SDL_TTF_H */

View file

@ -38,7 +38,7 @@
#include "widgets/progressbar.hpp"
#include "widgets/textbox.hpp"
#include "sdl_ttf/SDL_ttf.h"
#include "SDL_ttf.h"
#include <iostream>
#include <numeric>

View file

@ -43,7 +43,7 @@
#include "wesconfig.h"
#include <algorithm>
#include "sdl_ttf/SDL_ttf.h"
#include "SDL_ttf.h"
//! Log info-messages to stdout during the game, mainly for debugging
#define LOG_DP LOG_STREAM(info, display)