Load our own fonts for the new widgets.

This commit is contained in:
Mark de Wever 2008-09-03 15:46:41 +00:00
parent 5ffd1dc05f
commit 775838a379
7 changed files with 30 additions and 3 deletions

View File

@ -39,6 +39,9 @@ find_package( X11 )
#use pkg-config to find pangocairo:
pkg_check_modules( PANGOCAIRO REQUIRED pangocairo>=1.14.8 )
#use pkg-config to find fontconfig:
pkg_check_modules( FONTCONFIG REQUIRED fontconfig>=2.4.2 )
#
# Options
#

View File

@ -12,6 +12,7 @@ You'll need to have these libraries (with equivalent devel versions) to build We
boost_iostreams >= 1.33.0
boost_regex >= 1.33.0
libfontconfig >= 2.4.2
libpango (with cairo backend) >= 1.14.8
libsdl >= 1.2.7
libsdl-image >= 1.2 (with png support)

View File

@ -22,3 +22,8 @@ wmllint can make the required changes.
***
Building Wesnoth now requires fontconfig 2.4.2 or higher (only tested with
2.6.0). This dependency was already needed for using pango so no new runtime
requirements are added.
***

View File

@ -948,6 +948,9 @@ if test "x$game" = "xyes" || test "x$tests" = "xyes"; then
PKG_CHECK_MODULES(PANGO, pangocairo >= 1.14.8)
CPPFLAGS="$CPPFLAGS $PANGO_CFLAGS"
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.4.2)
CPPFLAGS="$CPPFLAGS $FONTCONFIG_CFLAGS"
fi
#######################################################################

View File

@ -2,6 +2,7 @@
include_directories( ${Boost_INCLUDE_DIR} )
include_directories( ${SDL_INCLUDE_DIR} )
include_directories( ${PANGOCAIRO_INCLUDE_DIRS} )
include_directories( ${FONTCONFIG_INCLUDE_DIRS} )
include_directories( ${GETTEXT_INCLUDE_DIR} )
#optional dependencies
@ -39,6 +40,7 @@ set( game-external-libs
${SDLNET_LIBRARY}
${SDLTTF_LIBRARY}
${PANGOCAIRO_LDFLAGS}
${FONTCONFIG_LDFLAGS}
)
set( server-external-libs
@ -51,6 +53,7 @@ set( editor-external-libs
${SDLIMAGE_LIBRARY}
${SDLMIXER_LIBRARY}
${SDLTTF_LIBRARY}
${FONTCONFIG_LDFLAGS}
)
set( tools-external-libs

View File

@ -184,7 +184,7 @@ wesnoth_SOURCES = \
game.cpp \
$(wesnoth_source)
wesnoth_LDADD = $(INTERNALLIBS) $(THELIBS) $(PANGO_LIBS)
wesnoth_LDADD = $(INTERNALLIBS) $(THELIBS) $(PANGO_LIBS) $(FONTCONFIG_LIBS)
wesnoth_DEPENDENCIES=libwesnoth-core.a libwesnoth.a
#############################################################################
@ -204,7 +204,7 @@ wesnoth_editor_SOURCES = \
generic_event.cpp \
tooltips.cpp
wesnoth_editor_LDADD = $(INTERNALLIBS) $(THELIBS)
wesnoth_editor_LDADD = $(INTERNALLIBS) $(THELIBS) $(FONTCONFIG_LIBS)
wesnoth_editor_DEPENDENCIES=libwesnoth-core.a libwesnoth.a
#############################################################################
@ -292,7 +292,7 @@ test_SOURCES = \
tests/test_team.cpp \
$(wesnoth_source)
test_LDADD = $(INTERNALLIBS) $(THELIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) $(PANGO_LIBS)
test_LDADD = $(INTERNALLIBS) $(THELIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) $(PANGO_LIBS) $(FONTCONFIG_LIBS)
test_DEPENDENCIES=libwesnoth-core.a libwesnoth.a
#############################################################################

View File

@ -38,6 +38,8 @@
#include <stack>
#include <string>
#include <fontconfig/fontconfig.h>
#define DBG_FT LOG_STREAM(debug, display)
#define LOG_FT LOG_STREAM(info, display)
#define WRN_FT LOG_STREAM(warn, display)
@ -286,10 +288,20 @@ manager::manager()
} else {
LOG_FT << "Initialized true type fonts\n";
}
if(!FcConfigAppFontAddDir( FcConfigGetCurrent(),
reinterpret_cast<const FcChar8*>
((game_config::path + "/fonts/").c_str()))) {
ERR_FT << "Could not load the true type fonts\n";
throw error();
}
}
manager::~manager()
{
FcConfigAppFontClear(FcConfigGetCurrent());
clear_fonts();
TTF_Quit();
}