Browse Source

Remove font engine default files from cmake when the default font interface is disabled. Remove macro guards.

Michael Ragazzon 6 years ago
parent
commit
48dd41ef40

+ 26 - 16
CMake/FileList.cmake

@@ -35,15 +35,6 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutlineInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutlineInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadowInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadowInstancer.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontTypes.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/precompiled.h
     ${PROJECT_SOURCE_DIR}/Source/Core/IdNameMap.h
     ${PROJECT_SOURCE_DIR}/Source/Core/IdNameMap.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBox.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBox.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBoxSpace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/LayoutBlockBoxSpace.h
@@ -242,13 +233,6 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutlineInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectOutlineInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadow.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadowInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEffectShadowInstancer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineInterface.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineInterface.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Geometry.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Geometry.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/GeometryUtilities.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/GeometryUtilities.cpp
@@ -446,6 +430,32 @@ set(Debugger_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Debugger/SystemInterface.cpp
     ${PROJECT_SOURCE_DIR}/Source/Debugger/SystemInterface.cpp
 )
 )
 
 
+if(NOT NO_FONT_INTERFACE_DEFAULT)
+    set(Core_HDR_FILES
+        ${Core_HDR_FILES}
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontTypes.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.h
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/precompiled.h
+    )
+
+    set(Core_SRC_FILES
+        ${Core_SRC_FILES}
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontEngineInterfaceDefault.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFace.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFaceLayer.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontFamily.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FontProvider.cpp
+        ${PROJECT_SOURCE_DIR}/Source/Core/FontEngineDefault/FreeTypeInterface.cpp
+    )
+endif()
+
 set(LuaCore_HDR_FILES
 set(LuaCore_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Lua/Colourb.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Lua/Colourb.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Lua/Colourf.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Lua/Colourf.h

+ 23 - 3
CMake/gen_filelists.sh

@@ -7,14 +7,17 @@ hdr='set(lib_HDR_FILES'
 masterpubhdr='set(MASTER_lib_PUB_HDR_FILES'
 masterpubhdr='set(MASTER_lib_PUB_HDR_FILES'
 pubhdr='set(lib_PUB_HDR_FILES'
 pubhdr='set(lib_PUB_HDR_FILES'
 srcdir='${PROJECT_SOURCE_DIR}'
 srcdir='${PROJECT_SOURCE_DIR}'
+fontdefaultbegin='if(NOT NO_FONT_INTERFACE_DEFAULT)'
+fontdefaultend='endif()'
 srcpath=Source
 srcpath=Source
 hdrpath=Include/RmlUi
 hdrpath=Include/RmlUi
 luapath=Lua
 luapath=Lua
+fontdefaultpath=FontEngineDefault
 
 
 printfiles() {
 printfiles() {
     # Print headers
     # Print headers
     echo ${hdr/lib/$1} >>$file
     echo ${hdr/lib/$1} >>$file
-    find  $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o \( -iname "*.h" -o -iname "*.hpp" \) -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
+    find  $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.hpp" \) -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print master header for library
     # Print master header for library
     echo ${masterpubhdr/lib/$1} >>$file
     echo ${masterpubhdr/lib/$1} >>$file
@@ -22,14 +25,29 @@ printfiles() {
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print public headers sub directory
     # Print public headers sub directory
     echo ${pubhdr/lib/$1} >>$file
     echo ${pubhdr/lib/$1} >>$file
-    find  $hdrpath/$1 -maxdepth 3 -path */$luapath -prune -o \( -iname "*.h" -o -iname "*.inl" -o -iname "*.hpp" \) -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
+    find  $hdrpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.inl" -o -iname "*.hpp" \) -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
     # Print source files
     # Print source files
     echo ${src/lib/$1} >>$file
     echo ${src/lib/$1} >>$file
-    find  $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o -iname "*.cpp" -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
+    find  $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o -iname "*.cpp" -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
     echo -e ')\n' >>$file
     echo -e ')\n' >>$file
 }
 }
 
 
+printfontdefaultfiles() {
+    # Print headers
+	echo $fontdefaultbegin >>$file
+    echo '    '${hdr/lib/$1} >>$file
+    echo '        ${'$1'_HDR_FILES}' >>$file
+    find  $srcpath/$1/$fontdefaultpath -iname "*.h" -exec echo '        '$srcdir/{} \; 2>/dev/null | sort -f >>$file
+    echo -e '    )\n' >>$file
+    # Print source files
+    echo '    '${src/lib/$1} >>$file
+    echo '        ${'$1'_SRC_FILES}' >>$file
+    find  $srcpath/$1/$fontdefaultpath -iname "*.cpp" -exec echo '        '$srcdir/{} \; 2>/dev/null | sort -f >>$file
+    echo -e '    )' >>$file
+	echo -e $fontdefaultend'\n' >>$file
+}
+
 printluafiles() {
 printluafiles() {
     # Print headers
     # Print headers
     echo ${hdr/lib/Lua${1}} >>$file
     echo ${hdr/lib/Lua${1}} >>$file
@@ -51,6 +69,8 @@ for lib in "Core" "Controls" "Debugger"; do
     printfiles $lib
     printfiles $lib
 done
 done
 
 
+printfontdefaultfiles "Core"
+
 for lib in "Core" "Controls"; do
 for lib in "Core" "Controls"; do
     printluafiles $lib
     printluafiles $lib
 done
 done

+ 1 - 1
CMakeLists.txt

@@ -155,7 +155,7 @@ else(APPLE)
 	endif()
 	endif()
 endif(APPLE)
 endif(APPLE)
 
 
-option(NO_FONT_INTERFACE_DEFAULT "Do not build the font providers that come with the library" OFF)
+option(NO_FONT_INTERFACE_DEFAULT "Do not include the default font engine in the build. Allows building without the FreeType dependency, but a custom font engine must be created and set." OFF)
 if(NO_FONT_INTERFACE_DEFAULT)
 if(NO_FONT_INTERFACE_DEFAULT)
 	add_definitions(-DRMLUI_NO_FONT_INTERFACE_DEFAULT)
 	add_definitions(-DRMLUI_NO_FONT_INTERFACE_DEFAULT)
 endif()
 endif()

+ 0 - 1
Source/Core/Core.cpp

@@ -55,7 +55,6 @@ static FontEngineInterface* font_interface = nullptr;
 
 
 // Default interfaces should be created and destroyed on Initialise and Shutdown, respectively.
 // Default interfaces should be created and destroyed on Initialise and Shutdown, respectively.
 static UniquePtr<FileInterface> default_file_interface;
 static UniquePtr<FileInterface> default_file_interface;
-
 static UniquePtr<FontEngineInterface> default_font_interface;
 static UniquePtr<FontEngineInterface> default_font_interface;
 
 
 static bool initialised = false;
 static bool initialised = false;

+ 0 - 4
Source/Core/FontEngineDefault/FontEngineInterfaceDefault.cpp

@@ -34,8 +34,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 FontEngineInterfaceDefault::FontEngineInterfaceDefault()
 FontEngineInterfaceDefault::FontEngineInterfaceDefault()
 {
 {
 	FontProvider::Initialise();
 	FontProvider::Initialise();
@@ -117,7 +115,5 @@ int FontEngineInterfaceDefault::GetVersion(FontFaceHandle handle)
 	return handle_default->GetVersion();
 	return handle_default->GetVersion();
 }
 }
 
 
-#endif
-
 }
 }
 }
 }

+ 0 - 4
Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp

@@ -37,8 +37,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-	
 FontFaceHandleDefault::FontFaceHandleDefault()
 FontFaceHandleDefault::FontFaceHandleDefault()
 {
 {
 	base_layer = nullptr;
 	base_layer = nullptr;
@@ -439,7 +437,5 @@ bool FontFaceHandleDefault::GenerateLayer(FontFaceLayer* layer)
 	return result;
 	return result;
 }
 }
 
 
-#endif
-
 }
 }
 }
 }

+ 0 - 4
Source/Core/FontEngineDefault/FontFaceHandleDefault.h

@@ -39,8 +39,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 class FontFaceLayer;
 class FontFaceLayer;
 
 
 
 
@@ -147,8 +145,6 @@ private:
 	FontFaceHandleFreetype ft_face;
 	FontFaceHandleFreetype ft_face;
 };
 };
 
 
-#endif
-
 }
 }
 }
 }
 
 

+ 0 - 4
Source/Core/FontEngineDefault/FontFaceLayer.cpp

@@ -33,8 +33,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 FontFaceLayer::FontFaceLayer(const SharedPtr<const FontEffect>& _effect) : colour(255, 255, 255)
 FontFaceLayer::FontFaceLayer(const SharedPtr<const FontEffect>& _effect) : colour(255, 255, 255)
 {
 {
 	effect = _effect;
 	effect = _effect;
@@ -256,7 +254,5 @@ const Colourb& FontFaceLayer::GetColour() const
 	return colour;
 	return colour;
 }
 }
 
 
-#endif
-
 }
 }
 }
 }

+ 0 - 4
Source/Core/FontEngineDefault/FontFaceLayer.h

@@ -38,8 +38,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 class FontEffect;
 class FontEffect;
 class FontFaceHandleDefault;
 class FontFaceHandleDefault;
 
 
@@ -145,8 +143,6 @@ private:
 	Colourb colour;
 	Colourb colour;
 };
 };
 
 
-#endif
-
 }
 }
 }
 }
 
 

+ 0 - 13
Source/Core/FontEngineDefault/FontProvider.cpp

