Montag, 30. Mai 2022

Lilypond erzeugt ghotscript-Fehler

Nach dem Umzug auf eine vollkommen neue Linux-Installation (openSUSE LEAP 15.0) versagte auf einmal die Ausgabe von Lilypond nach PDF. Die Konvertierung von Postscript nach PDF brach mit dieser Fehlermeldung ab:
GPL Ghostscript 9.23: Warning: 'loca' length 13 is greater than numGlyphs 1 in the font Roboto-Regular.
Das kam schon sehr unerwartet, denn die gleiche Lilypond-Datei hatte sich mit der gleichen Lilypond-Version (2.18.2) in der alten Umgebung problemlos übersetzen lassen. Dass hier die verwendete Ghostscript-Version, jetzt 9.23, vorher eine späte 8.x, die Ursache sei, ließ sich relativ schnell ausschließen, da eine Internet-Recherche diese Fehlermeldung auch mit älteren Ghostscript-Versionen zutage förderte. Recht bald war klar, dass das Problem höchstens mittelbar mit Lilypond zu tun hatte. Verursacher ist die Schrift Roboto-Regular, die von Ghostscript offenbar nicht in ein PDF übertragen werden kann. Nebenbefund ist, dass ein Postscript-Interpreter mit der Postscript-Ausgabe von Lilypond auch nicht zurecht kommt. Evince, das im Hintergrund ebenfalls ghostscript zu Hilfe nimmt, schreibt exakt die gleiche Fehlermeldung. Damit stellte ich die Frage, wieso Lilypond jetzt auf einmal diese Schriftart verwendete. Nach einigem Suchen stellte sich das Pango-Schriftsystem und die Art, wie Lilypond damit umgeht als Ursache heraus:
  1. Lilypond legt in der Datei font.scm die verwendeten Zeichensätze fest. Für normalen Text wird dort New Century Schoolbook, also eine serifenbetonte Schrift, bestimmt. Für serifenlose Schriften (sans) ist dort nur die Angabe "sans-serif" und für Schriften mit gleicher Zeichenbreite (typewriter) die Angabe "monospace" zu finden.
  2. Entweder wird in der Lilypond-Datei sans-serif explizit in einem Markup verlangt oder es kommt implizit über eine Akkordnotation (chordmode) ins Spiel.
  3. Damit überlässt Lilypond dem Schriftsystem die Auswahl eines konkreten Zeichensatzes. Mit der Option --verbose wird das an diesem Log-Schnippsel erkennbar:
    Layout nach »ghostscript-error.ps« ausgeben...
    [/usr/share/fonts/truetype/CenturySchL-Roma.otf]
    [/usr/share/fonts/truetype/Roboto-Regular.ttf]
    [/usr/share/lilypond/2.18.2/ps/music-drawing-routines.ps]
    
  4. Diese Auswahl wird durch das FontConig-Werkzeug fc-match bestätigt. Der Aufruf fc-match sans-serif liefert das Ergebnis Roboto-Regular.ttf: "Roboto" "Regular".
  5. Damit war klar, dass meine neue Installation, die für mich erstmalig die Schriftfamilie roboto installierte, dafür verantwortlich ist.
Da ich das gesamte Schriftsystem meiner openSUSE-Installation nicht verbiegen wollte, sieht meine Lösung so aus, dass ich in der betreffenden Lilypond-Datei in der Deklaration der Formatierung (Makro paper) die Standardeinstellung von Lilypond bezüglich der sans-serif-Schrift konkretisiere:
  #(define fonts 
    (make-pango-font-tree "Century Schoolbook L"
                          "DejaVu Sans"
                          "monospace"
                           (/ 18 20)))
Darin ist das vierte Argument der Skalierungsfaktor. Das Zitat ist einer Datei entnommen, in der mit #(set-global-staff-size 18) die Notensystem etwas verkleinert gesetzt werden.

Samstag, 28. März 2015

Timidity++ und der Orgel-Soundfont "Jeux d'Orgues 2"

