helloSystem / launch

Command line tool to launch applications, will search for .app bundles and .AppDir directories in various directories, and will show launch errors in the GUI
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

Add error handler for GNUstep apps missing their fonts #16

Open darkoverlordofdata opened 3 years ago

darkoverlordofdata commented 3 years ago

GNUstep gui programs failing

To Reproduce Steps to reproduce the behavior:

2 examples

sudo pkg install gnustep systempreferences openapp SystemPreferences

or

sudo pkg install gmines open startvalume.
drill down to /usr/local/GNUstep/System//Applications click on gmines

Expected behavior I expect a gui to open displaying the gnustep sysm preferences or I expect to play gmines __ Screenshots 2021-07-06-231417_1368x768_scrot

Version (please complete the following information):

Computer (please complete the following information):

Additional context the compiler is working, and my programs that use command line or X11, or SDL2 are working. But programs using the native AppKit for their gui all fail. Example:

sudo pkg install gnustep systempreferences openapp SystemPreferences

fails with pages and pages of: 2021-07-06 23:49:37.960 SystemPreferences[14543:101571] The font specified for NSFont, Helvetica, can't be found.

Also, the Helvetica font seems to be installed: darko@sudanna /usr/local/GNUstep/System/Library/Fonts/Helvetica.nfont $ ls FontInfo.plist n019004l.pfb n019024l.afm n019043l.pfm n019063l.pfb n019003l.afm n019004l.pfm n019024l.pfb n019044l.afm n019063l.pfm n019003l.pfb n019023l.afm n019024l.pfm n019044l.pfb n019064l.afm n019003l.pfm n019023l.pfb n019043l.afm n019044l.pfm n019064l.pfb n019004l.afm n019023l.pfm n019043l.pfb n019063l.afm n019064l.pfm

probonopd commented 2 years ago

Hello @darkoverlordofdata.

Try sudo pkg install -f gnustep-back. It seems to contain the missing fonts. https://www.freshports.org/x11-toolkits/gnustep-back/

darkoverlordofdata commented 2 years ago

It just says"The most recent versions of packages are already installed". gnustep-back installs as a dependancy of gnustep. and I can see the fonts, it's just gnustep doesn't see them. I'm thinking that there is a missing config somewhere.

darkoverlordofdata commented 2 years ago

I found this debian bug from 2010 - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596159, it says workaround helloSystem/ISO#1 is to Install ttf-freefont

sudo pkg install freefont-ttf fixed the issue. Now I can play GMines!

probonopd commented 2 years ago

We could add an error handler to the launch command for this, telling the user to install that package rather than quoting the raw "The font specified for NSFont, Helvetica, can't be found" error message.

Something like this:

--- a/src/main.cpp
+++ b/src/main.cpp
@@ -96,6 +96,7 @@ void handleError(QDetachableProcess *p, QString errorString){

     QRegExp rx(".*ld-elf.so.1: (.*): version (.*) required by (.*) not found.*");
     QRegExp rxPy(".*ModuleNotFoundError: No module named '(.*)'.*");
+    QRegExp rxGnuStep(".*The font specified for NSFont, Helvetica, can't be found.*");
     QFileInfo fi(p->program());
     QString title = fi.completeBaseName(); // https://doc.qt.io/qt-5/qfileinfo.html#completeBaseName
     if(errorString.contains("FATAL: kernel too old")) {
@@ -120,6 +121,9 @@ void handleError(QDetachableProcess *p, QString errorString){
         QString missingPyModule = rxPy.cap(1);
         QString cleartextString = QString("This application requires the Python module %1 to run.\n\nPlease install it and try again.").arg(missingPyModule);
         qmesg.warning( nullptr, title, cleartextString );
+    } else if (rxGnuStep.indexIn(errorString) == 0) {
+        QString cleartextString = QString("This application requires ttf-freefont package to run.\n\nPlease install it and try again.");
+        qmesg.warning( nullptr, title, cleartextString );
     } else {
         qmesg.warning( nullptr, title, errorString );
     }
probonopd commented 2 years ago

It seems like it is missing the dependency on ttf-freefont:

% sudo pkg install gmines
Password:
Updating FreeBSD repository catalogue...
Fetching packagesite.txz: 100%    6 MiB 921.4kB/s    00:07    
Processing entries: 100%
FreeBSD repository update completed. 30505 packages processed.
All repositories are up to date.
The following 10 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        flac: 1.3.3_1
        flite: 2.1
        gmines: 0.2_8
        gnustep-back: 0.28.0
        gnustep-base: 1.27.0
        gnustep-gui: 0.28.0
        gnustep-make: 2.8.0
        libao: 1.2.0_5
        libobjc2: 2.1_3
        libsndfile: 1.0.31

Number of packages to be installed: 10

The process will require 98 MiB more space.
20 MiB to be downloaded.

Proceed with this action? [y/N]:

I think a bug should be opened at bugs.freebsd.org regarding the missing dependency.