Skip to content

Commit

Permalink
Fully remove bitmap font support (#11863)
Browse files Browse the repository at this point in the history
Freetype is now a build requirement.
  • Loading branch information
sfan5 committed Jan 8, 2022
1 parent bf22569 commit 76dbd0d
Show file tree
Hide file tree
Showing 50 changed files with 71 additions and 319 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/build.yml
Expand Up @@ -150,29 +150,6 @@ jobs:
run: |
./bin/minetestserver --run-unittests
# Build without freetype (client-only)
clang_9_no_freetype:
name: "clang_9 (FREETYPE=0)"
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
source ./util/ci/common.sh
install_linux_deps clang-9
- name: Build
run: |
./util/ci/build.sh
env:
CC: clang-9
CXX: clang++-9
CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0"

- name: Test
run: |
./bin/minetest --run-unittests
docker:
name: "Docker image"
runs-on: ubuntu-18.04
Expand Down
18 changes: 8 additions & 10 deletions README.md
Expand Up @@ -135,15 +135,16 @@ Compiling
| GCC | 4.9+ | Can be replaced with Clang 3.4+ |
| CMake | 3.5+ | |
| IrrlichtMt | - | Custom version of Irrlicht, see https://github.com/minetest/irrlicht |
| SQLite3 | 3.0+ | |
| Freetype | 2.0+ | |
| SQLite3 | 3+ | |
| Zstd | 1.0+ | |
| LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present |
| GMP | 5.0.0+ | Bundled mini-GMP is used if not present |
| JsonCPP | 1.0.0+ | Bundled JsonCPP is used if not present |

For Debian/Ubuntu users:

sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev
sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev

For Fedora users:

Expand Down Expand Up @@ -247,7 +248,6 @@ General options and their default values:
MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible
ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal)
ENABLE_FREETYPE=ON - Build with FreeType2; Allows using TTF fonts
ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations
ENABLE_GLES=OFF - Build for OpenGL ES instead of OpenGL (requires support by IrrlichtMt)
ENABLE_LEVELDB=ON - Build with LevelDB; Enables use of LevelDB map backend
Expand All @@ -273,10 +273,10 @@ Library specific options:
EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h
EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so
EXTRA_DLL - Only on Windows; optional paths to additional DLLs that should be packaged
FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it
FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h
FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib
FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll
FREETYPE_INCLUDE_DIR_freetype2 - Directory that contains files such as ftimage.h
FREETYPE_INCLUDE_DIR_ft2build - Directory that contains ft2build.h
FREETYPE_LIBRARY - Path to libfreetype.a/libfreetype.so/freetype.lib
FREETYPE_DLL - Only on Windows; path to libfreetype-6.dll
GETTEXT_DLL - Only when building with gettext on Windows; paths to libintl + libiconv DLLs
GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h
GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a
Expand Down Expand Up @@ -337,7 +337,6 @@ vcpkg install zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo
- **Don't forget about IrrlichtMt.** The easiest way is to clone it to `lib/irrlichtmt` as described in the Linux section.
- `curl` is optional, but required to read the serverlist, `curl[winssl]` is required to use the content store.
- `openal-soft`, `libvorbis` and `libogg` are optional, but required to use sound.
- `freetype` is optional, it allows true-type font rendering.
- `luajit` is optional, it replaces the integrated Lua interpreter with a faster just-in-time interpreter.
- `gmp` and `jsoncpp` are optional, otherwise the bundled versions will be compiled

Expand Down Expand Up @@ -429,8 +428,7 @@ cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_INSTALL_PREFIX=../build/macos/ \
-DRUN_IN_PLACE=FALSE \
-DENABLE_FREETYPE=TRUE -DENABLE_GETTEXT=TRUE
-DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE

make -j$(nproc)
make install
Expand Down
1 change: 0 additions & 1 deletion android/native/jni/Android.mk
Expand Up @@ -91,7 +91,6 @@ LOCAL_CFLAGS += \
-DENABLE_GLES=1 \
-DUSE_CURL=1 \
-DUSE_SOUND=1 \
-DUSE_FREETYPE=1 \
-DUSE_LEVELDB=0 \
-DUSE_LUAJIT=1 \
-DUSE_GETTEXT=1 \
Expand Down
16 changes: 3 additions & 13 deletions builtin/settingtypes.txt
Expand Up @@ -886,10 +886,6 @@ tooltip_show_delay (Tooltip delay) int 400
# Append item name to tooltip.
tooltip_append_itemname (Append item name) bool false

# Whether FreeType fonts are used, requires FreeType support to be compiled in.
# If disabled, bitmap and XML vectors fonts are used instead.
freetype (FreeType fonts) bool true

font_bold (Font bold by default) bool false

font_italic (Font italic by default) bool false
Expand All @@ -909,9 +905,7 @@ font_size (Font size) int 16 1
# sized 16, 32, 48, etc., so a mod requesting a size of 25 will get 32.
font_size_divisible_by (Font size divisible by) int 1 1

# Path to the default font.
# If “freetype” setting is enabled: Must be a TrueType font.
# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
# Path to the default font. Must be a TrueType font.
# The fallback font will be used if the font cannot be loaded.
font_path (Regular font path) filepath fonts/Arimo-Regular.ttf

