abishekvashok / cmatrix

Terminal based "The Matrix" like implementation
GNU General Public License v3.0
4.04k stars 421 forks source link

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

Open tushar-semwal opened 5 years ago

tushar-semwal commented 5 years ago

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

bracketttc commented 5 years ago

Occurs under RHEL7 as well.

kakulukia commented 5 years ago

and OSX

ghost commented 4 years ago

Necro, occurs on Fedora 32 using the git master branch

oxr463 commented 4 years ago
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.

PauloFavero commented 4 years ago
```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

ulville commented 4 years ago

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

Zorrototo commented 4 years ago

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

kneel23 commented 4 years ago

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

SuperSandro2000 commented 4 years ago

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.

ulville commented 4 years ago

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.

oxr463 commented 4 years ago

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?

ulville commented 4 years ago

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.

oxr463 commented 4 years ago

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.

SuperSandro2000 commented 4 years ago

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

ulville commented 4 years ago

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.

oxr463 commented 4 years ago

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

ulville commented 4 years ago

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.

Flipp3rrr commented 3 years ago

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.

space-pagan commented 3 years ago

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.

SuperSandro2000 commented 3 years ago

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.

space-pagan commented 3 years ago

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?

ulville commented 3 years ago

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.

kneel23 commented 3 years ago

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

space-pagan commented 3 years ago

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

ulville commented 3 years ago

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 commented 3 years ago

@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

space-pagan commented 3 years ago

What error specifically, do you get?

ulville commented 3 years ago

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

space-pagan commented 3 years ago

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.
ulville commented 3 years ago

@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.
space-pagan commented 3 years ago

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.

ulville commented 3 years ago

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.

space-pagan commented 3 years ago

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

ghost commented 3 years ago

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 commented 3 years ago

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

ulville commented 3 years ago

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

space-pagan commented 3 years ago

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.

ghost commented 3 years ago

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

thanks for the patch!

space-pagan commented 3 years ago

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!

ghost commented 3 years ago

@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

space-pagan commented 3 years ago

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

ulville commented 3 years ago

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 .

space-pagan commented 3 years ago

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.

ghost commented 3 years ago

@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?

space-pagan commented 3 years ago

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

ghost commented 3 years ago

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

abishekvashok commented 3 years ago

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

ulville commented 3 years ago

@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

brandonmcconnell commented 2 years ago

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

Nezteb commented 2 years ago

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