cmatrix icon indicating copy to clipboard operation
cmatrix copied to clipboard

Unable to use both "setfont" and "consolechars".

Open tushar-semwal opened this issue 5 years ago • 51 comments

I am submitting a

Problem in Brief

cmatrix -lba pops error as mentioned in the title. Same error pops while using cmatrix on WSL (windows subsystem for linux).

Solution (if any)

Would you like to work on it?

no

tushar-semwal avatar May 18 '19 09:05 tushar-semwal

Occurs under RHEL7 as well.

bracketttc avatar Aug 08 '19 20:08 bracketttc

and OSX

kakulukia avatar Oct 02 '19 12:10 kakulukia

Necro, occurs on Fedora 32 using the git master branch

ghost avatar Jun 14 '20 05:06 ghost

cmatrix -lba
Unable to use both "setfont" and "consolechars".

Looks like the problem is with the -l flag. Both -b, and -a work individually and together, e.g. -ab.

oxr463 avatar Jun 17 '20 00:06 oxr463

```shell
cmatrix -lba
Unable to use both "setfont" and "consolechars".

Looks like the problem is with the -l flag. Both -b, and -a work individually and together, e.g. -ab.

I experienced the same issue here. It only works without the -l flag on MacOs

PauloFavero avatar Jun 30 '20 14:06 PauloFavero

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

ulville avatar Aug 05 '20 20:08 ulville

Can confirm as well for the same bug on Manjaro with the -l flag

Zorrototo avatar Aug 30 '20 21:08 Zorrototo

Having this in iTerm2 and all shells on OSX Mojave as well

kneel23 avatar Sep 21 '20 22:09 kneel23

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

SuperSandro2000 avatar Sep 22 '20 09:09 SuperSandro2000

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

ulville avatar Sep 22 '20 14:09 ulville

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

oxr463 avatar Sep 22 '20 14:09 oxr463

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

Yes, a local one. SSH'ing from another computer also creates a TTY but I don't think you can use the -l flag over ssh. Terminology on this subject is a little bit complicated.

ulville avatar Sep 22 '20 14:09 ulville

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

Yes, a local one. SSH'ing from another computer also creates a TTY but I don't think you can use the -l flag over ssh. Terminology on this subject is a little bit complicated.

Not sure what you're basing any of this on. If you look at the code, it simply calls consolechars, which can be run in Konsole, via ssh, etc. This is a standard utility.

oxr463 avatar Sep 22 '20 15:09 oxr463

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

Does not work their either.

SuperSandro2000 avatar Sep 22 '20 17:09 SuperSandro2000

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

Yes, a local one. SSH'ing from another computer also creates a TTY but I don't think you can use the -l flag over ssh. Terminology on this subject is a little bit complicated.

Not sure what you're basing any of this on. If you look at the code, it simply calls consolechars, which can be run in Konsole, via ssh, etc. This is a standard utility.

Yeah? So try changing your Konsole or gnome-terminal or any other graphical terminal emulator font using consolechars. Or try using your terminal's font while you are in a ssh session. Or even try it in a TTY (it would work if we were living in 2009 or something like that). "consolechars" is an obsolete command. Manjaro and Arch use "setfont" instead. Debian also doesn't include it in their repos anymore. It uses "dpkg-reconfigure console-setup" or "setfont" to change TTY font. And neither setfont nor debian's solution don't change your X terminal emulator's (ie Konsole, Gnome Terminal, xfce4-terminal, etc.) font.

ulville avatar Sep 22 '20 17:09 ulville

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

Yes, a local one. SSH'ing from another computer also creates a TTY but I don't think you can use the -l flag over ssh. Terminology on this subject is a little bit complicated.

Not sure what you're basing any of this on. If you look at the code, it simply calls consolechars, which can be run in Konsole, via ssh, etc. This is a standard utility.

Yeah? So try changing your Konsole or gnome-terminal or any other graphical terminal emulator font using consolechars. Or try using your terminal's font while you are in a ssh session. Or even try it in a TTY (it would work if we were living in 2009 or something like that). "consolechars" is an obsolete command. Manjaro and Arch use "setfont" instead. Debian also doesn't include it in their repos anymore. It uses "dpkg-reconfigure console-setup" or "setfont" to change TTY font. And neither setfont nor debian's solution don't change your X terminal emulator's (ie Konsole, Gnome Terminal, xfce4-terminal, etc.) font.

That is what is used in the code, hence this bug report...

oxr463 avatar Sep 22 '20 17:09 oxr463

I can confirm that the problem is with the -l flag and still exists. I have same issue with Arch and Manjaro. It works on Debian 10 though (all installed from official repos).

Does not work for me on Debian bullseye in Konsole.

-l flag is for linux console (the one you get with Ctrl+Alt+F3). You can't use it with graphical terminal emulators.

You mean a TTY?

Yes, a local one. SSH'ing from another computer also creates a TTY but I don't think you can use the -l flag over ssh. Terminology on this subject is a little bit complicated.

Not sure what you're basing any of this on. If you look at the code, it simply calls consolechars, which can be run in Konsole, via ssh, etc. This is a standard utility.

Yeah? So try changing your Konsole or gnome-terminal or any other graphical terminal emulator font using consolechars. Or try using your terminal's font while you are in a ssh session. Or even try it in a TTY (it would work if we were living in 2009 or something like that). "consolechars" is an obsolete command. Manjaro and Arch use "setfont" instead. Debian also doesn't include it in their repos anymore. It uses "dpkg-reconfigure console-setup" or "setfont" to change TTY font. And neither setfont nor debian's solution don't change your X terminal emulator's (ie Konsole, Gnome Terminal, xfce4-terminal, etc.) font.

That is what is used in the code, hence this bug report...

If I understand correctly; In the configure.ac file it checks for setfont or consolechars exists in the system. If one of them does, then it compiles it with HAVE_SETFONT or HAVE_CONSOLECHARS defined. In the main C code it checks if one of them defined and it uses that command to change console font accordingly. If none of them is defined then it shows this error message.

The problem is even though most distros include setfont command (in my case Manjaro), cmatrix appears to be configured in a way that it doesn't detect setfont exists. Or at least the binaries in repos are compiled that way. I haven't yet compiled it from source myself to test. But in my tests on Debian 10 and Ubuntu, when run with -l flag, it uses setfont command to change console font to matrix.fnt without any problem. (This doesn't mean it works on graphical terminal emulators running on a X11 / Wayland session. It tries to, but setfont command gives an error when run outside of a TTY, even if you run setfont manually. That's why I say -l is not for graphical terminal emulators. If you want this to work in graphical term. emulators then It's a feature request, not a bug)

I think the problem on Manjaro and Arch is about preconfiguration processes. Maybe package maintainers haven't compiled it with setfont in mind. I will try to compile it myself as soon as possible and share the results here. If they're the packages in the repos that are problematic then maybe the package maintainers need to be informed.

ulville avatar Sep 22 '20 19:09 ulville

This same issue arises on Arch Linux with Terminator (installed via pacman) and macOS Catalina and Big Sur with iTerm2 (installed via homebrew). Both terminals use the Powerline fonts. When I run cmatrix without any flags (tested the -lba and -ol flags, those don't work) it does work.

Flipp3rrr avatar Nov 19 '20 12:11 Flipp3rrr

I think this bug report along with #85 arise from a misunderstanding of the feature and poor documentation in the --help and manpage, rather than from an actual bug in the code. The -l flag will not work outside of a tty.

space-pagan avatar Dec 07 '20 13:12 space-pagan

I think this bug report along with #85 arise from a misunderstanding of the feature and poor documentation in the --help and manpage, rather than from an actual bug in the code. The -l flag will not work outside of a tty.

Tested it with an actual tty and it does not work there either.

SuperSandro2000 avatar Dec 07 '20 13:12 SuperSandro2000

I just did as well. Seems to work fine (arch linux 5.9.12) image image

@SuperSandro2000 Can you provide more details about your system? Do you have setfont, or consolechars (or both) installed?

space-pagan avatar Dec 07 '20 13:12 space-pagan

I think this bug report along with #85 arise from a misunderstanding of the feature and poor documentation in the --help and manpage, rather than from an actual bug in the code. The -l flag will not work outside of a tty.

This is what I was trying to say and I was almost getting lynched because of it 😂 Anyways It wasn't working on Manjaro or Arch for me even in a TTY (works on deb based distros) but I haven't tried for a while. maybe it's fixed now, I'll try this evening. Even it doesn't work, seeing someone reporting it's working on an Arch based distro is something, a starting point to investigate at least.

ulville avatar Dec 07 '20 14:12 ulville

Who is running this in a TTY? AReally would love to figure a workaround for getting the japanese characters to work in terminal like a normal civilized human being

kneel23 avatar Dec 07 '20 15:12 kneel23

@kneel23 I cannot speak for MacOS, but in Linux, applications generally cannot change a running terminal emulator's font. (specifically because there isn't really a standard for doing this, and often the font used by the emulator is specified somewhere in the emulator's configuration and cannot be changed without reloading.

What you're asking for would require a full rewrite to make this application handle its own gui and font modes. I don't think you should hold your breath on that.

As far as getting the Japanese characters to work natively in terminal, please see #57 and my updates there.

space-pagan avatar Dec 07 '20 16:12 space-pagan

Who is running this in a TTY? AReally would love to figure a workaround for getting the japanese characters to work in terminal like a normal civilized human being

Yes, but I think it should be under another issue title. Because it's not a bug, it's a feature request. It can be done, there are other programs that do it like this one: https://github.com/M4444/TMatrix

I don't say it can be closed because I still have issues even in TTY (this is how it supposed to work). But While it's an issue tagged as "bug", there should be another issue for problems about graphical terminal emulators

ulville avatar Dec 07 '20 16:12 ulville

@space-pagan I tried it on manjaro again and it still doesn't work and gives the error in the title. I have setfont installed and it works well when I run it manually

ulville avatar Dec 07 '20 16:12 ulville

What error specifically, do you get?

space-pagan avatar Dec 07 '20 16:12 space-pagan

@space-pagan it returns Unable to use both "setfont" and "consolechars". and program stops. I'm not a C guru but I looked at the code and search for this sentence. I think it's about how it's compiled in the first place. But even when I tried to compile it myself I couldn't make it work.

ulville avatar Dec 07 '20 16:12 ulville

Okay, I think it's something with the way the pre-compiler is operating, but I'm going to need you to answer some stuff so I can narrow it down:

  1. Which method are you using for compilation, CMake or ./configure
  2. Please let me know the output of which setfont
  3. If possible, grab a clean copy of the repo and recompile. Please pipe all output to a log file and upload to something like pastebin so I can take a look at it
  4. try editing your config.h file, look for either a line that says #define HAVE_SETFONT 0 and change it to #define HAVE_SETFONT 1, or if the line is not present at all, just add #define HAVE_SETFONT 1 to the end of the file. Run make and see if it helps.

space-pagan avatar Dec 07 '20 16:12 space-pagan

@space-pagan

  1. I use ./configure
  2. It returns /usr/bin/setfont
  3. here is the outputs of all the commands There is this part in the output of ./configure command which can be relevant:

checking for consolechars... no
checking for setfont... /usr/bin/setfont
checking for /usr/lib/kbd/consolefonts... no
checking for /usr/share/consolefonts... no
configure: WARNING:

*** You do not appear to have a consolefonts directory in a standard location
*** (/usr/lib/kbd or /usr/share), even though you appear to have the
*** consolechars and/or setfont command.  The matrix font for the console
*** will not be installed.  This means you will not be able to use the
*** matrix console font (and the -l command line switch) unless the font
*** is located in your current directory when you run CMatrix.

checking for mkfontdir... no
checking for /usr/share/fonts/misc... yes
checking for /usr/X11R6/lib/X11/fonts/misc... no

the compiled program doesn't give the same error message but instead of japanese characters it shows lots of ?s , ↑s and some random western alphabet characters. I also tried running it in root directory of the cloned repo because matrix font file is located in there but the result didn't change.

It also doesn't install matrix font file into my consolefonts directory which is /usr/share/kbd/consolefonts . When I install cmatrix with pacman from Manjaro repos it installs matrix font to that location.

  1. It had #define HAVE_SETFONT /usr/bin/setfont. I tried changing it to 1 but result didn't change.

ulville avatar Dec 07 '20 19:12 ulville

Pardon me re 4. - it should be #define HAVE_SETFONT /usr/bin/setfont as it was set. It sounds like compiling from scratch fixed whichever particular issue was causing it to not recognize setfont at all.

It's also pretty weird that you're getting ?'s, since the characters being put to terminal are within the normal ascii range, and should be rendered correctly even if setfont isn't loading correctly... (the font just overrides the normal a-zA-Z range)

One thing I can think of is that you did a make install so when you call cmatrix -l, it's probably calling the one in your /usr/local/bin, not the one in the folder (and obviously not finding the font file). Could you do sudo make uninstall and from within the repo folder run cmatrix -l inside a tty? Also if you don't mind, could you take a picture of the tty?

Thanks for being cooperative on this. I'm seeing myself doing a fairly sizeable PR and I'm trying to incorporate as many fixes at once as I can.

space-pagan avatar Dec 07 '20 19:12 space-pagan

DSC_4679

DSC_4681

@space-pagan here they are.

PS: Since I removed Manjaro version of cmatrix using pacman matrix font is also removed from my /usr/share/kbd/consolefonts directory. It's not in there right now. And compiling from git repo doesn't install it there because it doesn't check that specific path. It only checks /usr/lib/kbd/consolefonts and /usr/share/consolefonts. and gives the warning in my message one above.

ulville avatar Dec 07 '20 21:12 ulville

Right. I've patched that install location in my fork. Care to give it a try?

space-pagan avatar Dec 07 '20 21:12 space-pagan

Right. I've patched that install location in my fork. Care to give it a try?

can confirm that your local fork works properly on my machine (fedora 32, 5.9.11-100.fc32.x86_64)

image

ghost avatar Dec 07 '20 23:12 ghost

can confirm that your local fork works properly on my machine (fedora 32, 5.9.11-100.fc32.x86_64)

the cmake build is broken though, it doesn't link ncursesw

ghost avatar Dec 07 '20 23:12 ghost

Right. I've patched that install location in my fork. Care to give it a try?

I can confirm that it works with your patch! Thank you for all your efforts.

didn't quite liked the more dense rain though

ulville avatar Dec 07 '20 23:12 ulville

can confirm that your local fork works properly on my machine (fedora 32, 5.9.11-100.fc32.x86_64)

the cmake build is broken though, it doesn't link ncursesw

Well, I never said it was a ready release. Good to know this specific issue is fixed though, and I'll fix the cmake issue you mentiojned and work on the other open feature requests in the tickets here.

@ulichx I was going to add a option flag for that.

space-pagan avatar Dec 07 '20 23:12 space-pagan

just wanted to let ya know in case you weren't aware :p

thanks for the patch!

ghost avatar Dec 08 '20 00:12 ghost

Turns out that the CMake configuration wasn't even searching for, nor defining HAVE_SETFONT or HAVE_CONSOLECHARS. I just pushed a fix on my local fork and would appreciate if I could get feedback on if it's working as intended!

space-pagan avatar Dec 08 '20 13:12 space-pagan

@space-pagan can confirm this works perfectly! i haven't run through every combination of options, but c, ca, cab, and caB all work perfectly for me with a cmake build of your fork. thanks for working on this, i can finally feel like A Real Hacker again :p

ghost avatar Dec 09 '20 17:12 ghost

@3n-k1 thank you for the feedback! The -c option (ticket #57) is actually unrelated to the -l setfont/consolechar stuff, but I'm still glad to know that it's working for you! If you have time, I would also like to know if the cmake binary's -l option is working in tty, so that we can maybe get this ticket closed. (I've tested it and it works for me, but the more people who can give feedback, the better)

space-pagan avatar Dec 09 '20 17:12 space-pagan

Turns out that the CMake configuration wasn't even searching for, nor defining HAVE_SETFONT or HAVE_CONSOLECHARS. I just pushed a fix on my local fork and would appreciate if I could get feedback on if it's working as intended!

I can confirm that with cmake your fork builds and works as intended. Characters shows correctly. But overall running is a little bit buggy. Characters slowly pile up together and once after a while everything on the screen jumps one line up .

ulville avatar Dec 10 '20 17:12 ulville

Okay, great! I noticed the jumping issue as well. I'll look into why it's happening. The current code for generating the streams is actually really poorly written in my opinion, so I'm going to be doing a fairly sizeable rewrite soon, so it might be a non-issue once I do. We'll see.

space-pagan avatar Dec 10 '20 17:12 space-pagan

@space-pagan huh, really? well upstream's -c is borked, but yours works fine haha

-lba works fine in a tty after installing the font. it doesn't work in a terminal emulator, but i'm pretty sure it's not supposed to be able to?

ghost avatar Dec 11 '20 06:12 ghost

@3n-k1 well... that's because I've been fixing upstream's code... And you're correct that -l is only available in tty.

Anyway, I think this is pretty much solved. I'll request that it gets closed once I submit my pr. I'm just trying to solve all the open tickets in one go.

space-pagan avatar Dec 11 '20 07:12 space-pagan

@space-pagan you're literally a hero, thank you so much for your hard work <3

ghost avatar Dec 11 '20 17:12 ghost

Turns out that the CMake configuration wasn't even searching for, nor defining HAVE_SETFONT or HAVE_CONSOLECHARS. I just pushed a fix on my local fork and would appreciate if I could get feedback on if it's working as intended!

Pretty odd but well looked into, appreciate if you could make a PR :D

abishekvashok avatar Dec 12 '20 11:12 abishekvashok

@space-pagan you may wanna make a pull request including only fixes about setfont issues on .configure and cmake methods for now, so this fixes can be mainlined quicker in my opinion. And again thanks for your efforts on this

ulville avatar Dec 12 '20 13:12 ulville

Still getting this same issue on my MacBook Pro Late 2013 model, running macOS Big Sur and a fresh install of cmatrix.

Unable to use both "setfont" and "consolechars".

Happened when attempting to execute cmatrix -lba I get the same error when trying to run cmatrix -ol

brandonmcconnell avatar Dec 08 '21 22:12 brandonmcconnell

@space-pagan Could you submit a PR to this repo based on your fork? https://github.com/space-pagan/cmatrix

Nezteb avatar Dec 10 '21 06:12 Nezteb

It's sad @space-pagan 's fork has not further developed to be a stable build and merged into upstream. Seems like they're not active on github anymore.

That's why I had suggested this:

@space-pagan you may wanna make a pull request including only fixes about setfont issues on .configure and cmake methods for now, so this fixes can be mainlined quicker in my opinion. And again thanks for your efforts on this

Can anyone capable of doing this at least fork @space-pagan 's repo, rebase to this repos master and apply only changes related to this setfont etc. issue and make a PR?

ulville avatar Jul 24 '22 14:07 ulville