Open whiffee opened 2 years ago
Quoting whiffee (2022-06-03 19:23:27)
Have working build on Xubuntu 21.10 but GUI is unusable on 4K monitor because of tiny fontsize.
Are you really using the 'gl' backed? This is rather limited font-wise, as it only comes with one prefab fixed size font. The cairo backend is much more flexible and should also properly correct font size for display dpi, so if you are not using that, I suggest switching backends.
Thanks zevv for response. Here is the configure. What do I need to reconfigure to get cairo in harness?
gary@xubu2110:~/Downloads/duc-master$ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define EXTENSIONS... yes checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking for long file names... yes checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for main in -lm... yes checking for struct stat.st_blocks... yes Selected backend tokyocabinet checking for tokyocabinet... yes checking for cairo... yes checking for pango... yes checking for pangocairo... yes checking for tputs in -lncursesw... yes checking for XOpenDisplay in -lX11... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking for stdint.h... (cached) yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking sys/ioctl.h usability... yes checking sys/ioctl.h presence... yes checking for sys/ioctl.h... yes checking for unistd.h... (cached) yes checking fnmatch.h usability... yes checking fnmatch.h presence... yes checking for fnmatch.h... yes checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking ncurses.h usability... yes checking ncurses.h presence... yes checking for ncurses.h... yes checking ncurses/ncurses.h usability... no checking ncurses/ncurses.h presence... no checking for ncurses/ncurses.h... no checking ncursesw/ncurses.h usability... yes checking ncursesw/ncurses.h presence... yes checking for ncursesw/ncurses.h... yes checking for mode_t... yes checking for off_t... yes checking for size_t... yes checking for uint32_t... yes checking for uint64_t... yes checking for uint8_t... yes checking for dev_t... yes checking for ino_t... yes checking whether lstat correctly handles trailing slash... yes checking for floor... yes checking for memset... yes checking for strchr... yes checking for strdup... yes checking for strerror... yes checking for gettimeofday... yes checking for lstat... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing depfiles commands
configuration summary:
gary@xubu2110:~/Downloads/duc-master$
Quoting whiffee (2022-06-03 19:46:20)
Thanks zevv for response. Here is the configure. What do I need to reconfigure to get cairo in harness?
- Package version: duc 1.4.5-rc1
- Prefix: /usr/local
- Database backend: tokyocabinet
- X11 support: yes
- OpenGL support: no
- UI (ncurses) support: yes
- Graph cairo support: yes
There it is: you are using cairo indeed. So we might have a problem with the dpi calculation.
If you feel up to it, could you add a debug print in cmd-gui.c as below and report the result?
int w_px = DisplayWidth(dpy, 0);
int w_mm = DisplayWidthMM(dpy, 0);
printf("px=%d mm=%d\n", w_px,w_mm); // add this
if(w_px && w_mm) {
double dpi = 25.4 * w_px / w_mm;
duc_graph_set_dpi(graph, dpi);
}
I tried sticking it right at the end of cmd-gui.c like so:
```
" g toggle graph gradient\n" " p toggle palettes\n" " backspace go up one directory\n"
};
int w_px = DisplayWidth(dpy, 0); int w_mm = DisplayWidthMM(dpy, 0); printf("px=%d mm=%d\n", w_px,w_mm); // add this if(w_px && w_mm) { double dpi = 25.4 * w_px / w_mm; duc_graph_set_dpi(graph, dpi); }
/*
But there was a problem, obviously, because
make all-am
make[1]: Entering directory '/home/gary/Downloads/duc-master'
depbase=echo src/duc/cmd-gui.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'
;\
gcc -DHAVE_CONFIG_H -I. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -Isrc/libduc -Isrc/libduc-graph -Isrc/glad -g -O2 -MT src/duc/cmd-gui.o -MD -MP -MF $depbase.Tpo -c -o src/duc/cmd-gui.o src/duc/cmd-gui.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/cairo/cairo-xlib.h:44,
from src/duc/cmd-gui.c:19:
src/duc/cmd-gui.c:342:12: error: initializer element is not constant
342 | int w_px = DisplayWidth(dpy, 0);
| ^~~~
src/duc/cmd-gui.c:343:12: error: initializer element is not constant
343 | int w_mm = DisplayWidthMM(dpy, 0);
| ^~~~~~
src/duc/cmd-gui.c:344:8: error: expected declaration specifiers or ‘...’ before string constant
344 | printf("px=%d mm=%d\n", w_px,w_mm); // add this
| ^~~~~~~
src/duc/cmd-gui.c:344:25: error: expected declaration specifiers or ‘...’ before ‘w_px’
344 | printf("px=%d mm=%d\n", w_px,w_mm); // add this
| ^~~~
src/duc/cmd-gui.c:344:30: error: expected declaration specifiers or ‘...’ before ‘w_mm’
344 | printf("px=%d mm=%d\n", w_px,w_mm); // add this
| ^~~~
src/duc/cmd-gui.c:345:1: error: expected identifier or ‘(’ before ‘if’
345 | if(w_px && w_mm) {
| ^~
make[1]: [Makefile:630: src/duc/cmd-gui.o] Error 1
make[1]: Leaving directory '/home/gary/Downloads/duc-master'
make: [Makefile:398: all] Error 2
Don't know if I violated the bracket structure or what. Can you tell?
Quoting whiffee (2022-06-03 20:07:17)
I tried sticking it right at the end of cmd-gui.c like so:
Ah, no, sorry: I ment only insert the printf() line in that file around these lines as shown in the snippet, that fragment is at line 286
-- :wq ^X^Cy^K^X^C^C^C^C
Okay, I got it. I have things cleaned up now and can 'make' the source with and without the extra line in cmd-gui.c. However, I don't know where to look for the printed output. The terminal 'make' output with the added line looks like this:
make[1]: Entering directory '/home/gary/Downloads/duc-master'
depbase=echo src/duc/cmd-gui.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'
;\
gcc -DHAVE_CONFIG_H -I. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -Isrc/libduc -Isrc/libduc-graph -Isrc/glad -g -O2 -MT src/duc/cmd-gui.o -MD -MP -MF $depbase.Tpo -c -o src/duc/cmd-gui.o src/duc/cmd-gui.c &&\
mv -f $depbase.Tpo $depbase.Po
gcc -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng16 -pthread -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -Isrc/libduc -Isrc/libduc-graph -Isrc/glad -g -O2 -o duc src/libduc/buffer.o src/libduc/db.o src/libduc/db-tokyo.o src/libduc/db-kyoto.o src/libduc/db-leveldb.o src/libduc/db-sqlite3.o src/libduc/db-lmdb.o src/libduc/dir.o src/libduc/duc.o src/libduc/index.o src/libduc/canonicalize.o src/libduc/varint.o src/glad/glad.o src/libduc-graph/graph.o src/libduc-graph/graph-cairo.o src/libduc-graph/graph-opengl.o src/libduc-graph/graph-svg.o src/libduc-graph/graph-html.o src/duc/cmd-cgi.o src/duc/cmd-graph.o src/duc/cmd-gui.o src/duc/cmd-guigl.o src/duc/cmd-index.o src/duc/cmd-info.o src/duc/cmd-ls.o src/duc/cmd-ui.o src/duc/cmd-xml.o src/duc/ducrc.o src/duc/main.o -lcairo -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo -ltokyocabinet -lX11 -lncursesw -lm
make[1]: Leaving directory '/home/gary/Downloads/duc-master'
The keywords are not in there anywhere. Is there a way to make the running app show the desired info? Is there a log file somewhere? (Sorry for being so dense.)
The keywords are not in there anywhere. Is there a way to make the running app show the desired info? Is there a log file somewhere? (Sorry for being so dense.)
Yes, if you now run 'duc gui' it should print this particular line on the standard output.
Ah, slick. Okay, here it is: px=3840 mm=1016
I just thought of something. The pixel count is correct, but the mm length quoted is 40 inches. However, my monitor is only 15.6 inches. Is there a standard sized pixel factored in somewhere? If so, could that be the explanation?
Quoting whiffee (2022-06-03 22:42:18)
Ah, slick. Okay, here it is: px=3840 mm=1016
Right, that will make your dpi 25.4*3840/1016 = 96 dpi
Is your screen really 1 meter wide? Can you check the output of the following command?
xdpyinfo |grep -B2 resolution
Assuming your screen is not 1 meter wide, there is a problem with your desktop environment or X11 resulting in a wrong DPI setting. Duc picks this wrong value up and scales the font accordinly.
Quoting whiffee (2022-06-03 22:52:54)
I just thought of something. The pixel count is correct, but the mm length quoted is 40 inches. However, my monitor is only 15.6 inches. Is there a standard sized pixel factored in somewhere?
Right, there is your problem! DPI configuration is a bit of a PITA, since there are a lot of components involved in both hardware and software. I recommend googling your way around a bit to see how you can properly configure your setup to report the right display size and DPI.
If you can't make this work, we might be able to add an option to duc to override the detected DPI, but I'm pretty sure this is not the right solution to your problem.
Here's something to get you started, as you can see it's a mine field:
https://wiki.archlinux.org/title/HiDPI
-- :wq ^X^Cy^K^X^C^C^C^C
Related: Is there a simple edit to the source to double - or even triple - the size of the font in macOS ?
"F" == F Baube @.***> writes:
Related: Is there a simple edit to the source to double - or even triple - the size of the font in macOS ?
If you look in the duc.1 man page, you will see the option --css-url which you can use to the CGI script to append your own CSS options to the CGI script. You can find an example CSS file in examples/css in the source tar ball.
For the graph generation tools, you can try the --dpi switch to change some defaults when using a higher resolution display.
If you have any suggestions, or even better patches, we'd be happy to look them over and possibly include them in the next release.
John
Hi All,
Have working build on Xubuntu 21.10 but GUI is unusable on 4K monitor because of tiny fontsize.
A response to issue #201 focused on the lines in guigl.c:
I have tried 0.5, 2.0, 4.0, 8.0 and 16.0 as trial values for font_scale but it has made no difference. What else could I try?
thanks, GB