imgui_markdown icon indicating copy to clipboard operation
imgui_markdown copied to clipboard

Obsoleted CalcWordWrapPositionA

Open pozemka opened this issue 8 months ago • 4 comments

It seems CalcWordWrapPositionA will be obsolete once dynamic_fonts branch is released. I've replaced it with CalcWordWrapPosition which use current font size, obtained with ImGui::GetFontSize()

pozemka avatar Apr 23 '25 14:04 pozemka

See https://github.com/ocornut/imgui/issues/8465

pozemka avatar Apr 23 '25 14:04 pozemka

It looks like CalcWordWrapPosition is not yet in Dear ImGui, so this needs a macro check for ImGui version IMGUI_VERSION_NUM or a feature macro test, though it looks like there isn't a IMGUI_HAS_DYNAMIC_FONTS.

Neither would work at the moment since the IMGUI_VERSION_NUM of the main branch is higher than the dynamic font branch, so for the moment I'll hold off on merging until this is clarified in ImGui.

dougbinks avatar Apr 23 '25 15:04 dougbinks

Yes. This is why I made it as a draft PR. More as a remainder :) Internally I use imgui_markdown with dynamic_fonts branch so I hope I will be able to test this and update PR if something go wrong.

pozemka avatar Apr 23 '25 15:04 pozemka

Excellent - thanks. Somehow I didn't notice this was a draft!

dougbinks avatar Apr 23 '25 16:04 dougbinks

FYI it's been pushed on May 23 https://github.com/ocornut/imgui/commit/407a0b972eac6166095d2b5b5b0896bad6e9687a

You can use #if IMGUI_VERSION_NUM > 19197 if you want to support old versions.

ocornut avatar Jun 06 '25 15:06 ocornut

Also I suggest you cache this e.g. float size = ImGui::GetFontSize().

ocornut avatar Jun 06 '25 15:06 ocornut

I've merged this into dev branch so I can work on the suggestions from @ocornut. Many thanks for the PR!

dougbinks avatar Jun 10 '25 15:06 dougbinks

This is now merged into main with the changes suggested, though I used #if IMGUI_VERSION_NUM >= 19197 as 19197 seems to be the wip version.

dougbinks avatar Jun 10 '25 15:06 dougbinks