dep/imgui: Use FreeType rasterizer

This commit is contained in:
Stenzek 2024-04-04 19:24:47 +10:00
parent 69588bf7a6
commit ffbb14f508
No known key found for this signature in database
7 changed files with 12 additions and 5 deletions

View File

@ -15,6 +15,7 @@ if(NOT WIN32 AND NOT ANDROID)
find_package(PNG 1.6.40 REQUIRED) find_package(PNG 1.6.40 REQUIRED)
find_package(JPEG REQUIRED) # No version because flatpak uses libjpeg-turbo. find_package(JPEG REQUIRED) # No version because flatpak uses libjpeg-turbo.
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(Freetype 2.13.1 REQUIRED)
if(APPLE) if(APPLE)
set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP}) set(CMAKE_FIND_FRAMEWORK ${FIND_FRAMEWORK_BACKUP})
endif() endif()

View File

@ -1,12 +1,14 @@
set(SRCS set(SRCS
include/imconfig.h include/imconfig.h
include/imgui.h include/imgui.h
include/imgui_freetype.h
include/imgui_internal.h include/imgui_internal.h
include/imgui_stdlib.h include/imgui_stdlib.h
include/imstb_textedit.h include/imstb_textedit.h
src/imgui.cpp src/imgui.cpp
src/imgui_demo.cpp src/imgui_demo.cpp
src/imgui_draw.cpp src/imgui_draw.cpp
src/imgui_freetype.cpp
src/imgui_stdlib.cpp src/imgui_stdlib.cpp
src/imgui_tables.cpp src/imgui_tables.cpp
src/imgui_widgets.cpp src/imgui_widgets.cpp
@ -17,4 +19,4 @@ set(SRCS
add_library(imgui ${SRCS}) add_library(imgui ${SRCS})
target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src") target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_include_directories(imgui INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories(imgui INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(imgui PUBLIC Freetype::Freetype)

View File

@ -4,6 +4,7 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="include\imconfig.h" /> <ClInclude Include="include\imconfig.h" />
<ClInclude Include="include\imgui.h" /> <ClInclude Include="include\imgui.h" />
<ClInclude Include="include\imgui_freetype.h" />
<ClInclude Include="include\imgui_stdlib.h" /> <ClInclude Include="include\imgui_stdlib.h" />
<ClInclude Include="src\imgui_internal.h" /> <ClInclude Include="src\imgui_internal.h" />
<ClInclude Include="src\imstb_rectpack.h" /> <ClInclude Include="src\imstb_rectpack.h" />
@ -13,6 +14,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="src\imgui.cpp" /> <ClCompile Include="src\imgui.cpp" />
<ClCompile Include="src\imgui_draw.cpp" /> <ClCompile Include="src\imgui_draw.cpp" />
<ClCompile Include="src\imgui_freetype.cpp" />
<ClCompile Include="src\imgui_stdlib.cpp" /> <ClCompile Include="src\imgui_stdlib.cpp" />
<ClCompile Include="src\imgui_tables.cpp" /> <ClCompile Include="src\imgui_tables.cpp" />
<ClCompile Include="src\imgui_widgets.cpp" /> <ClCompile Include="src\imgui_widgets.cpp" />
@ -27,7 +29,7 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel> <WarningLevel>TurnOffAllWarnings</WarningLevel>
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)src;$(DepsIncludeDir)freetype2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="..\msvc\vsprops\Targets.props" /> <Import Project="..\msvc\vsprops\Targets.props" />

View File

@ -8,6 +8,7 @@
<ClInclude Include="src\imstb_textedit.h" /> <ClInclude Include="src\imstb_textedit.h" />
<ClInclude Include="src\imstb_truetype.h" /> <ClInclude Include="src\imstb_truetype.h" />
<ClInclude Include="include\imgui_stdlib.h" /> <ClInclude Include="include\imgui_stdlib.h" />
<ClInclude Include="include\imgui_freetype.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\imgui_widgets.cpp" /> <ClCompile Include="src\imgui_widgets.cpp" />
@ -15,6 +16,7 @@
<ClCompile Include="src\imgui_draw.cpp" /> <ClCompile Include="src\imgui_draw.cpp" />
<ClCompile Include="src\imgui_stdlib.cpp" /> <ClCompile Include="src\imgui_stdlib.cpp" />
<ClCompile Include="src\imgui_tables.cpp" /> <ClCompile Include="src\imgui_tables.cpp" />
<ClCompile Include="src\imgui_freetype.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Natvis Include="imgui.natvis" /> <Natvis Include="imgui.natvis" />

View File

@ -76,7 +76,7 @@
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
//#define IMGUI_ENABLE_FREETYPE #define IMGUI_ENABLE_FREETYPE
//---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT) //---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT)
// Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided). // Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided).

View File

@ -34,7 +34,7 @@ Index of this file:
#ifndef IMGUI_DISABLE #ifndef IMGUI_DISABLE
#include "imgui_internal.h" #include "imgui_internal.h"
#ifdef IMGUI_ENABLE_FREETYPE #ifdef IMGUI_ENABLE_FREETYPE
#include "misc/freetype/imgui_freetype.h" #include "imgui_freetype.h"
#endif #endif
#include <stdio.h> // vsnprintf, sscanf, printf #include <stdio.h> // vsnprintf, sscanf, printf

View File

@ -28,7 +28,7 @@
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DepsIncludeDir)SDL2</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DepsIncludeDir)SDL2</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies);libjpeg.lib;libpng16.lib;libwebp.lib;SDL2.lib;zlib.lib;zstd.lib</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies);freetype.lib;libjpeg.lib;libpng16.lib;libwebp.lib;SDL2.lib;zlib.lib;zstd.lib</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>