@@ -247,18 +247,27 @@ UImGui::TextUtils::WidgetState UImGui::TextUtils::renderWrappedTextGeneric(const
247
247
Colour)>& render) noexcept
248
248
{
249
249
const float scale = ImGui::GetIO ().FontGlobalScale ;
250
+ const float size = ImGui::GetFontSize ();
250
251
float widthAvail = ImGui::GetContentRegionAvail ().x ;
251
252
const char * endLine = text;
252
253
253
254
if (widthAvail > 0 .0f )
255
+ #if IMGUI_VERSION_NUM > 19196
256
+ endLine = ImGui::GetFont ()->CalcWordWrapPosition (size * scale, text, end, widthAvail);
257
+ #else
254
258
endLine = ImGui::GetFont ()->CalcWordWrapPositionA (scale, text, end, widthAvail);
259
+ #endif
255
260
if (endLine > text && endLine < end)
256
261
{
257
262
if (isPartOfWord (*endLine))
258
263
{
259
264
// Get maximum line width like this because dear imgui rc 1.90.9+ deprecated these
260
265
const float nextLineWidth = (ImGui::GetContentRegionAvail () + ImGui::GetCursorScreenPos ()).x ;
266
+ #if IMGUI_VERSION_NUM > 19196
267
+ const char * nextLineEnd = ImGui::GetFont ()->CalcWordWrapPosition (size * scale, text, end, nextLineWidth);
268
+ #else
261
269
const char * nextLineEnd = ImGui::GetFont ()->CalcWordWrapPositionA (scale, text, end, nextLineWidth);
270
+ #endif
262
271
if (nextLineEnd == end || (nextLineEnd <= end && !isPartOfWord (*nextLineEnd)))
263
272
endLine = text;
264
273
}
@@ -281,7 +290,11 @@ UImGui::TextUtils::WidgetState UImGui::TextUtils::renderWrappedTextGeneric(const
281
290
text = endLine;
282
291
if (*text == ' ' )
283
292
++text;
293
+ #if IMGUI_VERSION_NUM > 19196
294
+ endLine = ImGui::GetFont ()->CalcWordWrapPosition (size * scale, text, end, widthAvail);
295
+ #else
284
296
endLine = ImGui::GetFont ()->CalcWordWrapPositionA (scale, text, end, widthAvail);
297
+ #endif
285
298
if (text == endLine)
286
299
endLine++;
287
300
ImGui::PushTextWrapPos (-1 .0f );
0 commit comments