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

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

Open
tushar-semwal opened this issue May 18, 2019 · 51 comments
Open

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

tushar-semwal opened this issue May 18, 2019 · 51 comments
Labels

Comments

@tushar-semwal
Copy link

tushar-semwal commented May 18, 2019

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
Copy link

Occurs under RHEL7 as well.

@kakulukia
Copy link

and OSX

@ghost
Copy link

ghost commented Jun 14, 2020

Necro, occurs on Fedora 32 using the git master branch

@oxr463
Copy link

oxr463 commented Jun 17, 2020

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
Copy link

PauloFavero commented Jun 30, 2020

```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
Copy link

ulville commented Aug 5, 2020

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
Copy link

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

@kneel23
Copy link

kneel23 commented Sep 21, 2020

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

@SuperSandro2000
Copy link

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
Copy link

ulville commented Sep 22, 2020

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
Copy link

oxr463 commented Sep 22, 2020

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
Copy link

ulville commented Sep 22, 2020

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
Copy link

oxr463 commented Sep 22, 2020

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
Copy link

-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
Copy link

ulville commented Sep 22, 2020

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
Copy link

oxr463 commented Sep 22, 2020

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
Copy link

ulville commented Sep 22, 2020

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

ulville commented Dec 7, 2020

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
Copy link

kneel23 commented Dec 7, 2020

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
Copy link

@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
Copy link

ulville commented Dec 7, 2020

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
Copy link

ulville commented Dec 7, 2020

@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
Copy link

What error specifically, do you get?

@ulville
Copy link

ulville commented Dec 7, 2020

@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
Copy link

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
Copy link

ulville commented Dec 7, 2020

@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
Copy link

space-pagan commented Dec 7, 2020

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
Copy link

ulville commented Dec 7, 2020

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
Copy link

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

@ghost
Copy link

ghost commented Dec 7, 2020

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
Copy link

ghost commented Dec 7, 2020

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
Copy link

ulville commented Dec 7, 2020

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
Copy link

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
Copy link

ghost commented Dec 8, 2020

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

thanks for the patch!

@space-pagan
Copy link

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
Copy link

ghost commented Dec 9, 2020

@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
Copy link

space-pagan commented Dec 9, 2020

@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
Copy link

ulville commented Dec 10, 2020

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
Copy link

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
Copy link

ghost commented Dec 11, 2020

@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
Copy link

space-pagan commented Dec 11, 2020

@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
Copy link

ghost commented Dec 11, 2020

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

@abishekvashok
Copy link
Owner

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
Copy link

ulville commented Dec 12, 2020

@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
Copy link

brandonmcconnell commented Dec 8, 2021

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
Copy link

Nezteb commented Dec 10, 2021

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

@ulville
Copy link

ulville commented Jul 24, 2022

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?

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

No branches or pull requests