Zu dem Soundfont gehört eine kleine Readme-Datei, der die folgende Liste entnommen ist:

* Grand orgue / Hauptwerk
Montre 8      / Prinzipal
Bordun 8      / Brummbass (Gedackt)
Salicional 8  / Geigenprinzipal
Trompette 8   / Trompete
Octav 4       / Oktave
Floete 4      / (Block-)Flöte
Doublette 2   / 2'-Prinzipal
Fourniture 3 rgs.  / Mixtur
Cornett       / Kornett

* Positif de dos / Positiv
Bordun 8      / Brummbass (Gedackt)
Hautbois 8    / Oboe
Prestant 4    / Praestand / Prinzipal
Nazard 2 2/3  / Rohrflöte
Doublette 2   / 2'-Prinzipal
Tierce 1 3/5  / Terz
Cymbale 3 rgs. / Zimbel (Mixtur)

* Pédale
Subbass 16    / Subbass
Floete 8      / (Block_)Flöte
Trompette 8   / Trompete
Prestant 4    / Prinzipal

Die Übertragung der französischen Registerbezeichnungen ins Deutsche ist "auf gut Glück" vorgenommen. Das sind drei Werke mit insgesamt 20 Registern. In dem Soundfont aber nur 14 Stimmen (Instrumente) bereitgestellt. Die folgende Tabelle enthält die Zordnung der Register zu den MIDI-INstrumenten:

Soundfont Jeu d'Orgues 2: Presets und zugeordnete MIDI-Presets
Name Id Instrument Id Bemerkung
I Principaux 8 4 0 I Montre 8 1
I Octav 4 4
I Principaux 8 4 2 1 I Montre 8 1
I Octav 4 4
I Doublette 2 6
I Fonds 8 2 2 II Bordun 8 11
I Doublette 2 6
I Plein jeu 3 I Plein jeu 9
I Grand plein jeu 4 I Bordun 16 0
I Plain jeu 9
II Petit plein jeu 17
I Flötes 4 2 5 I Bordun 8 2
I Fleute 4 5
I Fonds 8 6 I Montre 8 1
I Bordun 8 2
I Grand jeu 7 I Trompette 8 10
I Cornett 8
II Fonds 8 4 8 II Bordun 8 11
II Prestant 4 12
II Fonds 8 2 9 II Bordun 8 11
II Doublette 2 14
II Petit plein jeu 10 II Petit plein jeu 17
II Tremblant 11 II Bordun 8 11
II Nazard 2 2/3 13
P Plein jeu 12 I Plein jeu 9
P Subbass 16 19
P Floete 8 20
P Prestant 4 22
P Fonds 8 16 13 P Subbass 16 19
P Floete 8 20
P Tutti 14 I Plein jeu 9
P Subbass 16 19
P Trompette 8 21
I Trompette 8 10
I Trompette 8 10 Nach unten oktaviert.
Die Instrument-IDs 7, 15 und 16 sind nicht vergeben.
Mit den folgenden Schritten habe ich mir diesen Soundfont in einer älteren Linux-Umgebung für Timidity++ auf der Bank 2 bereitgestellt:
  1. Die Soundfont-Datei in einem sinnvollen Ordner, z.B. /var/lib/soundfonts, ablegen und den Eigentümer auf root.users stellen.
  2. Timidity++ den zusätzlichen Ordner bekannt machen. Dazu den Ordner /var/lib/timidity anlegen und die Konfigurationsdatei jeux_d_orgues_2.cfg anlegen. Hier ist der Inhalt dieser Datei:
    dir /var/lib/soundfonts
    bank 2
    soundfont "jeux d'orgues 2.sf2"
    # Nun die Zuordnung der Stimmen (0-14)
    0 %font "jeux d'orgues 2.sf2" 0 0
    1 %font "jeux d'orgues 2.sf2" 0 1
    2 %font "jeux d'orgues 2.sf2" 0 2
    3 %font "jeux d'orgues 2.sf2" 0 3
    4 %font "jeux d'orgues 2.sf2" 0 4
    5 %font "jeux d'orgues 2.sf2" 0 5
    6 %font "jeux d'orgues 2.sf2" 0 6
    7 %font "jeux d'orgues 2.sf2" 0 7
    8 %font "jeux d'orgues 2.sf2" 0 8
    9 %font "jeux d'orgues 2.sf2" 0 9
    10 %font "jeux d'orgues 2.sf2" 0 10
    11 %font "jeux d'orgues 2.sf2" 0 11
    12 %font "jeux d'orgues 2.sf2" 0 12
    13 %font "jeux d'orgues 2.sf2" 0 13
    14 %font "jeux d'orgues 2.sf2" 0 14
    
  3. Die Hauptkonfigurationsdatei von Timidity++ /etc/timidity.cfg um den Eintrag source /var/lib/timidity/jeux_d_orgues_2.cfg erweitern.
  4. Darauf achten, dass der Soundfont, der als Bank 0 verwendet werden soll, als letzter geladen wird.

