Compare commits

..

2 Commits

Author SHA1 Message Date
Green Sky
d5fb73d4a3 patch imgui with bitmap scaling patch
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, ) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, asan) (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
2025-11-04 22:34:31 +01:00
Green Sky
1f004cbd6d rework imgui font loading a bit
dont hardcode code ranges, imgui can do that dynamically now
2025-11-04 22:28:27 +01:00
5 changed files with 25 additions and 38 deletions

View File

@@ -8,11 +8,13 @@ endif()
if (NOT TARGET imgui)
FetchContent_Declare(imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git
#GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_REPOSITORY https://github.com/Green-Sky/imgui.git
#GIT_TAG f5befd2d29e66809cd1110a152e375a7f1981f06 # v1.91.9b
#GIT_TAG 85b2fe8486190fa9326565a2fb5fccb6caea4396 # v1.92.0
#GIT_TAG 5d4126876bc10396d4c6511853ff10964414c776 # v1.92.1
GIT_TAG bf75bfec48fc00f532af8926130b70c0e26eb099 # v1.92.3
#GIT_TAG bf75bfec48fc00f532af8926130b70c0e26eb099 # v1.92.3
GIT_TAG 349dbf9c57a15e2148fbfa7cb88df30280e0a362 # v1.92.3 + bitmap scaling patches
EXCLUDE_FROM_ALL
)

12
flake.lock generated
View File

@@ -21,17 +21,17 @@
"imgui": {
"flake": false,
"locked": {
"lastModified": 1758128722,
"narHash": "sha256-J+h7jJ+4wqr6RivtzyTDMXKxFoGs7dQbzqdu51XgEbc=",
"owner": "ocornut",
"lastModified": 1762288520,
"narHash": "sha256-pgVBnGtt3pygqWVAYA1q2SM6kNH7n0mnD4kih0UFclo=",
"owner": "Green-Sky",
"repo": "imgui",
"rev": "bf75bfec48fc00f532af8926130b70c0e26eb099",
"rev": "349dbf9c57a15e2148fbfa7cb88df30280e0a362",
"type": "github"
},
"original": {
"owner": "ocornut",
"owner": "Green-Sky",
"repo": "imgui",
"rev": "bf75bfec48fc00f532af8926130b70c0e26eb099",
"rev": "349dbf9c57a15e2148fbfa7cb88df30280e0a362",
"type": "github"
}
},

View File

@@ -21,7 +21,8 @@
flake = false;
};
imgui = {
url = "github:ocornut/imgui/bf75bfec48fc00f532af8926130b70c0e26eb099";
#url = "github:ocornut/imgui/bf75bfec48fc00f532af8926130b70c0e26eb099";
url = "github:Green-Sky/imgui/349dbf9c57a15e2148fbfa7cb88df30280e0a362";
flake = false;
};
plutosvg = {

View File

@@ -82,36 +82,17 @@ StartScreen::StartScreen(const std::vector<std::string_view>& args, SDL_Renderer
display_scale = 1.f;
}
ImGui::GetIO().FontGlobalScale = display_scale;
ImGui::GetStyle().FontSizeBase = _conf.get_int("ImGuiFonts", "size").value_or(13);
{
auto* font_atlas = ImGui::GetIO().Fonts;
font_atlas->ClearFonts();
// for now we also always merge
//bool has_font {false};
ImFontGlyphRangesBuilder glyphbld;
ImVector<ImWchar> glyph_ranges;
{ // build ranges
glyphbld.AddRanges(font_atlas->GetGlyphRangesDefault());
glyphbld.AddRanges(font_atlas->GetGlyphRangesGreek());
glyphbld.AddRanges(font_atlas->GetGlyphRangesCyrillic());
glyphbld.AddRanges(font_atlas->GetGlyphRangesChineseSimplifiedCommon()); // contains CJK
glyphbld.AddText(""); // somehow missing
// popular emojies
glyphbld.AddText(u8"😂❤️🤣👍😭🙏😘🥰😍😊🎉😁💕🥺😅🔥☺️🤦♥️🤷🙄😆🤗😉🎂🤔👏🙂😳🥳😎👌💜😔💪✨💖👀😋😏😢👉💗😩💯🌹💞🎈💙😃😡💐😜🙈🤞😄🤤🙌🤪❣️😀💋💀👇💔😌💓🤩🙃😬😱😴🤭😐🌞😒😇🌸😈🎶✌️🎊🥵😞💚☀️🖤💰😚👑🎁💥🙋☹️😑🥴👈💩✅👋🤮😤🤢🌟❗😥🌈💛😝😫😲🖕‼️🔴🌻🤯💃👊🤬🏃😕👁️⚡☕🍀💦⭐🦋🤨🌺😹🤘🌷💝💤🤝🐰😓💘🍻😟😣🧐😠🤠😻🌙😛🤙🙊");
if (const auto sv_opt = _conf.get_string("ImGuiFonts", "atlas_extra_text"); sv_opt.has_value) {
glyphbld.AddText(sv_opt.s.start, sv_opt.s.start+sv_opt.s.extend);
}
glyphbld.BuildRanges(&glyph_ranges);
}
ImFontConfig fontcfg;
//fontcfg.SizePixels = 16.f*display_scale;
fontcfg.SizePixels = _conf.get_int("ImGuiFonts", "size").value_or(13) * display_scale;
fontcfg.RasterizerDensity = 1.f;
fontcfg.OversampleH = 0;
fontcfg.OversampleV = 0;
fontcfg.MergeMode = false;
// defaults
fontcfg.OversampleH = fontcfg.OversampleV = 1;
fontcfg.PixelSnapH = true;
#if defined(IMGUI_ENABLE_FREETYPE) && defined(IMGUI_ENABLE_FREETYPE_PLUTOSVG)
std::cout << "Font: enabling freetype color loading\n";
fontcfg.FontLoaderFlags |= ImGuiFreeTypeBuilderFlags_LoadColor;
@@ -125,16 +106,14 @@ StartScreen::StartScreen(const std::vector<std::string_view>& args, SDL_Renderer
std::cout << "Font: loading '" << font_path << "'\n";
const auto* resulting_font = font_atlas->AddFontFromFileTTF(
font_path.c_str(),
_conf.get_int("ImGuiFonts", "size", font_path).value_or(0) * display_scale,
&fontcfg,
&(glyph_ranges[0])
0.f,
&fontcfg
);
if (resulting_font != nullptr) {
//has_font = true;
fontcfg.MergeMode = true;
} else {
std::cerr << "Font: failed to load '" << "path" << "' !\n";
std::cerr << "Font: failed to load '" << font_path << "' !\n";
}
}

View File

@@ -297,6 +297,11 @@ void ToxAvatarManager::checkObj(ObjectHandle o) {
// like set "accepted" tag comp or something
std::cout << "TAM: accepted avatar ft\n";
} else {
// in progress, or canceled/aborted
// TODO: canceled tag with reason??
//if (o.all_of<ObjComp::Ephemeral::ToxTransferFriend
}
}