mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Potential Bug in ImFont::RenderText, ImFont::CalcTextSizeA #896
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#896
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm pretty sure that if ( c == 0 ) should be outside the else path..
It probably should be clarified in the comment, but unexpectedly this is actually correct.
We already have a
text_endpointer (which typically point to the end of string \0) so for single-byte character we don't need this test because a \0 would never happen or technically would be legal (not but not super useful) if we pass it a range that includes \0.The test here handles malformed UTF-8.
(We receive a non NULL
text_endpointer earlier in the stack in the majority of cases, so even the first two lines of the functions which computestext_endis a bit of a unlikely fallback for cases when users calls RenderText() themselves,. This is why it isn't worth optimizing for single-pass zero-check here.. Actually adding the extra if() would likely incur extra minor cost)