Dienstag, 16. Oktober 2012

bind9: In function `_start': undefined reference to `main'

Compiling bind9 may throw this error

/bin/sh [...]/bind-9.8.4/libtool --mode=link --tag=CC gcc -shared -o driver.so
driver.lo
libtool: link: gcc -o driver.so .libs/driver.o
/usr/lib/gcc/i486-suse-linux/3.4.6/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status


during compilation in folder dlzexternal.

Most probably reason for this is bug in bin/tests/system/dlzexternal/Makefile.in. Replace this line

        ${LIBTOOL_MODE_LINK} @SO_LD@ -o $@ driver.@O@

by

        ${LIBTOOL_MODE_LINK} @SO_LD@ -o $@ driver.@O@ dlopen.@O@

Montag, 9. April 2012

Linux kernel 2.4.x: modutils and SIGSEGV

Kernel modules compiled using "modern" compilers like GCC 3.4.x create modules that may raise SIGSEGV errors if accessed by modutil tools. Reason is "richer" ELF tables that may contain entries of type ABS lacking a name entry. Example (using readelf with argument -s):

Symbol table '.symtab' contains 473 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
[...]
    16: 00000000     0 FILE    LOCAL  DEFAULT  ABS 
[...] 

ELF tables use some signal values for struct property st_shndx. Vanilla code of modutils (up 2.4.27) does not respect those special values and use them as array index. SHN_ABS is defined as 0xFFF1 (see elf.h) which is decimal 65521. Using that as index into array pointed to by f->sections creates fairly sure SIGSEGV as mentioned earlier.


Following patch applied on file obj_load.c

