Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font size in GUI #292

Open
whiffee opened this issue Jun 3, 2022 · 11 comments
Open

Font size in GUI #292

whiffee opened this issue Jun 3, 2022 · 11 comments

Comments

@whiffee
Copy link

whiffee commented Jun 3, 2022

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:

double font_scale = 1.0;
sc2fb(window, &font_scale, NULL);
graph = duc_graph_new_opengl(duc, font_scale);

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

@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

@whiffee
Copy link
Author

whiffee commented Jun 3, 2022

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:

  • 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

gary@xubu2110:~/Downloads/duc-master$

@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

@whiffee
Copy link
Author

whiffee commented Jun 3, 2022

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);
}

#endif

/*

  • End

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?



@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

@whiffee
Copy link
Author

whiffee commented Jun 3, 2022

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.)

@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

@whiffee
Copy link
Author

whiffee commented Jun 3, 2022

Ah, slick. Okay, here it is:
px=3840 mm=1016

@whiffee
Copy link
Author

whiffee commented Jun 3, 2022

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?

@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

@zevv
Copy link
Owner

zevv commented Jun 3, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants