Comments (6)
Could you set a breakpoint at luigi2.h:4539
and check that cPath
, size
, font->glyphWidth
, font->glyphHeight
look reasonable each time the breakpoint is reached?
from gf.
EDIT: Forgot to check height.. For the terminus font it was 0 and for liberation mono, it was 22. So I guess that's unreasonable.
They look reasonable:
$ gdb ./gf2
GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gf2...
(gdb) b luigi2.h:4539
Breakpoint 1 at 0x158e2: file /tmp/nakst_gf/luigi2.h, line 4539.
(gdb) r
Starting program: /tmp/nakst_gf/gf2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after vfork from child process 28812]
Breakpoint 1, UIFontCreate (cPath=0x5555555d22d0 "/usr/share/fonts/terminus/ter-u12n.otb", size=13) at /tmp/nakst_gf/luigi2.h:4539
4539 font->isFreeType = true;
(gdb) display cPath
1: cPath = 0x5555555d22d0 "/usr/share/fonts/terminus/ter-u12n.otb"
(gdb) display size
2: size = 13
(gdb) display font->glyphWidth
3: font->glyphWidth = 8
(gdb) c
Continuing.
Breakpoint 1, UIFontCreate (cPath=0x5555555d22d0 "/usr/share/fonts/terminus/ter-u12n.otb", size=11) at /tmp/nakst_gf/luigi2.h:4539
4539 font->isFreeType = true;
1: cPath = 0x5555555d22d0 "/usr/share/fonts/terminus/ter-u12n.otb"
2: size = 11
3: font->glyphWidth = 8
(gdb)
Continuing.
[New Thread 0x7ffff74af6c0 (LWP 28821)]
[Detaching after vfork from child process 28822]
[Detaching after vfork from child process 28823]
E247: No registered server named "GVIM": Send expression failed.
Thread 1 "gf2" received signal SIGFPE, Arithmetic exception.
0x0000555555560df6 in _UICodeMessage (element=0x5555555d9340, message=UI_MSG_PAINT, di=0, dp=0x7fffffffa150) at /tmp/nakst_gf/luigi2.h:2647
2647 lineBounds.t -= (int64_t) code->vScroll->position % lineHeight;
I tried changing to another font and things worked:
$ gdb ./gf2
GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./gf2...
(gdb) b luigi2.h:4539
Breakpoint 1 at 0x158e2: file /tmp/nakst_gf/luigi2.h, line 4539.
(gdb) c
The program is not being run.
(gdb) r
Starting program: /tmp/nakst_gf/gf2
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after vfork from child process 29333]
Breakpoint 1, UIFontCreate (cPath=0x5555555d22d0 "/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf", size=13) at /tmp/nakst_gf/luigi2.h:4539
4539 font->isFreeType = true;
(gdb) display cPath
1: cPath = 0x5555555d22d0 "/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf"
(gdb) display size
2: size = 13
(gdb) display font->glyphWidth
3: font->glyphWidth = 11
(gdb) c
Continuing.
Breakpoint 1, UIFontCreate (cPath=0x5555555d22d0 "/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf", size=11) at /tmp/nakst_gf/luigi2.h:4539
4539 font->isFreeType = true;
1: cPath = 0x5555555d22d0 "/usr/share/fonts/liberation-fonts/LiberationMono-Regular.ttf"
2: size = 11
3: font->glyphWidth = 9
(gdb) c
Continuing.
[New Thread 0x7ffff74116c0 (LWP 29340)]
[Detaching after vfork from child process 29341]
[Detaching after vfork from child process 29342]
E247: No registered server named "GVIM": Send expression failed.
I guess the issue is with bitmap fonts.
from gf.
Yes, it looks like FreeType is not rendering the glyphs in this font as expected. The bitmaps it returns have a width and height of 0. I'm not familiar enough with FreeType to know why this is happening.
from gf.
I looked into it a bit. It looks like the FT_Set_Char_Size()
call in UIFontCreate()
is failing. It fails because Terminus font is a bitmap font with fixed sizes and the size provided is not an available size (see second to last paragraph of section 5 of the FreeType Tutorial).
The FT_HAS_FIXED_SIZES
macro can be used to determine if specific, fixed sizes are needed. Then, the available_sizes
"array" (length determined by num_fixed_sizes
) in the FreeType face structure can be used check the available heights/font sizes. (Maybe loop through that array and find the closest match?)
I tried changing font size to an available size (and also changed from FT_Set_Char_Size()
to FT_Set_Pixel_Sizes()
because FT_Set_Char_Size()
was still failing... maybe something to do with DPI), and I get no crash (and the glyphWidth
and glyphHeight
look ok), but the font is all garbled (see attached screenshot), so probably something else should also be changed/fixed to work with bitmap fonts.
from gf.
Does 9eb99d5 fix this?
from gf.
Thanks. It works for me now.
from gf.
Related Issues (20)
- Hidden Files HOT 1
- Cannot add breakpoint on future shared library HOT 3
- Print the name of the file I'm debugging in a titlebar (or somewhere) HOT 2
- Incorrect syntax highlighting for multi-line macros
- [feature request] Horizontal scrollbars HOT 4
- Automatic bitmap viewing
- (feature request): add the ability to select and copy text from the code & console output views (i.e., `UICode` elements) HOT 7
- Incorrect syntax highlight for multi-line comments
- Getting GVIM error when running gf2 under WSL2 on Windows 11 HOT 4
- Petition to make the ability to select text for copy/pasting the DEFAULT behavior of gf HOT 7
- Inspect line mode fails to parse variables that contain a number in their name
- feature request: hover to inspect variables.
- Please provide a release version HOT 1
- When trying to use the `[pipe]` feature I get a segfault HOT 1
- GDB `define` command doesn't work HOT 2
- Debugging with multiple inferiors HOT 1
- Error after installing extensions HOT 1
- Show hex value instead of decimal in Locals tab HOT 2
- Support for loading SVD files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gf.