--- modutils-2.4.27-orig/obj/obj_load.c 2003-10-27 03:59:12.000000000 +0100
+++ modutils-2.4.27/obj/obj_load.c      2012-04-07 17:52:05.000000000 +0200
@@ -232,10 +232,10 @@
            /* Insert all symbols into the hash table.  */
            for (j = 1, ++sym; j < nsym; ++j, ++sym)
              {
-               const char *name;
+               const char *name = "";
                if (sym->st_name)
                  name = strtab+sym->st_name;
-               else
+               else if (sym->st_shndx < SHN_LORESERVE)
                  name = f->sections[sym->st_shndx]->name;

                 {

fixes that issue.

Dienstag, 18. Oktober 2011

StarOffice/OpenOffice/LibreOffice bestimmtes Arbeitsblatt in BASIC-Makro aktivieren

Wenn man bereits ein Sheet-Objekt bei der Hand hat, genügt die simple Zuweisung
Set thisComponent.CurrentController.ActiveSheet = oSheet
um die gewünschte Aktivierung zu erreichen. An anderer Stelle wurde schon behauptet, es gäbe keine zu Worksheet_Activate (Excel) vergleichbare Methode in Calc. Da verschiedene Methoden zur Ermittlung des gewünschten Sheet-Objektes zur Verfügung stehen, üblicherweise Variationen von Abfragen auf dem Objekt thisComponent.Sheets, gelingt der Wechsel auf ein anderes Blatt in ein oder zwei Zeilen.

Sonntag, 16. Oktober 2011

StarOffice/OpenOffice/LibreOffice Formel in Calc mit Makro erstellen gibt #NAME?

Wenn man Formeln in einem Makro erzeugt, beispielsweise durch die Zuweisung an die Zell-Objekt-Eigenschaft Formula, kann es passieren, dass danach in Calc #NAME? angezeigt wird. Eigenartigerweise verschwindet das, wenn man einmal in den Änderungsmodus der Zelle wechsel (F2) und den Curser innerhalb der umschließenden Klammern plaziert und mit Enter bestätigt.

Die Ursache scheint zu sein, dass lokalisierte Funktionsnamen, also beispielsweise WENN() anstelle von IF() beim Einfügung über die Formula-Methode nicht automatisch in die interne englischsprachige Darstellung umgewandelt wird.

Lösung: Beim Zuweisen zu Formula die Formel mit englischen Funktionsnamen schreiben. Die Darstellung erfolgt danach automatisch in der lokalisierten Form.

Beispiel:
Anstelle von
oCell.Formula = "ZÄHLENWENN(Bereich;1)"
oCell.Formula = "COUNTIF(Bereich;1)"
verwenden.

In LibreOffice kann Calc so eingestellt werden, dass es immer die englischen Funktionsbezeichner verwendet. Ansonsten kann diese Cross-Referenz verwendet werden.

Samstag, 17. September 2011

Linux kernel 2.4.x: zlib 1.2.5 breaks modutils

It may sound strange, but there are still Linux kernel 2.4.x out and up and running. Tools to manage (list, load, unload kernel modules) belong usually to a package called modutils. Modutils support dealing with gzip compressed images and therefore depend on zlib.

Unfortunately original implementation of modutils did use internal data structures of zlib to access compressed data. At least changes made by zlib version 1.2.5 break modutils and make insmod fail with SIGSEGV even on uncompressed modules.

All code dealing with compressed modules is bundled in a wrapper found in modutil source file util/gzfiles.c. This code needs to be patched.

Following patch removes dependency on zlib internal data structures and makes modutils work together with current zlib releases.

A unified diff patch follows:

--- modutils-2.4.21-orig/util/gzfiles.c    2001-01-05 02:45:19.000000000 +0100
+++ modutils-2.4.21/util/gzfiles.c    2011-01-03 12:10:18.000000000 +0100
@@ -13,22 +13,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-/* redefinition of gz_stream which isn't exported by zlib */
-typedef struct gz_stream {
-    z_stream stream;
-    int      z_err;   /* error code for last stream operation */
-    int      z_eof;   /* set if end of input file */
-    FILE     *file;   /* .gz file */
-    Byte     *inbuf;  /* input buffer */
-    Byte     *outbuf; /* output buffer */
-    uLong    crc;     /* crc32 of uncompressed data */
-    char     *msg;    /* error message */
-    char     *path;   /* path name for debugging only */
-    int      transparent; /* 1 if input file is not a .gz file */
-    char     mode;    /* 'w' or 'r' */
-    long     startpos; /* start of compressed data in file (header skipped) */
-} gz_stream;
-
 /* maximum number of simultaneous open files, also greater file descriptor number */
 #define MAXFD    64
 
@@ -40,14 +24,11 @@
     int fd;
     gzFile g;
 
-    if ((g=gzopen(name, "rb")) != NULL) {
-    fd=fileno(((gz_stream*)g)->file);
-    gzf_fds[fd]=g;
-    }
-    else if ((fd=open(name, mode)) != -1) {
-    gzf_fds[fd]=NULL; /* NULL means not GZ mode */
-    }
-    return fd;
+    if ((fd=open(name, mode)) != -1) {
+        g=gzdopen(fd, "rb");
+        gzf_fds[fd]=g;    /* NULL means not GZ mode */
+    }
+    return fd;
 }
 
 off_t gzf_lseek(int fd, off_t offset, int whence) {