Skip to content

Commit

Permalink
Add Freetype support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Zhuravlev authored and PilzAdam committed Feb 14, 2013
1 parent df3c925 commit 30b9a4d
Show file tree
Hide file tree
Showing 23 changed files with 7,271 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ src/jthread/cmake_install.cmake
src/jthread/libjthread.a
src/lua/build/
src/lua/CMakeFiles/
src/cguittfont/CMakeFiles/
src/cguittfont/libcguittfont.a
src/cguittfont/cmake_install.cmake
src/cguittfont/Makefile
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ if(RUN_IN_PLACE)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/all/textures_here.txt" DESTINATION "${SHAREDIR}/textures/all")
endif()

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")

install(FILES "README.txt" DESTINATION "${DOCDIR}")
install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}")
install(FILES "doc/mapformat.txt" DESTINATION "${DOCDIR}")
Expand Down
4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,8 @@ DejaVu Sans Mono:

Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.

Liberation Fonts Copyright:

Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.


Binary file added fonts/liberationmono.ttf
Binary file not shown.
Binary file added fonts/liberationsans.ttf
Binary file not shown.
5 changes: 5 additions & 0 deletions minetest.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
# File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab
#serverlist_file = favoriteservers.txt

#font_path = fonts/liberationsans.ttf
#font_size = 13
#mono_font_path = fonts/liberationmono.ttf
#mono_font_size = 13

#
# Server stuff
#
Expand Down
45 changes: 45 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ if(USE_SOUND)
)
endif()

option(ENABLE_FREETYPE "Enable freetype2 (truetype fonts and basic unicode support)" OFF)
set(USE_FREETYPE 0)
if(ENABLE_FREETYPE)
set(USE_FREETYPE 1)
endif(ENABLE_FREETYPE)

if(NOT MSVC)
set(USE_GPROF 0 CACHE BOOL "Use -pg flag for g++")
endif()
Expand All @@ -117,6 +123,14 @@ if(WIN32)
CACHE FILEPATH "Path to zlibwapi.dll (for installation)")
set(IRRLICHT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../irrlicht-1.7.2"
CACHE PATH "irrlicht dir")
if(USE_FREETYPE)
set(FREETYPE_INCLUDE_DIR_ft2build "${PROJECT_SOURCE_DIR}/../../freetype2/include/"
CACHE PATH "freetype include dir")
set(FREETYPE_INCLUDE_DIR_freetype2 "${PROJECT_SOURCE_DIR}/../../freetype2/include/freetype"
CACHE PATH "freetype include dir")
set(FREETYPE_LIBRARY "${PROJECT_SOURCE_DIR}/../../freetype2/objs/win32/vc2005/freetype247.lib"
CACHE FILEPATH "Path to freetype247.lib")
endif(USE_FREETYPE)
set(MINGWM10_DLL ""
CACHE FILEPATH "Path to mingwm10.dll (for installation)")
if(ENABLE_SOUND)
Expand Down Expand Up @@ -157,6 +171,12 @@ endif()
find_package(Jthread REQUIRED)
find_package(Sqlite3 REQUIRED)

if(USE_FREETYPE)
find_package(Freetype REQUIRED)
set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
set(CGUITTFONT_LIBRARY cguittfont)
endif(USE_FREETYPE)

# Do not use system-wide installation of Lua, because it'll likely be a
# different version and/or has different build options.
set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
Expand Down Expand Up @@ -288,6 +308,13 @@ set(minetest_SRCS
main.cpp
)

if(USE_FREETYPE)
set(minetest_SRCS
${minetest_SRCS}
intlGUIEditBox.cpp
)
endif(USE_FREETYPE)

# Server sources
set(minetestserver_SRCS
${common_SRCS}
Expand All @@ -307,6 +334,13 @@ include_directories(
${LUA_INCLUDE_DIR}
)

if(USE_FREETYPE)
include_directories(
${FREETYPE_INCLUDE_DIRS}
${CGUITTFONT_INCLUDE_DIR}
)
endif(USE_FREETYPE)

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")

if(BUILD_CLIENT)
Expand Down Expand Up @@ -338,6 +372,13 @@ if(BUILD_CLIENT)
${CURL_INCLUDE_DIR}
)
endif(USE_CURL)
if(USE_FREETYPE)
target_link_libraries(
${PROJECT_NAME}
${FREETYPE_LIBRARY}
${CGUITTFONT_LIBRARY}
)
endif(USE_FREETYPE)
endif(BUILD_CLIENT)

if(BUILD_SERVER)
Expand Down Expand Up @@ -519,6 +560,10 @@ else (SQLITE3_FOUND)
add_subdirectory(sqlite)
endif (SQLITE3_FOUND)

if (BUILD_CLIENT AND USE_FREETYPE)
add_subdirectory(cguittfont)
endif (BUILD_CLIENT AND USE_FREETYPE)

if (LUA_FOUND)
else (LUA_FOUND)
add_subdirectory(lua)
Expand Down
Loading

0 comments on commit 30b9a4d

Please sign in to comment.