mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-10 19:03:30 +00:00
crash with Font #951
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#951
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?
Hello Omar,
If I use:
I am getting crashes so I did gdb with Debug and RelWithDebInfo:
but I am not able to make conclusions.
1278 is ImFontAtlas::Build()
Thanks
Is your filename correct? I am not sure what \ means in your language but in c++ it would escape the next character.
Do you have asserts enabled? It looks like you are missing some diagnostics checks.
Filename is ok in Lua and ImFontAtlas_AddFontFromFileTTF returns not null.
Are asserts enabled building for Debug?
Assert being enabled or not is up your building configuration and where it goes when calling assert(), unless you have redefined IM_ASSERT in imconfig.h
From your log your should have stopped/crashed on the IM_ASSERT(font_offset >= 0); line and not gone any further than that.
We are calling stbtt_GetFontOffsetForIndex() and it returns an error so either the font data is invalid, either the FontNo is invalid, either there is a bug/issue in stb_truetype.h.
Maybe first try with one of the ttf file provided in extra_fonts/ because those definitively works.
Sent from my fax machine
I could check that the pointer in SetCurrentFont is the same returned from ImFontAtlas_AddFontFromFileTTF
ProggyTiny.ttf is from extra_fonts
Also : there are two gdb traces, one for Debug the other for Release with debug information
Use a debugger to trace thru the code!
A lot of noise for: Fake ProggyTiny.ttf
It was an html file saved with that name!!
(inspecting the data in the debugger revealed it)
Everything works now
Sorry
Your assert should really crash/halt your application, this is what asserts are for.
I can silently fail or keep returning error codes but it'll have to fail at some point (main loop needs at least one valid font).