From f1b620b50b3fa43949856ab4f901beabc87bcf0a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 6 Mar 2005 10:32:11 +0000 Subject: [PATCH] * scm/framework-ps.scm (dump-page): use output-units for landscape. * buildscripts/gen-emmentaler-scripts.py (i): lower case file name. --- ChangeLog | 7 ++ THANKS | 2 +- buildscripts/gen-emmentaler-scripts.py | 10 +- lily/kpath.cc | 34 ------- scm/encoding.scm | 134 +------------------------ scm/framework-ps.scm | 2 + scm/output-ps.scm | 3 +- 7 files changed, 21 insertions(+), 171 deletions(-) diff --git a/ChangeLog b/ChangeLog index c57227f155..745c207897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-03-06 Han-Wen Nienhuys + + * scm/framework-ps.scm (dump-page): use output-units for landscape. + + * buildscripts/gen-emmentaler-scripts.py (i): lower case file + name. + 2005-03-06 Jan Nieuwenhuizen * lily/main.cc (do_chroot_jail): Small cleanups. Avoid constant diff --git a/THANKS b/THANKS index bd3534e343..f1cb56155b 100644 --- a/THANKS +++ b/THANKS @@ -36,7 +36,6 @@ Marcus Macauley BUG HUNTERS/SUGGESTIONS - Jose Miguel Pasini Alexandre Beneteau Andreas Scherer @@ -56,6 +55,7 @@ Paul Scott Richard Schoeller Tapio Tuovila Will Oram +Wolfgang Hoffmann Release 2.4 *********** diff --git a/buildscripts/gen-emmentaler-scripts.py b/buildscripts/gen-emmentaler-scripts.py index 4b0946f0c7..bf2d4b4e94 100644 --- a/buildscripts/gen-emmentaler-scripts.py +++ b/buildscripts/gen-emmentaler-scripts.py @@ -24,7 +24,9 @@ for opt in options: for design_size in [11,13,14,16,18,20,23,26]: name = 'Emmentaler' + filename = name.lower () script = '''#!@FONTFORGE@ + New(); # Separate Feta versioning? @@ -63,12 +65,12 @@ LoadTableFromFile("LILF", "%(name)s-%(design_size)d.subfonts") LoadTableFromFile("LILC", "feta%(design_size)d.otf-table") LoadTableFromFile("LILY", "feta%(design_size)d.otf-gtable") -Generate("%(name)s-%(design_size)d.otf"); -Generate("%(name)s-%(design_size)d.cff"); -Generate("%(name)s-%(design_size)d.svg"); +Generate("%(filename)s-%(design_size)d.otf"); +Generate("%(filename)s-%(design_size)d.cff"); +Generate("%(filename)s-%(design_size)d.svg"); ''' % vars() - path = os.path.join (outdir, '%s-%d.pe' % (name, design_size)) + path = os.path.join (outdir, '%s-%d.pe' % (filename, design_size)) open (path, 'w').write (script) subfonts = ['feta%(design_size)d', diff --git a/lily/kpath.cc b/lily/kpath.cc index 8140f9cfbc..fed266f797 100644 --- a/lily/kpath.cc +++ b/lily/kpath.cc @@ -105,40 +105,6 @@ kpathsea_find_format (String name) } #endif -String -kpathsea_gulp_file_to_string (String name) -{ - String file_name = global_path.find (name); - -#if (KPATHSEA && HAVE_KPSE_FIND_FILE) - if (file_name.is_empty ()) - { - char *p = kpse_find_file (name.to_str0 (), kpathsea_find_format (name), - true); - if (p) - file_name = p; - else - warning (_f ("kpathsea can't find file: `%s'", name)); - } -#endif - - if (file_name.is_empty ()) - error (_f ("can't find file: `%s'", name)); - - if (be_verbose_global) - progress_indication ("[" + file_name); - - int filesize; - char *str = gulp_file (file_name, &filesize); - String string (str); - delete[] str; - - if (be_verbose_global) - progress_indication ("]"); - - return string; -} - void diff --git a/scm/encoding.scm b/scm/encoding.scm index cf3b90040b..ba9b4c7d93 100644 --- a/scm/encoding.scm +++ b/scm/encoding.scm @@ -4,147 +4,21 @@ ;;;; ;;;; (c) 2004--2005 Jan Nieuwenhuizen -;; WIP -;; encoding.ly: -;; #(display (reencode-string "adobe" "latin1" "hellö fóebär")) -;; -(define-public (read-encoding-file file-name) - "Read .enc file, return (COMMAND-NAME . VECTOR-OF-SYMBOLS)." - (let* ((path (ly:kpathsea-find-file file-name)) - (unused (if (string? path) #t (ly:warn "can't find ~s" file-name))) - (raw (cached-file-contents path)) - (string (regexp-substitute/global #f "%[^\n]*" raw 'pre "" 'post)) - (command (match:substring - (string-match "/([^ \t\n\r]*)[ \t\n\r]*[[]" string) 1)) - (encoding (match:substring (string-match "[[](.*)[]]" string) 1)) - (ps-lst (string-tokenize encoding)) - (lst (map (lambda (x) (string->symbol (substring x 1))) ps-lst)) - (vector (list->vector lst))) - (cons command vector))) +(define-public latin1-coding-vector #(.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef space exclam quotedbl numbersign dollar percent ampersand quoteright parenleft parenright asterisk plus comma hyphen period slash zero one two three four five six seven eight nine colon semicolon less equal greater question at A B C D E F G H I J K L M N O P Q R S T U V W X Y Z bracketleft backslash bracketright asciicircum underscore quoteleft a b c d e f g h i j k l m n o p q r s t u v w x y z braceleft bar braceright asciitilde .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef dotlessi grave acute circumflex tilde macron breve dotaccent dieresis .notdef ring cedilla .notdef hungarumlaut ogonek caron space exclamdown cent sterling currency yen brokenbar section dieresis copyright ordfeminine guillemotleft logicalnot hyphen registered macron degree plusminus twosuperior threesuperior acute mu paragraph periodcentered cedilla onesuperior ordmasculine guillemotright onequarter onehalf threequarters questiondown Agrave Aacute Acircumflex Atilde Adieresis Aring AE Ccedilla Egrave Eacute Ecircumflex Edieresis Igrave Iacute Icircumflex Idieresis Eth Ntilde Ograve Oacute Ocircumflex Otilde Odieresis multiply Oslash Ugrave Uacute Ucircumflex Udieresis Yacute Thorn germandbls agrave aacute acircumflex atilde adieresis aring ae ccedilla egrave eacute ecircumflex edieresis igrave iacute icircumflex idieresis eth ntilde ograve oacute ocircumflex otilde odieresis divide oslash ugrave uacute ucircumflex udieresis yacute thorn ydieresis)) -(define (make-encoding-table encoding-vector) - "Return a hash table mapping names to chars. ENCODING-VECTOR is a -vector of symbols." - (let* ((h (make-hash-table 256))) - - (for-each - (lambda (i) - (hash-set! h (vector-ref encoding-vector i) - (integer->char i))) - (iota 256)) - - h)) - -(define-public (reencode-string mapping str) - "Apply MAPPING, a vector of [0..256) -> char, to STR" - (string-map (lambda (chr) - (vector-ref mapping (char->integer chr))) - str)) - -(define-public (make-encoding-mapping input-encoding output-encoding) - "Contruct a mapping by applying output-encoding after input-encoding " - (list->vector - (map - (lambda (byte) - (let ((new-char (hash-ref - output-encoding (vector-ref input-encoding byte) #f))) - ;;input-encoding (vector-ref output-encoding byte) #f))) - - ;; substitute space for unknown characters. - (if (char? new-char) - new-char - #\ ))) - (iota 256)))) - - -(define (get-coding-from-file file-name) - "Read FILE-NAME, return a list containing encoding vector and table" - (let* ((coding (read-encoding-file file-name)) - (command (car coding)) - (vector (cdr coding)) - (table (make-encoding-table vector))) - (list command vector table))) - -;; coding-alist maps NAME -> (list FILE-NAME COMMAND VECTOR TAB) -(define coding-alist - - (map (lambda (x) - (cons (car x) - (cons (cdr x) (delay (get-coding-from-file (cdr x)))))) - '( - ;; teTeX font (output) encodings - ("TeX-typewriter-text" . "09fbbfac.enc") ;; cmtt10 - ("TeX-math-symbols" . "10037936.enc") ;; cmbsy - ("ASCII-caps-and-digits" . "1b6d048e.enc") ;; cminch - ("TeX-math-italic" . "aae443f0.enc") ;; cmmi10 - ("TeX-extended-ASCII" . "d9b29452.enc") - ("TeX-text" . "cmr.enc") - ("TeX-text-without-f-ligatures" . "0ef0afca.enc") - ("Extended-TeX-Font-Encoding---Latin" . "tex256.enc") - ("AdobeStandardEncoding" . "8a.enc") - ("T1" . "tex256.enc") - ("adobe" . "8a.enc") - ;; EC-fonts-mftraced - ("Extended-TeX-Font-Encoding---Latin" . "EC.enc") - ;; lmodern, encoding flavour latin1 - ("cork-lm" . "cork-lm.enc") - - ;; input encodings - ("latin1" . "latin1.enc") - ("cork" . "cork.enc") - - ;; LilyPond FETA music font - ("fetaBraces" . "feta-braces-a.enc") - ;;("fetaDynamic" . "feta-din10.enc") - ;;("fetaNumber" . "feta-nummer10.enc") - ("fetaDynamic" . "feta-alphabet20.enc") - ("fetaNumber" . "feta-alphabet20.enc") - ("fetaMusic" . "feta20.enc") - ("parmesanMusic" . "parmesan20.enc")) - )) - -;; FIXME: this is broken, cannot get font encoding from font/AFM file, -;; should use encoding from font-tree in fonts.scm -(define (get-coding coding-name) - (let ((entry (assoc-get coding-name coding-alist))) - (if entry - (cons (car entry) (force (cdr entry))) - (if (equal? coding-name "feta-music") - (begin - (ly:warn "installation problem: deprecated encoding requested: ~S" coding-name) - (exit 1)) - (let ((fallback "latin1")) - (ly:programming-error "no such encoding: ~S" coding-name) - (ly:programming-error "programming error: cross thumbs, using: ~S:" fallback) - (get-coding fallback)))))) - -(define-public (get-coding-file-name coding-name) - (car (get-coding coding-name))) - -(define-public (get-coding-command coding-name) - (cadr (get-coding coding-name))) - -(define-public (get-coding-vector coding-name) - (caddr (get-coding coding-name))) - -(define-public (get-coding-table coding-name) - (cadddr (get-coding coding-name))) - - -(define-public (decode-byte-string encoding-name str) +(define-public (decode-byte-string str) "Return vector of glyphname symbols that correspond to string, assuming that STR is byte-coded using ENCODING-NAME." - (let* ((coding-vector (get-coding-vector encoding-name)) - (len (string-length str)) + (let* ((len (string-length str)) (output-vector (make-vector len '.notdef))) (do ((idx 0 (1+ idx))) ((>= idx len) output-vector) (vector-set! output-vector idx - (vector-ref coding-vector + (vector-ref latin1-coding-vector (char->integer (string-ref str idx))))))) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 5a9094cd91..c5e973c17c 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -227,6 +227,8 @@ (aname (string-append x ".pfa")) (bname (string-append x ".pfb")) (cff-file-name (ly:find-file cffname)) + (a-file-name (ly:kpathsea-find-file aname)) + (b-file-name (ly:kpathsea-find-file bname)) ) (cond ((and bare-file-name (string-match "\\.pfb" bare-file-name)) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 1c725c7173..defeb0c2cf 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -278,8 +278,7 @@ (let* ((space-length (cdar (ly:text-dimension font " "))) (space-move (string-append (number->string space-length) " 0.0 rmoveto ")) - (input-enc "latin1") - (out-vec (decode-byte-string input-enc s))) + (out-vec (decode-byte-string s))) (string-append (ps-font-command font) " setfont " -- 2.39.2