summaryrefslogtreecommitdiff
path: root/imgui-1.92.1/misc
diff options
context:
space:
mode:
Diffstat (limited to 'imgui-1.92.1/misc')
-rw-r--r--imgui-1.92.1/misc/README.txt23
-rw-r--r--imgui-1.92.1/misc/cpp/README.txt13
-rw-r--r--imgui-1.92.1/misc/cpp/imgui_stdlib.cpp88
-rw-r--r--imgui-1.92.1/misc/cpp/imgui_stdlib.h25
-rw-r--r--imgui-1.92.1/misc/debuggers/README.txt16
-rw-r--r--imgui-1.92.1/misc/debuggers/imgui.gdb12
-rw-r--r--imgui-1.92.1/misc/debuggers/imgui.natstepfilter31
-rw-r--r--imgui-1.92.1/misc/debuggers/imgui.natvis58
-rw-r--r--imgui-1.92.1/misc/fonts/Cousine-Regular.ttfbin43912 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/DroidSans.ttfbin190044 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/Karla-Regular.ttfbin16848 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/ProggyClean.ttfbin41208 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/ProggyTiny.ttfbin35656 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/Roboto-Medium.ttfbin162588 -> 0 bytes
-rw-r--r--imgui-1.92.1/misc/fonts/binary_to_compressed_c.cpp424
-rw-r--r--imgui-1.92.1/misc/freetype/README.md54
-rw-r--r--imgui-1.92.1/misc/freetype/imgui_freetype.cpp751
-rw-r--r--imgui-1.92.1/misc/freetype/imgui_freetype.h83
-rw-r--r--imgui-1.92.1/misc/single_file/imgui_single_file.h29
19 files changed, 0 insertions, 1607 deletions
diff --git a/imgui-1.92.1/misc/README.txt b/imgui-1.92.1/misc/README.txt
deleted file mode 100644
index b4ce89f..0000000
--- a/imgui-1.92.1/misc/README.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-
-misc/cpp/
- InputText() wrappers for C++ standard library (STL) type: std::string.
- This is also an example of how you may wrap your own similar types.
-
-misc/debuggers/
- Helper files for popular debuggers.
- With the .natvis file, types like ImVector<> will be displayed nicely in Visual Studio debugger.
-
-misc/fonts/
- Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts).
- Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code.
- Suggested fonts and links.
-
-misc/freetype/
- Font atlas builder/rasterizer using FreeType instead of stb_truetype.
- Benefit from better FreeType rasterization, in particular for small fonts.
-
-misc/single_file/
- Single-file header stub.
- We use this to validate compiling all *.cpp files in a same compilation unit.
- Users of that technique (also called "Unity builds") can generally provide this themselves,
- so we don't really recommend you use this in your projects.
diff --git a/imgui-1.92.1/misc/cpp/README.txt b/imgui-1.92.1/misc/cpp/README.txt
deleted file mode 100644
index 17f0a3c..0000000
--- a/imgui-1.92.1/misc/cpp/README.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-imgui_stdlib.h + imgui_stdlib.cpp
- InputText() wrappers for C++ standard library (STL) type: std::string.
- This is also an example of how you may wrap your own similar types.
-
-imgui_scoped.h
- [Experimental, not currently in main repository]
- Additional header file with some RAII-style wrappers for common Dear ImGui functions.
- Try by merging: https://github.com/ocornut/imgui/pull/2197
- Discuss at: https://github.com/ocornut/imgui/issues/2096
-
-See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
- https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
diff --git a/imgui-1.92.1/misc/cpp/imgui_stdlib.cpp b/imgui-1.92.1/misc/cpp/imgui_stdlib.cpp
deleted file mode 100644
index c04d487..0000000
--- a/imgui-1.92.1/misc/cpp/imgui_stdlib.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
-// This is also an example of how you may wrap your own similar types.
-
-// Changelog:
-// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
-
-// See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
-// https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
-
-#include "imgui.h"
-#ifndef IMGUI_DISABLE
-#include "imgui_stdlib.h"
-
-// Clang warnings with -Weverything
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
-#endif
-
-struct InputTextCallback_UserData
-{
- std::string* Str;
- ImGuiInputTextCallback ChainCallback;
- void* ChainCallbackUserData;
-};
-
-static int InputTextCallback(ImGuiInputTextCallbackData* data)
-{
- InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
- if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
- {
- // Resize string callback
- // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
- std::string* str = user_data->Str;
- IM_ASSERT(data->Buf == str->c_str());
- str->resize(data->BufTextLen);
- data->Buf = (char*)str->c_str();
- }
- else if (user_data->ChainCallback)
- {
- // Forward to user callback, if any
- data->UserData = user_data->ChainCallbackUserData;
- return user_data->ChainCallback(data);
- }
- return 0;
-}
-
-bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
-{
- IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
- flags |= ImGuiInputTextFlags_CallbackResize;
-
- InputTextCallback_UserData cb_user_data;
- cb_user_data.Str = str;
- cb_user_data.ChainCallback = callback;
- cb_user_data.ChainCallbackUserData = user_data;
- return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
-}
-
-bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
-{
- IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
- flags |= ImGuiInputTextFlags_CallbackResize;
-
- InputTextCallback_UserData cb_user_data;
- cb_user_data.Str = str;
- cb_user_data.ChainCallback = callback;
- cb_user_data.ChainCallbackUserData = user_data;
- return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
-}
-
-bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
-{
- IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
- flags |= ImGuiInputTextFlags_CallbackResize;
-
- InputTextCallback_UserData cb_user_data;
- cb_user_data.Str = str;
- cb_user_data.ChainCallback = callback;
- cb_user_data.ChainCallbackUserData = user_data;
- return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
-}
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
-#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui-1.92.1/misc/cpp/imgui_stdlib.h b/imgui-1.92.1/misc/cpp/imgui_stdlib.h
deleted file mode 100644
index 697fc34..0000000
--- a/imgui-1.92.1/misc/cpp/imgui_stdlib.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
-// This is also an example of how you may wrap your own similar types.
-
-// Changelog:
-// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
-
-// See more C++ related extension (fmt, RAII, syntaxis sugar) on Wiki:
-// https://github.com/ocornut/imgui/wiki/Useful-Extensions#cness
-
-#pragma once
-
-#ifndef IMGUI_DISABLE
-
-#include <string>
-
-namespace ImGui
-{
- // ImGui::InputText() with std::string
- // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity
- IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
- IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
- IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = nullptr, void* user_data = nullptr);
-}
-
-#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui-1.92.1/misc/debuggers/README.txt b/imgui-1.92.1/misc/debuggers/README.txt
deleted file mode 100644
index 3f4ba83..0000000
--- a/imgui-1.92.1/misc/debuggers/README.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-HELPER FILES FOR POPULAR DEBUGGERS
-
-imgui.gdb
- GDB: disable stepping into trivial functions.
- (read comments inside file for details)
-
-imgui.natstepfilter
- Visual Studio Debugger: disable stepping into trivial functions.
- (read comments inside file for details)
-
-imgui.natvis
- Visual Studio Debugger: describe Dear ImGui types for better display.
- With this, types like ImVector<> will be displayed nicely in the debugger.
- (read comments inside file for details)
-
diff --git a/imgui-1.92.1/misc/debuggers/imgui.gdb b/imgui-1.92.1/misc/debuggers/imgui.gdb
deleted file mode 100644
index 000ff6e..0000000
--- a/imgui-1.92.1/misc/debuggers/imgui.gdb
+++ /dev/null
@@ -1,12 +0,0 @@
-# GDB configuration to aid debugging experience
-
-# To enable these customizations edit $HOME/.gdbinit (or ./.gdbinit if local gdbinit is enabled) and add:
-# add-auto-load-safe-path /path/to/imgui.gdb
-# source /path/to/imgui.gdb
-#
-# More Information at:
-# * https://sourceware.org/gdb/current/onlinedocs/gdb/gdbinit-man.html
-# * https://sourceware.org/gdb/current/onlinedocs/gdb/Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory
-
-# Disable stepping into trivial functions
-skip -rfunction Im(Vec2|Vec4|Strv|Vector|Span)::.+
diff --git a/imgui-1.92.1/misc/debuggers/imgui.natstepfilter b/imgui-1.92.1/misc/debuggers/imgui.natstepfilter
deleted file mode 100644
index 6825c93..0000000
--- a/imgui-1.92.1/misc/debuggers/imgui.natstepfilter
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-.natstepfilter file for Visual Studio debugger.
-Purpose: instruct debugger to skip some functions when using StepInto (F11)
-
-Since Visual Studio 2022 version 17.6 Preview 2 (currently available as a "Preview" build on March 14, 2023)
-It is possible to add the .natstepfilter file to your project file and it will automatically be used.
-(https://developercommunity.visualstudio.com/t/allow-natstepfilter-and-natjmc-to-be-included-as-p/561718)
-
-For older Visual Studio version prior to 2022 17.6 Preview 2:
-* copy in %USERPROFILE%\Documents\Visual Studio XXXX\Visualizers (current user)
-* or copy in %VsInstallDirectory%\Common7\Packages\Debugger\Visualizers (all users)
-If you have multiple VS version installed, the version that matters is the one you are using the IDE/debugger
-of (not the compiling toolset). This is supported since Visual Studio 2012.
-
-More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code?view=vs-2019#BKMK_C___Just_My_Code
--->
-
-<StepFilter xmlns="http://schemas.microsoft.com/vstudio/debugger/natstepfilter/2010">
-
- <!-- Disable stepping into trivial functions -->
- <Function>
- <Name>(ImVec2|ImVec4|ImStrv)::.+</Name>
- <Action>NoStepInto</Action>
- </Function>
- <Function>
- <Name>(ImVector|ImSpan).*::operator.+</Name>
- <Action>NoStepInto</Action>
- </Function>
-
-</StepFilter>
diff --git a/imgui-1.92.1/misc/debuggers/imgui.natvis b/imgui-1.92.1/misc/debuggers/imgui.natvis
deleted file mode 100644
index 13b6360..0000000
--- a/imgui-1.92.1/misc/debuggers/imgui.natvis
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-.natvis file for Visual Studio debugger.
-Purpose: provide nicer views on data types used by Dear ImGui.
-
-To enable:
-* include file in your VS project (most recommended: not intrusive and always kept up to date!)
-* or copy in %USERPROFILE%\Documents\Visual Studio XXXX\Visualizers (current user)
-* or copy in %VsInstallDirectory%\Common7\Packages\Debugger\Visualizers (all users)
-
-More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019
--->
-
-<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
-
-<Type Name="ImVector&lt;*&gt;">
- <DisplayString>{{Size={Size} Capacity={Capacity}}}</DisplayString>
- <Expand>
- <ArrayItems>
- <Size>Size</Size>
- <ValuePointer>Data</ValuePointer>
- </ArrayItems>
- </Expand>
-</Type>
-
-<Type Name="ImSpan&lt;*&gt;">
- <DisplayString>{{Size={DataEnd-Data} }}</DisplayString>
- <Expand>
- <ArrayItems>
- <Size>DataEnd-Data</Size>
- <ValuePointer>Data</ValuePointer>
- </ArrayItems>
- </Expand>
-</Type>
-
-<Type Name="ImVec2">
- <DisplayString>{{x={x,g} y={y,g}}}</DisplayString>
-</Type>
-
-<Type Name="ImVec4">
- <DisplayString>{{x={x,g} y={y,g} z={z,g} w={w,g}}}</DisplayString>
-</Type>
-
-<Type Name="ImRect">
- <DisplayString>{{Min=({Min.x,g} {Min.y,g}) Max=({Max.x,g} {Max.y,g}) Size=({Max.x-Min.x,g} {Max.y-Min.y,g})}}</DisplayString>
- <Expand>
- <Item Name="Min">Min</Item>
- <Item Name="Max">Max</Item>
- <Item Name="[Width]">Max.x - Min.x</Item>
- <Item Name="[Height]">Max.y - Min.y</Item>
- </Expand>
-</Type>
-
-<Type Name="ImGuiWindow">
- <DisplayString>{{Name {Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags &amp; 0x01000000)?1:0,d} Popup {(Flags &amp; 0x04000000)?1:0,d} Hidden {(Hidden)?1:0,d}}</DisplayString>
-</Type>
-
-</AutoVisualizer>
diff --git a/imgui-1.92.1/misc/fonts/Cousine-Regular.ttf b/imgui-1.92.1/misc/fonts/Cousine-Regular.ttf
deleted file mode 100644
index 70a0bf9..0000000
--- a/imgui-1.92.1/misc/fonts/Cousine-Regular.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/DroidSans.ttf b/imgui-1.92.1/misc/fonts/DroidSans.ttf
deleted file mode 100644
index 767c63a..0000000
--- a/imgui-1.92.1/misc/fonts/DroidSans.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/Karla-Regular.ttf b/imgui-1.92.1/misc/fonts/Karla-Regular.ttf
deleted file mode 100644
index 81b3de6..0000000
--- a/imgui-1.92.1/misc/fonts/Karla-Regular.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/ProggyClean.ttf b/imgui-1.92.1/misc/fonts/ProggyClean.ttf
deleted file mode 100644
index 0270cdf..0000000
--- a/imgui-1.92.1/misc/fonts/ProggyClean.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/ProggyTiny.ttf b/imgui-1.92.1/misc/fonts/ProggyTiny.ttf
deleted file mode 100644
index 1c4312c..0000000
--- a/imgui-1.92.1/misc/fonts/ProggyTiny.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/Roboto-Medium.ttf b/imgui-1.92.1/misc/fonts/Roboto-Medium.ttf
deleted file mode 100644
index 39c63d7..0000000
--- a/imgui-1.92.1/misc/fonts/Roboto-Medium.ttf
+++ /dev/null
Binary files differ
diff --git a/imgui-1.92.1/misc/fonts/binary_to_compressed_c.cpp b/imgui-1.92.1/misc/fonts/binary_to_compressed_c.cpp
deleted file mode 100644
index da98831..0000000
--- a/imgui-1.92.1/misc/fonts/binary_to_compressed_c.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-// dear imgui
-// (binary_to_compressed_c.cpp)
-// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
-
-// The data is first compressed with stb_compress() to reduce source code size.
-// Then stored in a C array:
-// - Base85: ~5 bytes of source code for 4 bytes of input data. 5 bytes stored in binary (suggested by @mmalex).
-// - As int: ~11 bytes of source code for 4 bytes of input data. 4 bytes stored in binary. Endianness dependent, need swapping on big-endian CPU.
-// - As char: ~12 bytes of source code for 4 bytes of input data. 4 bytes stored in binary. Not endianness dependent.
-// Load compressed TTF fonts with ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF()
-
-// Build with, e.g:
-// # cl.exe binary_to_compressed_c.cpp
-// # g++ binary_to_compressed_c.cpp
-// # clang++ binary_to_compressed_c.cpp
-// You can also find a precompiled Windows binary in the binary/demo package available from https://github.com/ocornut/imgui
-
-// Usage:
-// binary_to_compressed_c.exe [-nocompress] [-nostatic] [-base85] <inputfile> <symbolname>
-// Usage example:
-// # binary_to_compressed_c.exe myfont.ttf MyFont > myfont.cpp
-// # binary_to_compressed_c.exe -base85 myfont.ttf MyFont > myfont.cpp
-// Note:
-// Base85 encoding will be obsoleted by future version of Dear ImGui!
-
-#define _CRT_SECURE_NO_WARNINGS
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-// stb_compress* from stb.h - declaration
-typedef unsigned int stb_uint;
-typedef unsigned char stb_uchar;
-stb_uint stb_compress(stb_uchar* out, stb_uchar* in, stb_uint len);
-
-enum SourceEncoding
-{
- SourceEncoding_U8, // New default since 2024/11
- SourceEncoding_U32,
- SourceEncoding_Base85,
-};
-
-static bool binary_to_compressed_c(const char* filename, const char* symbol, SourceEncoding source_encoding, bool use_compression, bool use_static);
-
-int main(int argc, char** argv)
-{
- if (argc < 3)
- {
- printf("Syntax: %s [-u8|-u32|-base85] [-nocompress] [-nostatic] <inputfile> <symbolname>\n", argv[0]);
- printf("Source encoding types:\n");
- printf(" -u8 = ~12 bytes of source per 4 bytes of data. 4 bytes in binary.\n");
- printf(" -u32 = ~11 bytes of source per 4 bytes of data. 4 bytes in binary. Need endianness swapping on big-endian.\n");
- printf(" -base85 = ~5 bytes of source per 4 bytes of data. 5 bytes in binary. Need decoder.\n");
- return 0;
- }
-
- int argn = 1;
- bool use_compression = true;
- bool use_static = true;
- SourceEncoding source_encoding = SourceEncoding_U8; // New default
- while (argn < (argc - 2) && argv[argn][0] == '-')
- {
- if (strcmp(argv[argn], "-u8") == 0) { source_encoding = SourceEncoding_U8; argn++; }
- else if (strcmp(argv[argn], "-u32") == 0) { source_encoding = SourceEncoding_U32; argn++; }
- else if (strcmp(argv[argn], "-base85") == 0) { source_encoding = SourceEncoding_Base85; argn++; }
- else if (strcmp(argv[argn], "-nocompress") == 0) { use_compression = false; argn++; }
- else if (strcmp(argv[argn], "-nostatic") == 0) { use_static = false; argn++; }
- else
- {
- fprintf(stderr, "Unknown argument: '%s'\n", argv[argn]);
- return 1;
- }
- }
-
- bool ret = binary_to_compressed_c(argv[argn], argv[argn + 1], source_encoding, use_compression, use_static);
- if (!ret)
- fprintf(stderr, "Error opening or reading file: '%s'\n", argv[argn]);
- return ret ? 0 : 1;
-}
-
-char Encode85Byte(unsigned int x)
-{
- x = (x % 85) + 35;
- return (char)((x >= '\\') ? x + 1 : x);
-}
-
-bool binary_to_compressed_c(const char* filename, const char* symbol, SourceEncoding source_encoding, bool use_compression, bool use_static)
-{
- // Read file
- FILE* f = fopen(filename, "rb");
- if (!f) return false;
- int data_sz;
- if (fseek(f, 0, SEEK_END) || (data_sz = (int)ftell(f)) == -1 || fseek(f, 0, SEEK_SET)) { fclose(f); return false; }
- char* data = new char[data_sz + 4];
- if (fread(data, 1, data_sz, f) != (size_t)data_sz) { fclose(f); delete[] data; return false; }
- memset((void*)(((char*)data) + data_sz), 0, 4);
- fclose(f);
-
- // Compress
- int maxlen = data_sz + 512 + (data_sz >> 2) + sizeof(int); // total guess
- char* compressed = use_compression ? new char[maxlen] : data;
- int compressed_sz = use_compression ? stb_compress((stb_uchar*)compressed, (stb_uchar*)data, data_sz) : data_sz;
- if (use_compression)
- memset(compressed + compressed_sz, 0, maxlen - compressed_sz);
-
- // Output as Base85 encoded
- FILE* out = stdout;
- fprintf(out, "// File: '%s' (%d bytes)\n", filename, (int)data_sz);
- const char* static_str = use_static ? "static " : "";
- const char* compressed_str = use_compression ? "compressed_" : "";
- if (source_encoding == SourceEncoding_Base85)
- {
- fprintf(out, "// Exported using binary_to_compressed_c.exe -base85 \"%s\" %s\n", filename, symbol);
- fprintf(out, "%sconst char %s_%sdata_base85[%d+1] =\n \"", static_str, symbol, compressed_str, (int)((compressed_sz + 3) / 4)*5);
- char prev_c = 0;
- for (int src_i = 0; src_i < compressed_sz; src_i += 4)
- {
- // This is made a little more complicated by the fact that ??X sequences are interpreted as trigraphs by old C/C++ compilers. So we need to escape pairs of ??.
- unsigned int d = *(unsigned int*)(compressed + src_i);
- for (unsigned int n5 = 0; n5 < 5; n5++, d /= 85)
- {
- char c = Encode85Byte(d);
- fprintf(out, (c == '?' && prev_c == '?') ? "\\%c" : "%c", c);
- prev_c = c;
- }
- if ((src_i % 112) == 112 - 4)
- fprintf(out, "\"\n \"");
- }
- fprintf(out, "\";\n\n");
- }
- else if (source_encoding == SourceEncoding_U8)
- {
- // As individual bytes, not subject to endianness issues.
- fprintf(out, "// Exported using binary_to_compressed_c.exe -u8 \"%s\" %s\n", filename, symbol);
- fprintf(out, "%sconst unsigned int %s_%ssize = %d;\n", static_str, symbol, compressed_str, (int)compressed_sz);
- fprintf(out, "%sconst unsigned char %s_%sdata[%d] =\n{", static_str, symbol, compressed_str, (int)compressed_sz);
- int column = 0;
- for (int i = 0; i < compressed_sz; i++)
- {
- unsigned char d = *(unsigned char*)(compressed + i);
- if (column == 0)
- fprintf(out, "\n ");
- column += fprintf(out, "%d,", d);
- if (column >= 180)
- column = 0;
- }
- fprintf(out, "\n};\n\n");
- }
- else if (source_encoding == SourceEncoding_U32)
- {
- // As integers
- fprintf(out, "// Exported using binary_to_compressed_c.exe -u32 \"%s\" %s\n", filename, symbol);
- fprintf(out, "%sconst unsigned int %s_%ssize = %d;\n", static_str, symbol, compressed_str, (int)compressed_sz);
- fprintf(out, "%sconst unsigned int %s_%sdata[%d/4] =\n{", static_str, symbol, compressed_str, (int)((compressed_sz + 3) / 4)*4);
- int column = 0;
- for (int i = 0; i < compressed_sz; i += 4)
- {
- unsigned int d = *(unsigned int*)(compressed + i);
- if ((column++ % 14) == 0)
- fprintf(out, "\n 0x%08x, ", d);
- else
- fprintf(out, "0x%08x, ", d);
- }
- fprintf(out, "\n};\n\n");
- }
-
- // Cleanup
- delete[] data;
- if (use_compression)
- delete[] compressed;
- return true;
-}
-
-// stb_compress* from stb.h - definition
-
-//////////////////// compressor ///////////////////////
-
-static stb_uint stb_adler32(stb_uint adler32, stb_uchar *buffer, stb_uint buflen)
-{
- const unsigned long ADLER_MOD = 65521;
- unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;
- unsigned long blocklen, i;
-
- blocklen = buflen % 5552;
- while (buflen) {
- for (i=0; i + 7 < blocklen; i += 8) {
- s1 += buffer[0], s2 += s1;
- s1 += buffer[1], s2 += s1;
- s1 += buffer[2], s2 += s1;
- s1 += buffer[3], s2 += s1;
- s1 += buffer[4], s2 += s1;
- s1 += buffer[5], s2 += s1;
- s1 += buffer[6], s2 += s1;
- s1 += buffer[7], s2 += s1;
-
- buffer += 8;
- }
-
- for (; i < blocklen; ++i)
- s1 += *buffer++, s2 += s1;
-
- s1 %= ADLER_MOD, s2 %= ADLER_MOD;
- buflen -= blocklen;
- blocklen = 5552;
- }
- return (s2 << 16) + s1;
-}
-
-static unsigned int stb_matchlen(stb_uchar *m1, stb_uchar *m2, stb_uint maxlen)
-{
- stb_uint i;
- for (i=0; i < maxlen; ++i)
- if (m1[i] != m2[i]) return i;
- return i;
-}
-
-// simple implementation that just takes the source data in a big block
-
-static stb_uchar *stb__out;
-static FILE *stb__outfile;
-static stb_uint stb__outbytes;
-
-static void stb__write(unsigned char v)
-{
- fputc(v, stb__outfile);
- ++stb__outbytes;
-}
-
-//#define stb_out(v) (stb__out ? *stb__out++ = (stb_uchar) (v) : stb__write((stb_uchar) (v)))
-#define stb_out(v) do { if (stb__out) *stb__out++ = (stb_uchar) (v); else stb__write((stb_uchar) (v)); } while (0)
-
-static void stb_out2(stb_uint v) { stb_out(v >> 8); stb_out(v); }
-static void stb_out3(stb_uint v) { stb_out(v >> 16); stb_out(v >> 8); stb_out(v); }
-static void stb_out4(stb_uint v) { stb_out(v >> 24); stb_out(v >> 16); stb_out(v >> 8 ); stb_out(v); }
-
-static void outliterals(stb_uchar *in, int numlit)
-{
- while (numlit > 65536) {
- outliterals(in,65536);
- in += 65536;
- numlit -= 65536;
- }
-
- if (numlit == 0) ;
- else if (numlit <= 32) stb_out (0x000020 + numlit-1);
- else if (numlit <= 2048) stb_out2(0x000800 + numlit-1);
- else /* numlit <= 65536) */ stb_out3(0x070000 + numlit-1);
-
- if (stb__out) {
- memcpy(stb__out,in,numlit);
- stb__out += numlit;
- } else
- fwrite(in, 1, numlit, stb__outfile);
-}
-
-static int stb__window = 0x40000; // 256K
-
-static int stb_not_crap(int best, int dist)
-{
- return ((best > 2 && dist <= 0x00100)
- || (best > 5 && dist <= 0x04000)
- || (best > 7 && dist <= 0x80000));
-}
-
-static stb_uint stb__hashsize = 32768;
-
-// note that you can play with the hashing functions all you
-// want without needing to change the decompressor
-#define stb__hc(q,h,c) (((h) << 7) + ((h) >> 25) + q[c])
-#define stb__hc2(q,h,c,d) (((h) << 14) + ((h) >> 18) + (q[c] << 7) + q[d])
-#define stb__hc3(q,c,d,e) ((q[c] << 14) + (q[d] << 7) + q[e])
-
-static unsigned int stb__running_adler;
-
-static int stb_compress_chunk(stb_uchar *history,
- stb_uchar *start,
- stb_uchar *end,
- int length,
- int *pending_literals,
- stb_uchar **chash,
- stb_uint mask)
-{
- (void)history;
- int window = stb__window;
- stb_uint match_max;
- stb_uchar *lit_start = start - *pending_literals;
- stb_uchar *q = start;
-
-#define STB__SCRAMBLE(h) (((h) + ((h) >> 16)) & mask)
-
- // stop short of the end so we don't scan off the end doing
- // the hashing; this means we won't compress the last few bytes
- // unless they were part of something longer
- while (q < start+length && q+12 < end) {
- int m;
- stb_uint h1,h2,h3,h4, h;
- stb_uchar *t;
- int best = 2, dist=0;
-
- if (q+65536 > end)
- match_max = (stb_uint)(end-q);
- else
- match_max = 65536;
-
-#define stb__nc(b,d) ((d) <= window && ((b) > 9 || stb_not_crap((int)(b),(int)(d))))
-
-#define STB__TRY(t,p) /* avoid retrying a match we already tried */ \
- if (p ? dist != (int)(q-t) : 1) \
- if ((m = stb_matchlen(t, q, match_max)) > best) \
- if (stb__nc(m,q-(t))) \
- best = m, dist = (int)(q - (t))
-
- // rather than search for all matches, only try 4 candidate locations,
- // chosen based on 4 different hash functions of different lengths.
- // this strategy is inspired by LZO; hashing is unrolled here using the
- // 'hc' macro
- h = stb__hc3(q,0, 1, 2); h1 = STB__SCRAMBLE(h);
- t = chash[h1]; if (t) STB__TRY(t,0);
- h = stb__hc2(q,h, 3, 4); h2 = STB__SCRAMBLE(h);
- h = stb__hc2(q,h, 5, 6); t = chash[h2]; if (t) STB__TRY(t,1);
- h = stb__hc2(q,h, 7, 8); h3 = STB__SCRAMBLE(h);
- h = stb__hc2(q,h, 9,10); t = chash[h3]; if (t) STB__TRY(t,1);
- h = stb__hc2(q,h,11,12); h4 = STB__SCRAMBLE(h);
- t = chash[h4]; if (t) STB__TRY(t,1);
-
- // because we use a shared hash table, can only update it
- // _after_ we've probed all of them
- chash[h1] = chash[h2] = chash[h3] = chash[h4] = q;
-
- if (best > 2)
- assert(dist > 0);
-
- // see if our best match qualifies
- if (best < 3) { // fast path literals
- ++q;
- } else if (best > 2 && best <= 0x80 && dist <= 0x100) {
- outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
- stb_out(0x80 + best-1);
- stb_out(dist-1);
- } else if (best > 5 && best <= 0x100 && dist <= 0x4000) {
- outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
- stb_out2(0x4000 + dist-1);
- stb_out(best-1);
- } else if (best > 7 && best <= 0x100 && dist <= 0x80000) {
- outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
- stb_out3(0x180000 + dist-1);
- stb_out(best-1);
- } else if (best > 8 && best <= 0x10000 && dist <= 0x80000) {
- outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
- stb_out3(0x100000 + dist-1);
- stb_out2(best-1);
- } else if (best > 9 && dist <= 0x1000000) {
- if (best > 65536) best = 65536;
- outliterals(lit_start, (int)(q-lit_start)); lit_start = (q += best);
- if (best <= 0x100) {
- stb_out(0x06);
- stb_out3(dist-1);
- stb_out(best-1);
- } else {
- stb_out(0x04);
- stb_out3(dist-1);
- stb_out2(best-1);
- }
- } else { // fallback literals if no match was a balanced tradeoff
- ++q;
- }
- }
-
- // if we didn't get all the way, add the rest to literals
- if (q-start < length)
- q = start+length;
-
- // the literals are everything from lit_start to q
- *pending_literals = (int)(q - lit_start);
-
- stb__running_adler = stb_adler32(stb__running_adler, start, (stb_uint)(q - start));
- return (int)(q - start);
-}
-
-static int stb_compress_inner(stb_uchar *input, stb_uint length)
-{
- int literals = 0;
- stb_uint len,i;
-
- stb_uchar **chash;
- chash = (stb_uchar**) malloc(stb__hashsize * sizeof(stb_uchar*));
- if (chash == nullptr) return 0; // failure
- for (i=0; i < stb__hashsize; ++i)
- chash[i] = nullptr;
-
- // stream signature
- stb_out(0x57); stb_out(0xbc);
- stb_out2(0);
-
- stb_out4(0); // 64-bit length requires 32-bit leading 0
- stb_out4(length);
- stb_out4(stb__window);
-
- stb__running_adler = 1;
-
- len = stb_compress_chunk(input, input, input+length, length, &literals, chash, stb__hashsize-1);
- assert(len == length);
-
- outliterals(input+length - literals, literals);
-
- free(chash);
-
- stb_out2(0x05fa); // end opcode
-
- stb_out4(stb__running_adler);
-
- return 1; // success
-}
-
-stb_uint stb_compress(stb_uchar *out, stb_uchar *input, stb_uint length)
-{
- stb__out = out;
- stb__outfile = nullptr;
-
- stb_compress_inner(input, length);
-
- return (stb_uint)(stb__out - out);
-}
diff --git a/imgui-1.92.1/misc/freetype/README.md b/imgui-1.92.1/misc/freetype/README.md
deleted file mode 100644
index e1bd019..0000000
--- a/imgui-1.92.1/misc/freetype/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# imgui_freetype
-
-Build font atlases using FreeType instead of stb_truetype (which is the default font rasterizer).
-<br>by @vuhdo, @mikesart, @ocornut.
-
-### Usage
-
-1. Get latest FreeType binaries or build yourself (under Windows you may use vcpkg with `vcpkg install freetype --triplet=x64-windows`, `vcpkg integrate install`).
-2. Add imgui_freetype.h/cpp alongside your project files.
-3. Add `#define IMGUI_ENABLE_FREETYPE` in your [imconfig.h](https://github.com/ocornut/imgui/blob/master/imconfig.h) file
-
-### About Gamma Correct Blending
-
-FreeType assumes blending in linear space rather than gamma space.
-See FreeType note for [FT_Render_Glyph](https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_render_glyph).
-For correct results you need to be using sRGB and convert to linear space in the pixel shader output.
-The default Dear ImGui styles will be impacted by this change (alpha values will need tweaking).
-
-### Testbed for toying with settings (for developers)
-
-See https://gist.github.com/ocornut/b3a9ecf13502fd818799a452969649ad
-
-### Known issues
-
-- Oversampling settings are ignored but also not so much necessary with the higher quality rendering.
-
-### Comparison
-
-Small, thin anti-aliased fonts typically benefit a lot from FreeType's hinting:
-![comparing_font_rasterizers](https://user-images.githubusercontent.com/8225057/107550178-fef87f00-6bd0-11eb-8d09-e2edb2f0ccfc.gif)
-
-### Colorful glyphs/emojis
-
-You can use the `ImGuiFreeTypeBuilderFlags_LoadColor` flag to load certain colorful glyphs. See the
-["Using Colorful Glyphs/Emojis"](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#using-colorful-glyphsemojis) section of FONTS.md.
-
-![colored glyphs](https://user-images.githubusercontent.com/8225057/106171241-9dc4ba80-6191-11eb-8a69-ca1467b206d1.png)
-
-### Using OpenType SVG fonts (SVGinOT)
-- *SVG in Open Type* is a standard by Adobe and Mozilla for color OpenType and Open Font Format fonts. It allows font creators to embed complete SVG files within a font enabling full color and even animations.
-- Popular fonts such as [twemoji](https://github.com/13rac1/twemoji-color-font) and fonts made with [scfbuild](https://github.com/13rac1/scfbuild) is SVGinOT.
-- Two alternatives are possible to render SVG fonts: use "lunasvg" or "plutosvg". plutosvg will support some more fonts (e.g. NotoColorEmoji-Regular) and may load them faster.
-
-#### Using lunasvg
-Requires: [lunasvg](https://github.com/sammycage/lunasvg) v2.3.2 and above
-- Add `#define IMGUI_ENABLE_FREETYPE_LUNASVG` in your `imconfig.h`.
-- Get latest lunasvg binaries or build yourself. Under Windows you may use vcpkg with: `vcpkg install lunasvg --triplet=x64-windows`.
-
-#### Using plutosvg (and plutovg)
-- Add `#define IMGUI_ENABLE_FREETYPE_PLUTOSVG` in your `imconfig.h`.
-- Get latest plutosvg binaries or build yourself. Under Windows you may use vcpkg with: `vcpkg install plutosvg --triplet=x64-windows`. Alternatively, if you build imgui from vcpkg, you just need to enable the plutosvg feature: `vcpkg install imgui[plutosvg] --triplet=x64-windows`
-- If you prefer to build plutosvg manually:
- - Compilation hints for plutovg: Compile all source files in `plutovg/source/*.c` + Add include directory: `plutovg/include` + `plutovg/stb`
- - Compilation hints for plutosvg: Compile `plutosvg/source/plutosvg.c` + Add include directory: `plutosvg/source` + Add define: `PLUTOSVG_HAS_FREETYPE` + Link with: plutovg, freetype
diff --git a/imgui-1.92.1/misc/freetype/imgui_freetype.cpp b/imgui-1.92.1/misc/freetype/imgui_freetype.cpp
deleted file mode 100644
index 7a94683..0000000
--- a/imgui-1.92.1/misc/freetype/imgui_freetype.cpp
+++ /dev/null
@@ -1,751 +0,0 @@
-// dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder)
-// (code)
-
-// Get the latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype
-// Original code by @vuhdo (Aleksei Skriabin) in 2017, with improvements by @mikesart.
-// Maintained since 2019 by @ocornut.
-
-// CHANGELOG
-// (minor and older changes stripped away, please see git history for details)
-// 2025/06/11: refactored for the new ImFontLoader architecture, and ImGuiBackendFlags_RendererHasTextures support.
-// 2024/10/17: added plutosvg support for SVG Fonts (seems faster/better than lunasvg). Enable by using '#define IMGUI_ENABLE_FREETYPE_PLUTOSVG'. (#7927)
-// 2023/11/13: added support for ImFontConfig::RasterizationDensity field for scaling render density without scaling metrics.
-// 2023/08/01: added support for SVG fonts, enable by using '#define IMGUI_ENABLE_FREETYPE_LUNASVG'. (#6591)
-// 2023/01/04: fixed a packing issue which in some occurrences would prevent large amount of glyphs from being packed correctly.
-// 2021/08/23: fixed crash when FT_Render_Glyph() fails to render a glyph and returns nullptr.
-// 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs.
-// 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a preferred texture format.
-// 2021/01/28: added support for color-layered glyphs via ImGuiFreeTypeBuilderFlags_LoadColor (require Freetype 2.10+).
-// 2021/01/26: simplified integration by using '#define IMGUI_ENABLE_FREETYPE'. renamed ImGuiFreeType::XXX flags to ImGuiFreeTypeBuilderFlags_XXX for consistency with other API. removed ImGuiFreeType::BuildFontAtlas().
-// 2020/06/04: fix for rare case where FT_Get_Char_Index() succeed but FT_Load_Glyph() fails.
-// 2019/02/09: added RasterizerFlags::Monochrome flag to disable font anti-aliasing (combine with ::MonoHinting for best results!)
-// 2019/01/15: added support for imgui allocators + added FreeType only override function SetAllocatorFunctions().
-// 2019/01/10: re-factored to match big update in STB builder. fixed texture height waste. fixed redundant glyphs when merging. support for glyph padding.
-// 2018/06/08: added support for ImFontConfig::GlyphMinAdvanceX, GlyphMaxAdvanceX.
-// 2018/02/04: moved to main imgui repository (away from http://www.github.com/ocornut/imgui_club)
-// 2018/01/22: fix for addition of ImFontAtlas::TexUvscale member.
-// 2017/10/22: minor inconsequential change to match change in master (removed an unnecessary statement).
-// 2017/09/26: fixes for imgui internal changes.
-// 2017/08/26: cleanup, optimizations, support for ImFontConfig::RasterizerFlags, ImFontConfig::RasterizerMultiply.
-// 2017/08/16: imported from https://github.com/Vuhdo/imgui_freetype into http://www.github.com/ocornut/imgui_club, updated for latest changes in ImFontAtlas, minor tweaks.
-
-// About Gamma Correct Blending:
-// - FreeType assumes blending in linear space rather than gamma space.
-// - See https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph
-// - For correct results you need to be using sRGB and convert to linear space in the pixel shader output.
-// - The default dear imgui styles will be impacted by this change (alpha values will need tweaking).
-
-// FIXME: cfg.OversampleH, OversampleV are not supported, but generally not necessary with this rasterizer because Hinting makes everything look better.
-
-#include "imgui.h"
-#ifndef IMGUI_DISABLE
-#include "imgui_freetype.h"
-#include "imgui_internal.h" // ImMin,ImMax,ImFontAtlasBuild*,
-#include <stdint.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H // <freetype/freetype.h>
-#include FT_MODULE_H // <freetype/ftmodapi.h>
-#include FT_GLYPH_H // <freetype/ftglyph.h>
-#include FT_SIZES_H // <freetype/ftsizes.h>
-#include FT_SYNTHESIS_H // <freetype/ftsynth.h>
-
-// Handle LunaSVG and PlutoSVG
-#if defined(IMGUI_ENABLE_FREETYPE_LUNASVG) && defined(IMGUI_ENABLE_FREETYPE_PLUTOSVG)
-#error "Cannot enable both IMGUI_ENABLE_FREETYPE_LUNASVG and IMGUI_ENABLE_FREETYPE_PLUTOSVG"
-#endif
-#ifdef IMGUI_ENABLE_FREETYPE_LUNASVG
-#include FT_OTSVG_H // <freetype/otsvg.h>
-#include FT_BBOX_H // <freetype/ftbbox.h>
-#include <lunasvg.h>
-#endif
-#ifdef IMGUI_ENABLE_FREETYPE_PLUTOSVG
-#include <plutosvg.h>
-#endif
-#if defined(IMGUI_ENABLE_FREETYPE_LUNASVG) || defined (IMGUI_ENABLE_FREETYPE_PLUTOSVG)
-#if !((FREETYPE_MAJOR >= 2) && (FREETYPE_MINOR >= 12))
-#error IMGUI_ENABLE_FREETYPE_PLUTOSVG or IMGUI_ENABLE_FREETYPE_LUNASVG requires FreeType version >= 2.12
-#endif
-#endif
-
-#ifdef _MSC_VER
-#pragma warning (push)
-#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
-#pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
-#endif
-
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
-#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wsubobject-linkage" // warning: 'xxxx' has a field 'xxxx' whose type uses the anonymous namespace
-#endif
-#endif
-
-//-------------------------------------------------------------------------
-// Data
-//-------------------------------------------------------------------------
-
-// Default memory allocators
-static void* ImGuiFreeTypeDefaultAllocFunc(size_t size, void* user_data) { IM_UNUSED(user_data); return IM_ALLOC(size); }
-static void ImGuiFreeTypeDefaultFreeFunc(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_FREE(ptr); }
-
-// Current memory allocators
-static void* (*GImGuiFreeTypeAllocFunc)(size_t size, void* user_data) = ImGuiFreeTypeDefaultAllocFunc;
-static void (*GImGuiFreeTypeFreeFunc)(void* ptr, void* user_data) = ImGuiFreeTypeDefaultFreeFunc;
-static void* GImGuiFreeTypeAllocatorUserData = nullptr;
-
-// Lunasvg support
-#ifdef IMGUI_ENABLE_FREETYPE_LUNASVG
-static FT_Error ImGuiLunasvgPortInit(FT_Pointer* state);
-static void ImGuiLunasvgPortFree(FT_Pointer* state);
-static FT_Error ImGuiLunasvgPortRender(FT_GlyphSlot slot, FT_Pointer* _state);
-static FT_Error ImGuiLunasvgPortPresetSlot(FT_GlyphSlot slot, FT_Bool cache, FT_Pointer* _state);
-#endif
-
-//-------------------------------------------------------------------------
-// Code
-//-------------------------------------------------------------------------
-
-#define FT_CEIL(X) (((X + 63) & -64) / 64) // From SDL_ttf: Handy routines for converting from fixed point
-#define FT_SCALEFACTOR 64.0f
-
-// Glyph metrics:
-// --------------
-//
-// xmin xmax
-// | |
-// |<-------- width -------->|
-// | |
-// | +-------------------------+----------------- ymax
-// | | ggggggggg ggggg | ^ ^
-// | | g:::::::::ggg::::g | | |
-// | | g:::::::::::::::::g | | |
-// | | g::::::ggggg::::::gg | | |
-// | | g:::::g g:::::g | | |
-// offsetX -|-------->| g:::::g g:::::g | offsetY |
-// | | g:::::g g:::::g | | |
-// | | g::::::g g:::::g | | |
-// | | g:::::::ggggg:::::g | | |
-// | | g::::::::::::::::g | | height
-// | | gg::::::::::::::g | | |
-// baseline ---*---------|---- gggggggg::::::g-----*-------- |
-// / | | g:::::g | |
-// origin | | gggggg g:::::g | |
-// | | g:::::gg gg:::::g | |
-// | | g::::::ggg:::::::g | |
-// | | gg:::::::::::::g | |
-// | | ggg::::::ggg | |
-// | | gggggg | v
-// | +-------------------------+----------------- ymin
-// | |
-// |------------- advanceX ----------->|
-
-// Stored in ImFontAtlas::FontLoaderData. ALLOCATED BY US.
-struct ImGui_ImplFreeType_Data
-{
- FT_Library Library;
- FT_MemoryRec_ MemoryManager;
- ImGui_ImplFreeType_Data() { memset((void*)this, 0, sizeof(*this)); }
-};
-
-// Stored in ImFontConfig::FontLoaderData. ALLOCATED BY US.
-struct ImGui_ImplFreeType_FontSrcData
-{
- // Initialize from an external data buffer. Doesn't copy data, and you must ensure it stays valid up to this object lifetime.
- bool InitFont(FT_Library ft_library, ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_user_flags);
- void CloseFont();
- ImGui_ImplFreeType_FontSrcData() { memset((void*)this, 0, sizeof(*this)); }
- ~ImGui_ImplFreeType_FontSrcData() { CloseFont(); }
-
- // Members
- FT_Face FtFace;
- ImGuiFreeTypeLoaderFlags UserFlags; // = ImFontConfig::FontLoaderFlags
- FT_Int32 LoadFlags;
- ImFontBaked* BakedLastActivated;
-};
-
-// Stored in ImFontBaked::FontLoaderDatas: pointer to SourcesCount instances of this. ALLOCATED BY CORE.
-struct ImGui_ImplFreeType_FontSrcBakedData
-{
- FT_Size FtSize; // This represent a FT_Face with a given size.
- ImGui_ImplFreeType_FontSrcBakedData() { memset((void*)this, 0, sizeof(*this)); }
-};
-
-bool ImGui_ImplFreeType_FontSrcData::InitFont(FT_Library ft_library, ImFontConfig* src, ImGuiFreeTypeLoaderFlags extra_font_loader_flags)
-{
- FT_Error error = FT_New_Memory_Face(ft_library, (uint8_t*)src->FontData, (FT_Long)src->FontDataSize, (FT_Long)src->FontNo, &FtFace);
- if (error != 0)
- return false;
- error = FT_Select_Charmap(FtFace, FT_ENCODING_UNICODE);
- if (error != 0)
- return false;
-
- // Convert to FreeType flags (NB: Bold and Oblique are processed separately)
- UserFlags = (ImGuiFreeTypeLoaderFlags)(src->FontLoaderFlags | extra_font_loader_flags);
-
- LoadFlags = 0;
- if ((UserFlags & ImGuiFreeTypeLoaderFlags_Bitmap) == 0)
- LoadFlags |= FT_LOAD_NO_BITMAP;
-
- if (UserFlags & ImGuiFreeTypeLoaderFlags_NoHinting)
- LoadFlags |= FT_LOAD_NO_HINTING;
- else
- src->PixelSnapH = true; // FIXME: A bit weird to do this this way.
-
- if (UserFlags & ImGuiFreeTypeLoaderFlags_NoAutoHint)
- LoadFlags |= FT_LOAD_NO_AUTOHINT;
- if (UserFlags & ImGuiFreeTypeLoaderFlags_ForceAutoHint)
- LoadFlags |= FT_LOAD_FORCE_AUTOHINT;
- if (UserFlags & ImGuiFreeTypeLoaderFlags_LightHinting)
- LoadFlags |= FT_LOAD_TARGET_LIGHT;
- else if (UserFlags & ImGuiFreeTypeLoaderFlags_MonoHinting)
- LoadFlags |= FT_LOAD_TARGET_MONO;
- else
- LoadFlags |= FT_LOAD_TARGET_NORMAL;
-
- if (UserFlags & ImGuiFreeTypeLoaderFlags_LoadColor)
- LoadFlags |= FT_LOAD_COLOR;
-
- return true;
-}
-
-void ImGui_ImplFreeType_FontSrcData::CloseFont()
-{
- if (FtFace)
- {
- FT_Done_Face(FtFace);
- FtFace = nullptr;
- }
-}
-
-static const FT_Glyph_Metrics* ImGui_ImplFreeType_LoadGlyph(ImGui_ImplFreeType_FontSrcData* src_data, uint32_t codepoint)
-{
- uint32_t glyph_index = FT_Get_Char_Index(src_data->FtFace, codepoint);
- if (glyph_index == 0)
- return nullptr;
-
- // If this crash for you: FreeType 2.11.0 has a crash bug on some bitmap/colored fonts.
- // - https://gitlab.freedesktop.org/freetype/freetype/-/issues/1076
- // - https://github.com/ocornut/imgui/issues/4567
- // - https://github.com/ocornut/imgui/issues/4566
- // You can use FreeType 2.10, or the patched version of 2.11.0 in VcPkg, or probably any upcoming FreeType version.
- FT_Error error = FT_Load_Glyph(src_data->FtFace, glyph_index, src_data->LoadFlags);
- if (error)
- return nullptr;
-
- // Need an outline for this to work
- FT_GlyphSlot slot = src_data->FtFace->glyph;
-#if defined(IMGUI_ENABLE_FREETYPE_LUNASVG) || defined(IMGUI_ENABLE_FREETYPE_PLUTOSVG)
- IM_ASSERT(slot->format == FT_GLYPH_FORMAT_OUTLINE || slot->format == FT_GLYPH_FORMAT_BITMAP || slot->format == FT_GLYPH_FORMAT_SVG);
-#else
-#if ((FREETYPE_MAJOR >= 2) && (FREETYPE_MINOR >= 12))
- IM_ASSERT(slot->format != FT_GLYPH_FORMAT_SVG && "The font contains SVG glyphs, you'll need to enable IMGUI_ENABLE_FREETYPE_PLUTOSVG or IMGUI_ENABLE_FREETYPE_LUNASVG in imconfig.h and install required libraries in order to use this font");
-#endif
- IM_ASSERT(slot->format == FT_GLYPH_FORMAT_OUTLINE || slot->format == FT_GLYPH_FORMAT_BITMAP);
-#endif // IMGUI_ENABLE_FREETYPE_LUNASVG
-
- // Apply convenience transform (this is not picking from real "Bold"/"Italic" fonts! Merely applying FreeType helper transform. Oblique == Slanting)
- if (src_data->UserFlags & ImGuiFreeTypeLoaderFlags_Bold)
- FT_GlyphSlot_Embolden(slot);
- if (src_data->UserFlags & ImGuiFreeTypeLoaderFlags_Oblique)
- {
- FT_GlyphSlot_Oblique(slot);
- //FT_BBox bbox;
- //FT_Outline_Get_BBox(&slot->outline, &bbox);
- //slot->metrics.width = bbox.xMax - bbox.xMin;
- //slot->metrics.height = bbox.yMax - bbox.yMin;
- }
-
- return &slot->metrics;
-}
-
-static void ImGui_ImplFreeType_BlitGlyph(const FT_Bitmap* ft_bitmap, uint32_t* dst, uint32_t dst_pitch)
-{
- IM_ASSERT(ft_bitmap != nullptr);
- const uint32_t w = ft_bitmap->width;
- const uint32_t h = ft_bitmap->rows;
- const uint8_t* src = ft_bitmap->buffer;
- const uint32_t src_pitch = ft_bitmap->pitch;
-
- switch (ft_bitmap->pixel_mode)
- {
- case FT_PIXEL_MODE_GRAY: // Grayscale image, 1 byte per pixel.
- {
- for (uint32_t y = 0; y < h; y++, src += src_pitch, dst += dst_pitch)
- for (uint32_t x = 0; x < w; x++)
- dst[x] = IM_COL32(255, 255, 255, src[x]);
- break;
- }
- case FT_PIXEL_MODE_MONO: // Monochrome image, 1 bit per pixel. The bits in each byte are ordered from MSB to LSB.
- {
- for (uint32_t y = 0; y < h; y++, src += src_pitch, dst += dst_pitch)
- {
- uint8_t bits = 0;
- const uint8_t* bits_ptr = src;
- for (uint32_t x = 0; x < w; x++, bits <<= 1)
- {
- if ((x & 7) == 0)
- bits = *bits_ptr++;
- dst[x] = IM_COL32(255, 255, 255, (bits & 0x80) ? 255 : 0);
- }
- }
- break;
- }
- case FT_PIXEL_MODE_BGRA:
- {
- // FIXME: Converting pre-multiplied alpha to straight. Doesn't smell good.
- #define DE_MULTIPLY(color, alpha) ImMin((ImU32)(255.0f * (float)color / (float)(alpha + FLT_MIN) + 0.5f), 255u)
- for (uint32_t y = 0; y < h; y++, src += src_pitch, dst += dst_pitch)
- for (uint32_t x = 0; x < w; x++)
- {
- uint8_t r = src[x * 4 + 2], g = src[x * 4 + 1], b = src[x * 4], a = src[x * 4 + 3];
- dst[x] = IM_COL32(DE_MULTIPLY(r, a), DE_MULTIPLY(g, a), DE_MULTIPLY(b, a), a);
- }
- #undef DE_MULTIPLY
- break;
- }
- default:
- IM_ASSERT(0 && "FreeTypeFont::BlitGlyph(): Unknown bitmap pixel mode!");
- }
-}
-
-// FreeType memory allocation callbacks
-static void* FreeType_Alloc(FT_Memory /*memory*/, long size)
-{
- return GImGuiFreeTypeAllocFunc((size_t)size, GImGuiFreeTypeAllocatorUserData);
-}
-
-static void FreeType_Free(FT_Memory /*memory*/, void* block)
-{
- GImGuiFreeTypeFreeFunc(block, GImGuiFreeTypeAllocatorUserData);
-}
-
-static void* FreeType_Realloc(FT_Memory /*memory*/, long cur_size, long new_size, void* block)
-{
- // Implement realloc() as we don't ask user to provide it.
- if (block == nullptr)
- return GImGuiFreeTypeAllocFunc((size_t)new_size, GImGuiFreeTypeAllocatorUserData);
-
- if (new_size == 0)
- {
- GImGuiFreeTypeFreeFunc(block, GImGuiFreeTypeAllocatorUserData);
- return nullptr;
- }
-
- if (new_size > cur_size)
- {
- void* new_block = GImGuiFreeTypeAllocFunc((size_t)new_size, GImGuiFreeTypeAllocatorUserData);
- memcpy(new_block, block, (size_t)cur_size);
- GImGuiFreeTypeFreeFunc(block, GImGuiFreeTypeAllocatorUserData);
- return new_block;
- }
-
- return block;
-}
-
-bool ImGui_ImplFreeType_LoaderInit(ImFontAtlas* atlas)
-{
- IM_ASSERT(atlas->FontLoaderData == nullptr);
- ImGui_ImplFreeType_Data* bd = IM_NEW(ImGui_ImplFreeType_Data)();
-
- // FreeType memory management: https://www.freetype.org/freetype2/docs/design/design-4.html
- bd->MemoryManager.user = nullptr;
- bd->MemoryManager.alloc = &FreeType_Alloc;
- bd->MemoryManager.free = &FreeType_Free;
- bd->MemoryManager.realloc = &FreeType_Realloc;
-
- // https://www.freetype.org/freetype2/docs/reference/ft2-module_management.html#FT_New_Library
- FT_Error error = FT_New_Library(&bd->MemoryManager, &bd->Library);
- if (error != 0)
- {
- IM_DELETE(bd);
- return false;
- }
-
- // If you don't call FT_Add_Default_Modules() the rest of code may work, but FreeType won't use our custom allocator.
- FT_Add_Default_Modules(bd->Library);
-
-#ifdef IMGUI_ENABLE_FREETYPE_LUNASVG
- // Install svg hooks for FreeType
- // https://freetype.org/freetype2/docs/reference/ft2-properties.html#svg-hooks
- // https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html#svg_fonts
- SVG_RendererHooks hooks = { ImGuiLunasvgPortInit, ImGuiLunasvgPortFree, ImGuiLunasvgPortRender, ImGuiLunasvgPortPresetSlot };
- FT_Property_Set(bd->Library, "ot-svg", "svg-hooks", &hooks);
-#endif // IMGUI_ENABLE_FREETYPE_LUNASVG
-#ifdef IMGUI_ENABLE_FREETYPE_PLUTOSVG
- // With plutosvg, use provided hooks
- FT_Property_Set(bd->Library, "ot-svg", "svg-hooks", plutosvg_ft_svg_hooks());
-#endif // IMGUI_ENABLE_FREETYPE_PLUTOSVG
-
- // Store our data
- atlas->FontLoaderData = (void*)bd;
-
- return true;
-}
-
-void ImGui_ImplFreeType_LoaderShutdown(ImFontAtlas* atlas)
-{
- ImGui_ImplFreeType_Data* bd = (ImGui_ImplFreeType_Data*)atlas->FontLoaderData;
- IM_ASSERT(bd != nullptr);
- FT_Done_Library(bd->Library);
- IM_DELETE(bd);
- atlas->FontLoaderData = nullptr;
-}
-
-bool ImGui_ImplFreeType_FontSrcInit(ImFontAtlas* atlas, ImFontConfig* src)
-{
- ImGui_ImplFreeType_Data* bd = (ImGui_ImplFreeType_Data*)atlas->FontLoaderData;
- ImGui_ImplFreeType_FontSrcData* bd_font_data = IM_NEW(ImGui_ImplFreeType_FontSrcData);
- IM_ASSERT(src->FontLoaderData == nullptr);
- src->FontLoaderData = bd_font_data;
-
- if (!bd_font_data->InitFont(bd->Library, src, (ImGuiFreeTypeLoaderFlags)atlas->FontLoaderFlags))
- {
- IM_DELETE(bd_font_data);
- src->FontLoaderData = nullptr;
- return false;
- }
-
- return true;
-}
-
-void ImGui_ImplFreeType_FontSrcDestroy(ImFontAtlas* atlas, ImFontConfig* src)
-{
- IM_UNUSED(atlas);
- ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
- IM_DELETE(bd_font_data);
- src->FontLoaderData = nullptr;
-}
-
-bool ImGui_ImplFreeType_FontBakedInit(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
-{
- IM_UNUSED(atlas);
- float size = baked->Size;
- if (src->MergeMode && src->SizePixels != 0.0f)
- size *= (src->SizePixels / baked->ContainerFont->Sources[0]->SizePixels);
-
- ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
- bd_font_data->BakedLastActivated = baked;
-
- // We use one FT_Size per (source + baked) combination.
- ImGui_ImplFreeType_FontSrcBakedData* bd_baked_data = (ImGui_ImplFreeType_FontSrcBakedData*)loader_data_for_baked_src;
- IM_ASSERT(bd_baked_data != nullptr);
- IM_PLACEMENT_NEW(bd_baked_data) ImGui_ImplFreeType_FontSrcBakedData();
-
- FT_New_Size(bd_font_data->FtFace, &bd_baked_data->FtSize);
- FT_Activate_Size(bd_baked_data->FtSize);
-
- // Vuhdo 2017: "I'm not sure how to deal with font sizes properly. As far as I understand, currently ImGui assumes that the 'pixel_height'
- // is a maximum height of an any given glyph, i.e. it's the sum of font's ascender and descender. Seems strange to me.
- // FT_Set_Pixel_Sizes() doesn't seem to get us the same result."
- // (FT_Set_Pixel_Sizes() essentially calls FT_Request_Size() with FT_SIZE_REQUEST_TYPE_NOMINAL)
- const float rasterizer_density = src->RasterizerDensity * baked->RasterizerDensity;
- FT_Size_RequestRec req;
- req.type = (bd_font_data->UserFlags & ImGuiFreeTypeLoaderFlags_Bitmap) ? FT_SIZE_REQUEST_TYPE_NOMINAL : FT_SIZE_REQUEST_TYPE_REAL_DIM;
- req.width = 0;
- req.height = (uint32_t)(size * 64 * rasterizer_density);
- req.horiResolution = 0;
- req.vertResolution = 0;
- FT_Request_Size(bd_font_data->FtFace, &req);
-
- // Output
- if (src->MergeMode == false)
- {
- // Read metrics
- FT_Size_Metrics metrics = bd_baked_data->FtSize->metrics;
- const float scale = 1.0f / rasterizer_density;
- baked->Ascent = (float)FT_CEIL(metrics.ascender) * scale; // The pixel extents above the baseline in pixels (typically positive).
- baked->Descent = (float)FT_CEIL(metrics.descender) * scale; // The extents below the baseline in pixels (typically negative).
- //LineSpacing = (float)FT_CEIL(metrics.height) * scale; // The baseline-to-baseline distance. Note that it usually is larger than the sum of the ascender and descender taken as absolute values. There is also no guarantee that no glyphs extend above or below subsequent baselines when using this distance. Think of it as a value the designer of the font finds appropriate.
- //LineGap = (float)FT_CEIL(metrics.height - metrics.ascender + metrics.descender) * scale; // The spacing in pixels between one row's descent and the next row's ascent.
- //MaxAdvanceWidth = (float)FT_CEIL(metrics.max_advance) * scale; // This field gives the maximum horizontal cursor advance for all glyphs in the font.
- }
- return true;
-}
-
-void ImGui_ImplFreeType_FontBakedDestroy(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src)
-{
- IM_UNUSED(atlas);
- IM_UNUSED(baked);
- IM_UNUSED(src);
- ImGui_ImplFreeType_FontSrcBakedData* bd_baked_data = (ImGui_ImplFreeType_FontSrcBakedData*)loader_data_for_baked_src;
- IM_ASSERT(bd_baked_data != nullptr);
- FT_Done_Size(bd_baked_data->FtSize);
- bd_baked_data->~ImGui_ImplFreeType_FontSrcBakedData(); // ~IM_PLACEMENT_DELETE()
-}
-
-bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImFontBaked* baked, void* loader_data_for_baked_src, ImWchar codepoint, ImFontGlyph* out_glyph, float* out_advance_x)
-{
- ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
- uint32_t glyph_index = FT_Get_Char_Index(bd_font_data->FtFace, codepoint);
- if (glyph_index == 0)
- return false;
-
- if (bd_font_data->BakedLastActivated != baked) // <-- could use id
- {
- // Activate current size
- ImGui_ImplFreeType_FontSrcBakedData* bd_baked_data = (ImGui_ImplFreeType_FontSrcBakedData*)loader_data_for_baked_src;
- FT_Activate_Size(bd_baked_data->FtSize);
- bd_font_data->BakedLastActivated = baked;
- }
-
- const FT_Glyph_Metrics* metrics = ImGui_ImplFreeType_LoadGlyph(bd_font_data, codepoint);
- if (metrics == nullptr)
- return false;
-
- FT_Face face = bd_font_data->FtFace;
- FT_GlyphSlot slot = face->glyph;
- const float rasterizer_density = src->RasterizerDensity * baked->RasterizerDensity;
-
- // Load metrics only mode
- const float advance_x = (slot->advance.x / FT_SCALEFACTOR) / rasterizer_density;
- if (out_advance_x != NULL)
- {
- IM_ASSERT(out_glyph == NULL);
- *out_advance_x = advance_x;
- return true;
- }
-
- // Render glyph into a bitmap (currently held by FreeType)
- FT_Render_Mode render_mode = (bd_font_data->UserFlags & ImGuiFreeTypeLoaderFlags_Monochrome) ? FT_RENDER_MODE_MONO : FT_RENDER_MODE_NORMAL;
- FT_Error error = FT_Render_Glyph(slot, render_mode);
- const FT_Bitmap* ft_bitmap = &slot->bitmap;
- if (error != 0 || ft_bitmap == nullptr)
- return false;
-
- const int w = (int)ft_bitmap->width;
- const int h = (int)ft_bitmap->rows;
- const bool is_visible = (w != 0 && h != 0);
-
- // Prepare glyph
- out_glyph->Codepoint = codepoint;
- out_glyph->AdvanceX = advance_x;
-
- // Pack and retrieve position inside texture atlas
- if (is_visible)
- {
- ImFontAtlasRectId pack_id = ImFontAtlasPackAddRect(atlas, w, h);
- if (pack_id == ImFontAtlasRectId_Invalid)
- {
- // Pathological out of memory case (TexMaxWidth/TexMaxHeight set too small?)
- IM_ASSERT(pack_id != ImFontAtlasRectId_Invalid && "Out of texture memory.");
- return false;
- }
- ImTextureRect* r = ImFontAtlasPackGetRect(atlas, pack_id);
-
- // Render pixels to our temporary buffer
- atlas->Builder->TempBuffer.resize(w * h * 4);
- uint32_t* temp_buffer = (uint32_t*)atlas->Builder->TempBuffer.Data;
- ImGui_ImplFreeType_BlitGlyph(ft_bitmap, temp_buffer, w);
-
- const float ref_size = baked->ContainerFont->Sources[0]->SizePixels;
- const float offsets_scale = (ref_size != 0.0f) ? (baked->Size / ref_size) : 1.0f;
- float font_off_x = (src->GlyphOffset.x * offsets_scale);
- float font_off_y = (src->GlyphOffset.y * offsets_scale) + baked->Ascent;
- if (src->PixelSnapH) // Snap scaled offset. This is to mitigate backward compatibility issues for GlyphOffset, but a better design would be welcome.
- font_off_x = IM_ROUND(font_off_x);
- if (src->PixelSnapV)
- font_off_y = IM_ROUND(font_off_y);
- float recip_h = 1.0f / rasterizer_density;
- float recip_v = 1.0f / rasterizer_density;
-
- // Register glyph
- float glyph_off_x = (float)face->glyph->bitmap_left;
- float glyph_off_y = (float)-face->glyph->bitmap_top;
- out_glyph->X0 = glyph_off_x * recip_h + font_off_x;
- out_glyph->Y0 = glyph_off_y * recip_v + font_off_y;
- out_glyph->X1 = (glyph_off_x + w) * recip_h + font_off_x;
- out_glyph->Y1 = (glyph_off_y + h) * recip_v + font_off_y;
- out_glyph->Visible = true;
- out_glyph->Colored = (ft_bitmap->pixel_mode == FT_PIXEL_MODE_BGRA);
- out_glyph->PackId = pack_id;
- ImFontAtlasBakedSetFontGlyphBitmap(atlas, baked, src, out_glyph, r, (const unsigned char*)temp_buffer, ImTextureFormat_RGBA32, w * 4);
- }
-
- return true;
-}
-
-bool ImGui_ImplFreetype_FontSrcContainsGlyph(ImFontAtlas* atlas, ImFontConfig* src, ImWchar codepoint)
-{
- IM_UNUSED(atlas);
- ImGui_ImplFreeType_FontSrcData* bd_font_data = (ImGui_ImplFreeType_FontSrcData*)src->FontLoaderData;
- int glyph_index = FT_Get_Char_Index(bd_font_data->FtFace, codepoint);
- return glyph_index != 0;
-}
-
-const ImFontLoader* ImGuiFreeType::GetFontLoader()
-{
- static ImFontLoader loader;
- loader.Name = "FreeType";
- loader.LoaderInit = ImGui_ImplFreeType_LoaderInit;
- loader.LoaderShutdown = ImGui_ImplFreeType_LoaderShutdown;
- loader.FontSrcInit = ImGui_ImplFreeType_FontSrcInit;
- loader.FontSrcDestroy = ImGui_ImplFreeType_FontSrcDestroy;
- loader.FontSrcContainsGlyph = ImGui_ImplFreetype_FontSrcContainsGlyph;
- loader.FontBakedInit = ImGui_ImplFreeType_FontBakedInit;
- loader.FontBakedDestroy = ImGui_ImplFreeType_FontBakedDestroy;
- loader.FontBakedLoadGlyph = ImGui_ImplFreeType_FontBakedLoadGlyph;
- loader.FontBakedSrcLoaderDataSize = sizeof(ImGui_ImplFreeType_FontSrcBakedData);
- return &loader;
-}
-
-void ImGuiFreeType::SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data)
-{
- GImGuiFreeTypeAllocFunc = alloc_func;
- GImGuiFreeTypeFreeFunc = free_func;
- GImGuiFreeTypeAllocatorUserData = user_data;
-}
-
-bool ImGuiFreeType::DebugEditFontLoaderFlags(unsigned int* p_font_loader_flags)
-{
- bool edited = false;
- edited |= ImGui::CheckboxFlags("NoHinting", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_NoHinting);
- edited |= ImGui::CheckboxFlags("NoAutoHint", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_NoAutoHint);
- edited |= ImGui::CheckboxFlags("ForceAutoHint",p_font_loader_flags, ImGuiFreeTypeLoaderFlags_ForceAutoHint);
- edited |= ImGui::CheckboxFlags("LightHinting", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_LightHinting);
- edited |= ImGui::CheckboxFlags("MonoHinting", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_MonoHinting);
- edited |= ImGui::CheckboxFlags("Bold", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_Bold);
- edited |= ImGui::CheckboxFlags("Oblique", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_Oblique);
- edited |= ImGui::CheckboxFlags("Monochrome", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_Monochrome);
- edited |= ImGui::CheckboxFlags("LoadColor", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_LoadColor);
- edited |= ImGui::CheckboxFlags("Bitmap", p_font_loader_flags, ImGuiFreeTypeLoaderFlags_Bitmap);
- return edited;
-}
-
-#ifdef IMGUI_ENABLE_FREETYPE_LUNASVG
-// For more details, see https://gitlab.freedesktop.org/freetype/freetype-demos/-/blob/master/src/rsvg-port.c
-// The original code from the demo is licensed under CeCILL-C Free Software License Agreement (https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/LICENSE.TXT)
-struct LunasvgPortState
-{
- FT_Error err = FT_Err_Ok;
- lunasvg::Matrix matrix;
- std::unique_ptr<lunasvg::Document> svg = nullptr;
-};
-
-static FT_Error ImGuiLunasvgPortInit(FT_Pointer* _state)
-{
- *_state = IM_NEW(LunasvgPortState)();
- return FT_Err_Ok;
-}
-
-static void ImGuiLunasvgPortFree(FT_Pointer* _state)
-{
- IM_DELETE(*(LunasvgPortState**)_state);
-}
-
-static FT_Error ImGuiLunasvgPortRender(FT_GlyphSlot slot, FT_Pointer* _state)
-{
- LunasvgPortState* state = *(LunasvgPortState**)_state;
-
- // If there was an error while loading the svg in ImGuiLunasvgPortPresetSlot(), the renderer hook still get called, so just returns the error.
- if (state->err != FT_Err_Ok)
- return state->err;
-
- // rows is height, pitch (or stride) equals to width * sizeof(int32)
- lunasvg::Bitmap bitmap((uint8_t*)slot->bitmap.buffer, slot->bitmap.width, slot->bitmap.rows, slot->bitmap.pitch);
-#if LUNASVG_VERSION_MAJOR >= 3
- state->svg->render(bitmap, state->matrix); // state->matrix is already scaled and translated
-#else
- state->svg->setMatrix(state->svg->matrix().identity()); // Reset the svg matrix to the default value
- state->svg->render(bitmap, state->matrix); // state->matrix is already scaled and translated
-#endif
- state->err = FT_Err_Ok;
- return state->err;
-}
-
-static FT_Error ImGuiLunasvgPortPresetSlot(FT_GlyphSlot slot, FT_Bool cache, FT_Pointer* _state)
-{
- FT_SVG_Document document = (FT_SVG_Document)slot->other;
- LunasvgPortState* state = *(LunasvgPortState**)_state;
- FT_Size_Metrics& metrics = document->metrics;
-
- // This function is called twice, once in the FT_Load_Glyph() and another right before ImGuiLunasvgPortRender().
- // If it's the latter, don't do anything because it's // already done in the former.
- if (cache)
- return state->err;
-
- state->svg = lunasvg::Document::loadFromData((const char*)document->svg_document, document->svg_document_length);
- if (state->svg == nullptr)
- {
- state->err = FT_Err_Invalid_SVG_Document;
- return state->err;
- }
-
-#if LUNASVG_VERSION_MAJOR >= 3
- lunasvg::Box box = state->svg->boundingBox();
-#else
- lunasvg::Box box = state->svg->box();
-#endif
- double scale = std::min(metrics.x_ppem / box.w, metrics.y_ppem / box.h);
- double xx = (double)document->transform.xx / (1 << 16);
- double xy = -(double)document->transform.xy / (1 << 16);
- double yx = -(double)document->transform.yx / (1 << 16);
- double yy = (double)document->transform.yy / (1 << 16);
- double x0 = (double)document->delta.x / 64 * box.w / metrics.x_ppem;
- double y0 = -(double)document->delta.y / 64 * box.h / metrics.y_ppem;
-
-#if LUNASVG_VERSION_MAJOR >= 3
- // Scale, transform and pre-translate the matrix for the rendering step
- state->matrix = lunasvg::Matrix::translated(-box.x, -box.y);
- state->matrix.multiply(lunasvg::Matrix(xx, xy, yx, yy, x0, y0));
- state->matrix.scale(scale, scale);
-
- // Apply updated transformation to the bounding box
- box.transform(state->matrix);
-#else
- // Scale and transform, we don't translate the svg yet
- state->matrix.identity();
- state->matrix.scale(scale, scale);
- state->matrix.transform(xx, xy, yx, yy, x0, y0);
- state->svg->setMatrix(state->matrix);
-
- // Pre-translate the matrix for the rendering step
- state->matrix.translate(-box.x, -box.y);
-
- // Get the box again after the transformation
- box = state->svg->box();
-#endif
-
- // Calculate the bitmap size
- slot->bitmap_left = FT_Int(box.x);
- slot->bitmap_top = FT_Int(-box.y);
- slot->bitmap.rows = (unsigned int)(ImCeil((float)box.h));
- slot->bitmap.width = (unsigned int)(ImCeil((float)box.w));
- slot->bitmap.pitch = slot->bitmap.width * 4;
- slot->bitmap.pixel_mode = FT_PIXEL_MODE_BGRA;
-
- // Compute all the bearings and set them correctly. The outline is scaled already, we just need to use the bounding box.
- double metrics_width = box.w;
- double metrics_height = box.h;
- double horiBearingX = box.x;
- double horiBearingY = -box.y;
- double vertBearingX = slot->metrics.horiBearingX / 64.0 - slot->metrics.horiAdvance / 64.0 / 2.0;
- double vertBearingY = (slot->metrics.vertAdvance / 64.0 - slot->metrics.height / 64.0) / 2.0;
- slot->metrics.width = FT_Pos(IM_ROUND(metrics_width * 64.0)); // Using IM_ROUND() assume width and height are positive
- slot->metrics.height = FT_Pos(IM_ROUND(metrics_height * 64.0));
- slot->metrics.horiBearingX = FT_Pos(horiBearingX * 64);
- slot->metrics.horiBearingY = FT_Pos(horiBearingY * 64);
- slot->metrics.vertBearingX = FT_Pos(vertBearingX * 64);
- slot->metrics.vertBearingY = FT_Pos(vertBearingY * 64);
-
- if (slot->metrics.vertAdvance == 0)
- slot->metrics.vertAdvance = FT_Pos(metrics_height * 1.2 * 64.0);
-
- state->err = FT_Err_Ok;
- return state->err;
-}
-
-#endif // #ifdef IMGUI_ENABLE_FREETYPE_LUNASVG
-
-//-----------------------------------------------------------------------------
-
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
-
-#ifdef _MSC_VER
-#pragma warning (pop)
-#endif
-
-#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui-1.92.1/misc/freetype/imgui_freetype.h b/imgui-1.92.1/misc/freetype/imgui_freetype.h
deleted file mode 100644
index 8531369..0000000
--- a/imgui-1.92.1/misc/freetype/imgui_freetype.h
+++ /dev/null
@@ -1,83 +0,0 @@
-// dear imgui: FreeType font builder (used as a replacement for the stb_truetype builder)
-// (headers)
-
-#pragma once
-#include "imgui.h" // IMGUI_API
-#ifndef IMGUI_DISABLE
-
-// Usage:
-// - Add '#define IMGUI_ENABLE_FREETYPE' in your imconfig to automatically enable support
-// for imgui_freetype in imgui. It is equivalent to selecting the default loader with:
-// io.Fonts->SetFontLoader(ImGuiFreeType::GetFontLoader())
-
-// Optional support for OpenType SVG fonts:
-// - Add '#define IMGUI_ENABLE_FREETYPE_PLUTOSVG' to use plutosvg (not provided). See #7927.
-// - Add '#define IMGUI_ENABLE_FREETYPE_LUNASVG' to use lunasvg (not provided). See #6591.
-
-// Forward declarations
-struct ImFontAtlas;
-struct ImFontLoader;
-
-// Hinting greatly impacts visuals (and glyph sizes).
-// - By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter.
-// - When disabled, FreeType generates blurrier glyphs, more or less matches the stb_truetype.h
-// - The Default hinting mode usually looks good, but may distort glyphs in an unusual way.
-// - The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer.
-// You can set those flags globally in ImFontAtlas::FontLoaderFlags
-// You can set those flags on a per font basis in ImFontConfig::FontLoaderFlags
-typedef unsigned int ImGuiFreeTypeLoaderFlags;
-enum ImGuiFreeTypeLoaderFlags_
-{
- ImGuiFreeTypeLoaderFlags_NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
- ImGuiFreeTypeLoaderFlags_NoAutoHint = 1 << 1, // Disable auto-hinter.
- ImGuiFreeTypeLoaderFlags_ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter.
- ImGuiFreeTypeLoaderFlags_LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
- ImGuiFreeTypeLoaderFlags_MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
- ImGuiFreeTypeLoaderFlags_Bold = 1 << 5, // Styling: Should we artificially embolden the font?
- ImGuiFreeTypeLoaderFlags_Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style?
- ImGuiFreeTypeLoaderFlags_Monochrome = 1 << 7, // Disable anti-aliasing. Combine this with MonoHinting for best results!
- ImGuiFreeTypeLoaderFlags_LoadColor = 1 << 8, // Enable FreeType color-layered glyphs
- ImGuiFreeTypeLoaderFlags_Bitmap = 1 << 9, // Enable FreeType bitmap glyphs
-
-#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
- ImGuiFreeTypeBuilderFlags_NoHinting = ImGuiFreeTypeLoaderFlags_NoHinting,
- ImGuiFreeTypeBuilderFlags_NoAutoHint = ImGuiFreeTypeLoaderFlags_NoAutoHint,
- ImGuiFreeTypeBuilderFlags_ForceAutoHint = ImGuiFreeTypeLoaderFlags_ForceAutoHint,
- ImGuiFreeTypeBuilderFlags_LightHinting = ImGuiFreeTypeLoaderFlags_LightHinting,
- ImGuiFreeTypeBuilderFlags_MonoHinting = ImGuiFreeTypeLoaderFlags_MonoHinting,
- ImGuiFreeTypeBuilderFlags_Bold = ImGuiFreeTypeLoaderFlags_Bold,
- ImGuiFreeTypeBuilderFlags_Oblique = ImGuiFreeTypeLoaderFlags_Oblique,
- ImGuiFreeTypeBuilderFlags_Monochrome = ImGuiFreeTypeLoaderFlags_Monochrome,
- ImGuiFreeTypeBuilderFlags_LoadColor = ImGuiFreeTypeLoaderFlags_LoadColor,
- ImGuiFreeTypeBuilderFlags_Bitmap = ImGuiFreeTypeLoaderFlags_Bitmap,
-#endif
-};
-
-// Obsolete names (will be removed)
-#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
-typedef ImGuiFreeTypeLoaderFlags_ ImGuiFreeTypeBuilderFlags_;
-#endif
-
-namespace ImGuiFreeType
-{
- // This is automatically assigned when using '#define IMGUI_ENABLE_FREETYPE'.
- // If you need to dynamically select between multiple builders:
- // - you can manually assign this builder with 'atlas->SetFontLoader(ImGuiFreeType::GetFontLoader())'
- // - prefer deep-copying this into your own ImFontLoader instance if you use hot-reloading that messes up static data.
- IMGUI_API const ImFontLoader* GetFontLoader();
-
- // Override allocators. By default ImGuiFreeType will use IM_ALLOC()/IM_FREE()
- // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired.
- IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = nullptr);
-
- // Display UI to edit ImFontAtlas::FontLoaderFlags (shared) or ImFontConfig::FontLoaderFlags (single source)
- IMGUI_API bool DebugEditFontLoaderFlags(ImGuiFreeTypeLoaderFlags* p_font_loader_flags);
-
- // Obsolete names (will be removed)
-#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
- //IMGUI_API const ImFontBuilderIO* GetBuilderForFreeType(); // Renamed/changed in 1.92. Change 'io.Fonts->FontBuilderIO = ImGuiFreeType::GetBuilderForFreeType()' to 'io.Fonts->SetFontLoader(ImGuiFreeType::GetFontLoader())' if you need runtime selection.
- //static inline bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int flags = 0) { atlas->FontBuilderIO = GetBuilderForFreeType(); atlas->FontLoaderFlags = flags; return atlas->Build(); } // Prefer using '#define IMGUI_ENABLE_FREETYPE'
-#endif
-}
-
-#endif // #ifndef IMGUI_DISABLE
diff --git a/imgui-1.92.1/misc/single_file/imgui_single_file.h b/imgui-1.92.1/misc/single_file/imgui_single_file.h
deleted file mode 100644
index 7ca31e0..0000000
--- a/imgui-1.92.1/misc/single_file/imgui_single_file.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// dear imgui: single-file wrapper include
-// We use this to validate compiling all *.cpp files in a same compilation unit.
-// Users of that technique (also called "Unity builds") can generally provide this themselves,
-// so we don't really recommend you use this in your projects.
-
-// Do this:
-// #define IMGUI_IMPLEMENTATION
-// Before you include this file in *one* C++ file to create the implementation.
-// Using this in your project will leak the contents of imgui_internal.h and ImVec2 operators in this compilation unit.
-
-#ifdef IMGUI_IMPLEMENTATION
-#define IMGUI_DEFINE_MATH_OPERATORS
-#endif
-
-#include "../../imgui.h"
-#ifdef IMGUI_ENABLE_FREETYPE
-#include "../../misc/freetype/imgui_freetype.h"
-#endif
-
-#ifdef IMGUI_IMPLEMENTATION
-#include "../../imgui.cpp"
-#include "../../imgui_demo.cpp"
-#include "../../imgui_draw.cpp"
-#include "../../imgui_tables.cpp"
-#include "../../imgui_widgets.cpp"
-#ifdef IMGUI_ENABLE_FREETYPE
-#include "../../misc/freetype/imgui_freetype.cpp"
-#endif
-#endif