ded
ded copied to clipboard
Updated DED crashed on Ubuntu 22
I recently built DED with the new changes (clipboard and runtime shader updates) but it crashes when I try to open a file or even the text editor itself.
./ded src/main.c
Loading src/main.c
GL version 3.3
ERROR: could not load glyph of a character with code 32
The previous version worked like a charm. If anyone can help I would really appreciate it. Thanks to Tsoding for this wonderful project.
Same here. My guess it's that libfreetype-dev is too old for the new SDF font rendering stuff.
My Mint install comes with v2.11, and the new documented minimum is 2.13.
For me it works again if I git revert 99e9318086623
and rebuild. Not optimal, but a simple workaround.
funny enough I am now having issues building it at all.
Try running sed 's/\r$//' build.sh > out.sh
and then running ./out.sh to build. IDK the new version is working for me, after being able to build it. Old versions did not have these issues though. @eloj try updating your packages and then building the new version. Out of date stuff probably has an update on your package manager. If not you could build that from source as well, though good luck with that.
No, there are no updated packages. My dist is built on Ubuntu 22.04 LTS (Jammy), which comes with freetype 2.11, and will only see security updates.
Obviously I can build from freetype from source. I was just giving OP the easiest way forward.
Anyway, I went back to investigate, and it's indeed a bug with the space character (32) specifically, so you can do the following and get nicely scaled and rendered SDF fonts even on the older libfreetype:
diff --git a/src/free_glyph.c b/src/free_glyph.c
index 041a2a3..1df8f36 100644
--- a/src/free_glyph.c
+++ b/src/free_glyph.c
@@ -4,7 +4,7 @@
void free_glyph_atlas_init(Free_Glyph_Atlas *atlas, FT_Face face)
{
- FT_Int32 load_flags = FT_LOAD_RENDER | FT_LOAD_TARGET_(FT_RENDER_MODE_SDF);
+ #define load_flags (i > 32 ? FT_LOAD_RENDER | FT_LOAD_TARGET_(FT_RENDER_MODE_SDF) : FT_LOAD_RENDER)
for (int i = 32; i < 128; ++i) {
if (FT_Load_Char(face, i, load_flags)) {
fprintf(stderr, "ERROR: could not load glyph of a character with code %d\n", i);
I noticed it takes a lot longer to start up -- multiple seconds before you can type -- but it does work.
@eloj This solution seems to work like a charm for me as well, though it does take significantly longer to load. @vultureofficial try those fixes and see if it works for you as well. Perhaps this change should be merged into main? I'm not sure here.