Expand All @@ -928,19 +922,15 @@ mono_font_size (Monospace font size) int 16 1
# sized 16, 32, 48, etc., so a mod requesting a size of 25 will get 32.
mono_font_size_divisible_by (Monospace font size divisible by) int 1 1

# Path to the monospace font.
# If “freetype” setting is enabled: Must be a TrueType font.
# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
# Path to the monospace font. Must be a TrueType font.
# This font is used for e.g. the console and profiler screen.
mono_font_path (Monospace font path) filepath fonts/Cousine-Regular.ttf

mono_font_path_bold (Bold monospace font path) filepath fonts/Cousine-Bold.ttf
mono_font_path_italic (Italic monospace font path) filepath fonts/Cousine-Italic.ttf
mono_font_path_bold_italic (Bold and italic monospace font path) filepath fonts/Cousine-BoldItalic.ttf

# Path of the fallback font.
# If “freetype” setting is enabled: Must be a TrueType font.
# If “freetype” setting is disabled: Must be a bitmap or XML vectors font.
# Path of the fallback font. Must be a TrueType font.
# This font will be used for certain languages or if the default font is unavailable.
fallback_font_path (Fallback font path) filepath fonts/DroidSansFallbackFull.ttf

Expand Down
1 change: 0 additions & 1 deletion doc/Doxyfile.in
Expand Up @@ -16,7 +16,6 @@ PREDEFINED = "USE_SPATIAL=1" \
"USE_REDIS=1" \
"USE_SOUND=1" \
"USE_CURL=1" \
"USE_FREETYPE=1" \
"USE_GETTEXT=1"

# Input
Expand Down
Binary file removed fonts/mono_dejavu_sans_10.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_100.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_11.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_110.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_12.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_120.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_14.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_140.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_16.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_160.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_18.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_180.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_20.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_200.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_22.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_220.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_24.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_240.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_26.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_260.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_28.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_280.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_4.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_40.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_6.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_60.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_8.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_80.png
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_9.xml
Binary file not shown.
Binary file removed fonts/mono_dejavu_sans_90.png
Binary file not shown.
49 changes: 16 additions & 33 deletions src/CMakeLists.txt
Expand Up @@ -122,16 +122,8 @@ if(BUILD_CLIENT)
endif()
endif()


option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode support)" TRUE)
set(USE_FREETYPE FALSE)

if(BUILD_CLIENT AND ENABLE_FREETYPE)
find_package(Freetype)
if(FREETYPE_FOUND)
message(STATUS "Freetype enabled.")
set(USE_FREETYPE TRUE)
endif()
if(BUILD_CLIENT)
find_package(Freetype REQUIRED)
endif()

option(ENABLE_CURSES "Enable ncurses console" TRUE)
Expand Down Expand Up @@ -495,22 +487,24 @@ include_directories(
${PROJECT_SOURCE_DIR}
${ZLIB_INCLUDE_DIR}
${ZSTD_INCLUDE_DIR}
${SOUND_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
${GMP_INCLUDE_DIR}
${JSON_INCLUDE_DIR}
${LUA_BIT_INCLUDE_DIR}
${X11_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/script
)

if(USE_GETTEXT)
include_directories(${GETTEXT_INCLUDE_DIR})
endif()

if(USE_FREETYPE)
include_directories(${FREETYPE_INCLUDE_DIRS})
if(BUILD_CLIENT)
include_directories(
${FREETYPE_INCLUDE_DIRS}
${SOUND_INCLUDE_DIRS}
${X11_INCLUDE_DIR}
)
endif()

if(USE_CURL)
Expand Down Expand Up @@ -539,6 +533,7 @@ if(BUILD_CLIENT)
${GMP_LIBRARY}
${JSON_LIBRARY}
${LUA_BIT_LIBRARY}
${FREETYPE_LIBRARY}
${PLATFORM_LIBS}
)
if(NOT USE_LUAJIT)
Expand Down Expand Up @@ -573,17 +568,11 @@ if(BUILD_CLIENT)
${CURL_LIBRARY}
)
endif()
if(USE_FREETYPE)
if(FREETYPE_PKGCONFIG_FOUND)
set_target_properties(${PROJECT_NAME}
PROPERTIES
COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}"
)
endif()
target_link_libraries(
${PROJECT_NAME}
${FREETYPE_LIBRARY}
)
if(FREETYPE_PKGCONFIG_FOUND)
set_target_properties(${PROJECT_NAME}
PROPERTIES
COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}"
)
endif()
if (USE_CURSES)
target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES})
Expand Down Expand Up @@ -896,14 +885,8 @@ if(BUILD_CLIENT)
endforeach()
endif()

# Install necessary fonts depending on configuration
if(USE_FREETYPE)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt")
else()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
FILES_MATCHING PATTERN "*.png" PATTERN "*.xml")
endif()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../fonts" DESTINATION "${SHAREDIR}"
FILES_MATCHING PATTERN "*.ttf" PATTERN "*.txt")
endif(BUILD_CLIENT)

if(BUILD_SERVER)
Expand Down

0 comments on commit 76dbd0d

Please sign in to comment.