ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
535 stars 83 forks source link

ngscopeclient preferences.yml font path shall use relative path by default #596

Closed bvernoux closed 1 year ago

bvernoux commented 1 year ago

Today ngscopeclient preferences.yml use full path for all font for everything (label_font ...) even when created by default using fonts from ./fonts/xxx (usually DejaVuSans.ttf or DejaVuSansMono.ttf, potentially later DejaVuSans-Bold.ttf) So it will be better to use relative path by default at least as when you launch ngscopeclient from an other path the old one which is a full path is not found and it prevent to ngscopeclient start with an error How to fix it:

azonenberg commented 1 year ago

Relative paths doesn't sound like a great idea, since we need to allow for things like running a dev build in your working copy followed by installing system wide, and not have them stepping on each other accessing stuff in /usr/share/fonts or similar.

The better solution is for the font loading code to detect failure to load a font file and fall back to a default font if the supplied filename is nonexistent or malformed. This will recover without crashing in the rare case of a font you have selected becoming unavailable, while also ensuring determinism in other cases.

bvernoux commented 1 year ago

I do not really see what is your point towards running a dev build in your working copy so please check the https://github.com/glscopeclient/scopehal/pull/779 that clearly solve any issue with relative or full path (if relative path is not available it do like before scanning all dir for full path ...)

bvernoux commented 1 year ago

Fixed in commit f236404