Skip to content

Commit

Permalink
GUI: experimental FreeType font renderer
Browse files Browse the repository at this point in the history
disabled by default until I feel happy
  • Loading branch information
tildearrow committed Oct 16, 2023
1 parent f44369a commit b379125
Show file tree
Hide file tree
Showing 836 changed files with 516,874 additions and 2 deletions.
34 changes: 34 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ option(WITH_RENDER_SDL "Whether to build with the SDL_Renderer render backend."
option(WITH_RENDER_OPENGL "Whether to build with the OpenGL render backend." ${WITH_RENDER_OPENGL_DEFAULT})
option(WITH_RENDER_DX11 "Whether to build with the DirectX 11 render backend." ${WITH_RENDER_DX11_DEFAULT})
option(USE_GLES "Use OpenGL ES for the OpenGL render backend." ${USE_GLES_DEFAULT})
option(USE_FREETYPE "Use FreeType for font rendering." OFF)
option(SYSTEM_FFTW "Use a system-installed version of FFTW instead of the vendored one" OFF)
option(SYSTEM_FMT "Use a system-installed version of fmt instead of the vendored one" OFF)
option(SYSTEM_FREETYPE "Use a system-installed version of FreeType instead of the vendored one" OFF)
option(SYSTEM_LIBSNDFILE "Use a system-installed version of libsndfile instead of the vendored one" OFF)
option(SYSTEM_PORTAUDIO "Use a system-installed version of PortAudio instead of the vendored one" OFF)
option(SYSTEM_RTMIDI "Use a system-installed version of RtMidi instead of the vendored one" OFF)
Expand Down Expand Up @@ -192,6 +194,34 @@ else()
message(STATUS "Using vendored fmt")
endif()

if (BUILD_GUI AND USE_FREETYPE)
# TODO: FIX FIX FIX FIX FIX
if (SYSTEM_FREETYPE)
if (PKG_CONFIG_FOUND)
pkg_check_modules(FREETYPE freetype>=2.0.0)
if (FREETYPE_FOUND)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${FMT_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${FMT_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARIES ${FMT_LIBRARIES})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${FMT_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${FMT_LDFLAGS_OTHER})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${FMT_LDFLAGS})
endif()
endif()
if (NOT FREETYPE_FOUND)
find_package(freetype REQUIRED)
list(APPEND DEPENDENCIES_LIBRARIES freetype::freetype)
endif()
message(STATUS "Using system-installed FreeType")
else()
add_subdirectory(extern/freetype EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/freetype/include)
list(APPEND DEPENDENCIES_LIBRARIES freetype)
message(STATUS "Using vendored FreeType")
endif()
list(APPEND DEPENDENCIES_DEFINES HAVE_FREETYPE)
endif()

if (USE_SNDFILE)
list(APPEND DEPENDENCIES_DEFINES HAVE_SNDFILE)
if (SYSTEM_LIBSNDFILE)
Expand Down Expand Up @@ -782,6 +812,10 @@ if (WIN32 AND NOT SUPPORT_XP)
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_win.cpp)
endif()

if (USE_FREETYPE)
list(APPEND GUI_SOURCES extern/imgui_patched/misc/freetype/imgui_freetype.cpp)
endif()

if (APPLE)
list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_common.cpp)
list(APPEND GUI_SOURCES src/gui/macstuff.m)
Expand Down
16 changes: 16 additions & 0 deletions extern/freetype/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
BasedOnStyle: Chromium
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
# AlignOperands: Align
AlignTrailingComments: true
AlwaysBreakAfterReturnType: AllDefinitions
BreakBeforeBraces: Allman
ColumnLimit: 80
DerivePointerAlignment: false
IndentCaseLabels: false
PointerAlignment: Left
SpaceBeforeParens: ControlStatements
SpacesInParentheses: true
Loading

0 comments on commit b379125

Please sign in to comment.