@@ -35,8 +35,6 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 static FontProvider* g_font_provider = nullptr;
 static FontProvider* g_font_provider = nullptr;
 
 
 FontProvider::FontProvider()
 FontProvider::FontProvider()
@@ -72,7 +70,6 @@ FontProvider& FontProvider::Get()
 	return *g_font_provider;
 	return *g_font_provider;
 }
 }
 
 
-// Returns a handle to a font face that can be used to position and render text.
 FontFaceHandleDefault* FontProvider::GetFontFaceHandle(const String& family, Style::FontStyle style, Style::FontWeight weight, int size)
 FontFaceHandleDefault* FontProvider::GetFontFaceHandle(const String& family, Style::FontStyle style, Style::FontWeight weight, int size)
 {
 {
 	RMLUI_ASSERTMSG(family == StringUtilities::ToLower(family), "Font family name must be converted to lowercase before entering here.");
 	RMLUI_ASSERTMSG(family == StringUtilities::ToLower(family), "Font family name must be converted to lowercase before entering here.");
@@ -102,8 +99,6 @@ FontFaceHandleDefault* FontProvider::GetFallbackFontFace(int index, int font_siz
 }
 }
 
 
 
 
-
-// Loads a new font face.
 bool FontProvider::LoadFontFace(const String& file_name, bool fallback_face)
 bool FontProvider::LoadFontFace(const String& file_name, bool fallback_face)
 {
 {
 	FileInterface* file_interface = GetFileInterface();
 	FileInterface* file_interface = GetFileInterface();
@@ -165,10 +160,6 @@ bool FontProvider::LoadFontFace(const byte* data, int data_size, bool fallback_f
 	return true;
 	return true;
 }
 }
 
 
-
-
-
-// Adds a loaded face to the appropriate font family.
 bool FontProvider::AddFace(FontFaceHandleFreetype face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool fallback_face, bool release_stream)
 bool FontProvider::AddFace(FontFaceHandleFreetype face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool fallback_face, bool release_stream)
 {
 {
 	String family_lower = StringUtilities::ToLower(family);
 	String family_lower = StringUtilities::ToLower(family);
@@ -200,9 +191,5 @@ bool FontProvider::AddFace(FontFaceHandleFreetype face, const String& family, St
 }
 }
 
 
 
 
-
-
-#endif
-
 }
 }
 }
 }

+ 0 - 6
Source/Core/FontEngineDefault/FreeTypeInterface.cpp

@@ -28,8 +28,6 @@
 
 
 #include "precompiled.h"
 #include "precompiled.h"
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 #include "FreeTypeInterface.h"
 #include "FreeTypeInterface.h"
 
 
 #include <ft2build.h>
 #include <ft2build.h>
@@ -358,7 +356,6 @@ static bool BuildGlyph(FT_Face ft_face, CodePoint code_point, FontGlyphMap& glyp
 	return true;
 	return true;
 }
 }
 
 
-
 static void GenerateMetrics(FT_Face ft_face, const FontGlyphMap& glyphs, FontMetrics& metrics)
 static void GenerateMetrics(FT_Face ft_face, const FontGlyphMap& glyphs, FontMetrics& metrics)
 {
 {
 	metrics.line_height = ft_face->size->metrics.height >> 6;
 	metrics.line_height = ft_face->size->metrics.height >> 6;
@@ -379,6 +376,3 @@ static void GenerateMetrics(FT_Face ft_face, const FontGlyphMap& glyphs, FontMet
 
 
 }
 }
 }
 }
-
-#endif
-

+ 0 - 4
Source/Core/FontEngineDefault/FreeTypeInterface.h

@@ -29,8 +29,6 @@
 #ifndef RMLUICOREFREETYPEINTERFACE_H
 #ifndef RMLUICOREFREETYPEINTERFACE_H
 #define RMLUICOREFREETYPEINTERFACE_H
 #define RMLUICOREFREETYPEINTERFACE_H
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 #include "FontTypes.h"
 #include "FontTypes.h"
 
 
 namespace Rml {
 namespace Rml {
@@ -65,5 +63,3 @@ int GetKerning(FontFaceHandleFreetype face, int font_size, CodePoint lhs, CodePo
 }
 }
 
 
 #endif
 #endif
-
-#endif

+ 0 - 4
Source/Core/FontEngineDefault/precompiled.h

@@ -29,10 +29,6 @@
 #ifndef RMLUICOREFONTENGINEDEFAULTPRECOMPILED_H
 #ifndef RMLUICOREFONTENGINEDEFAULTPRECOMPILED_H
 #define RMLUICOREFONTENGINEDEFAULTPRECOMPILED_H
 #define RMLUICOREFONTENGINEDEFAULTPRECOMPILED_H
 
 
-#ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-
 #include "../precompiled.h"
 #include "../precompiled.h"
 
 
 #endif
 #endif
-
-#endif